{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/signathing-com/json-schema/signathing-com-document-schema.json",
  "title": "Document",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/signathing-com-v1-openapi.json#/components/schemas/Document",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer"
    },
    "object": {
      "type": "string",
      "const": "document"
    },
    "status": {
      "type": "string",
      "enum": [
        "sent",
        "completed",
        "declined",
        "voided",
        "expired",
        "cancelled"
      ],
      "description": "A sent document whose expires_at has passed reads expired at once; the document.expired webhook fires once from the ten-minute sweep. POST /documents/{id}/extend puts it back to sent."
    },
    "title": {
      "type": "string"
    },
    "message": {
      "type": [
        "string",
        "null"
      ]
    },
    "sequential": {
      "type": "boolean"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "completed_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "voided_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "expires_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "original_sha256": {
      "type": "string"
    },
    "signed_sha256": {
      "type": [
        "string",
        "null"
      ]
    },
    "sealed": {
      "type": "boolean",
      "description": "The certified PDF carries Signathing's digital seal (see /.well-known/signathing-seal.pem)."
    },
    "test": {
      "type": "boolean",
      "description": "Sent in test mode."
    },
    "erase_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When the files and personal details are erased (a retention setting, or the end of a test document's week). Null when the document is kept."
    },
    "fingerprint": {
      "type": "string",
      "description": "sha256('signathing-doc:' + id + ':' + original_sha256); the document's key in the public evidence log."
    },
    "signers": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "role": {
            "type": [
              "string",
              "null"
            ]
          },
          "viewer": {
            "type": "boolean"
          },
          "approver": {
            "type": "boolean"
          },
          "cc": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "description": "pending | viewed | signed | approved | declined"
          },
          "order": {
            "type": "integer"
          },
          "viewed_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "signed_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "declined_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "verification_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "signing_url": {
            "type": "string"
          }
        }
      }
    },
    "attachments": {
      "type": "array",
      "description": "Files signers uploaded into attachment fields.",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "signer_id": {
            "type": "integer"
          },
          "field_id": {
            "type": "string"
          },
          "filename": {
            "type": "string"
          },
          "mime": {
            "type": "string"
          },
          "size": {
            "type": "integer"
          },
          "sha256": {
            "type": "string"
          },
          "download_url": {
            "type": "string"
          }
        }
      }
    },
    "downloads": {
      "type": "object",
      "properties": {
        "original": {
          "type": "string"
        },
        "signed": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "evidence": {
      "type": "string",
      "description": "URL of the evidence package."
    },
    "events": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "at": {
            "type": "string"
          },
          "signer_id": {
            "type": [
              "integer",
              "null"
            ]
          },
          "detail": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    }
  }
}