{"openapi":"3.1.0","jsonSchemaDialect":"https://spec.openapis.org/oas/3.1/dialect/base","info":{"title":"SignThat API","version":"1.1.0","summary":"Create, send, and track agreements from the systems your team already uses.","description":"Use the SignThat API to create reusable templates, generate finished documents, and create signature agreements.\n\nAll operational requests use a company-bound Bearer API key. Each operation documents the required key scope. Create and send operations are separate, idempotent requests: creating an agreement returns secure signing links and does not email them immediately; optional scheduled delivery happens later.\n\nAPI-created documents and agreements use standard server storage. Zero-knowledge agreement creation requires participant-held browser keys and is therefore browser-only.","contact":{"name":"SignThat integration support","email":"hello@signthat.app"}},"externalDocs":{"description":"Read the developer guide and copy-ready examples","url":"https://app.signthat.app/developers"},"servers":[{"url":"https://api.signthat.app/v1","description":"Canonical SignThat public API"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"API","description":"API availability and version metadata."},{"name":"Templates","description":"Reusable agreement source content and its sender- or recipient-filled fields."},{"name":"Documents","description":"Immutable, fully filled template snapshots that can be downloaded as PDFs. Documents do not collect signatures."},{"name":"Contracts","description":"Signature agreements, recipients, email delivery, status, and audit events."}],"paths":{"/":{"get":{"tags":["API"],"summary":"Get API metadata","description":"Confirms that the API key is valid and identifies this version of the machine-to-machine API. No resource scope is required.","operationId":"getApiMetadata","responses":{"200":{"description":"API metadata","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiMetadata"},"example":{"name":"SignThat API","version":"v1","base_url":"https://api.signthat.app/v1","openapi_url":"https://api.signthat.app/openapi.json","zero_knowledge_supported":false}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/templates":{"get":{"tags":["Templates"],"summary":"List active templates","description":"Returns up to 250 non-archived templates, ordered by most recently updated. Requires the `templates:read` scope.","operationId":"listTemplates","x-required-scope":"templates:read","responses":{"200":{"description":"Template collection","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateCollection"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}},"post":{"tags":["Templates"],"summary":"Create a template","description":"Creates a reusable Markdown or HTML template. Placeholders use the form `{{client_name}}`.\n\nThe placeholder order in `content` determines field order. A placeholder omitted from `fields` becomes a required sender-filled text field. Field entries that do not match a placeholder in `content` are ignored. Requires the `templates:write` scope and charges the configured template-creation credit cost.","operationId":"createTemplate","x-required-scope":"templates:write","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTemplateRequest"},"example":{"name":"Consulting agreement","format":"markdown","content":"# Agreement\n\nClient: {{client_name}}\n\nScope: {{scope}}","fields":[{"placeholder":"client_name","label":"Client name","filled_by":"sender","required":true},{"placeholder":"scope","label":"Scope","field_type":"multiline","filled_by":"recipient","required":true}]}}}},"responses":{"201":{"description":"Template created","headers":{"Idempotency-Replayed":{"$ref":"#/components/headers/IdempotencyReplayed"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTemplateResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/InsufficientCredits"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/templates/{id}":{"get":{"tags":["Templates"],"summary":"Get a template and its fields","description":"Returns template source content and normalized field definitions. Requires the `templates:read` scope.","operationId":"getTemplate","x-required-scope":"templates:read","parameters":[{"$ref":"#/components/parameters/TemplateId"}],"responses":{"200":{"description":"Template detail","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/documents":{"get":{"tags":["Documents"],"summary":"List generated documents","description":"Returns up to 100 documents, newest first. `external_id` is an exact-match filter. Requires the `documents:read` scope.","operationId":"listDocuments","x-required-scope":"documents:read","parameters":[{"$ref":"#/components/parameters/ExternalIdFilter"}],"responses":{"200":{"description":"Document collection","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentCollection"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}},"post":{"tags":["Documents"],"summary":"Generate a document from a template","description":"Fills every template field immediately and stores an immutable source-and-value snapshot. A document has no recipients and does not collect signatures.\n\nRequires the `documents:write` scope and charges the configured document-creation credit cost. Zero-knowledge flags and encrypted payloads are rejected.","operationId":"createDocument","x-required-scope":"documents:write","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDocumentRequest"},"example":{"template_id":"tpl_N7k2pQ4mV8xR","external_id":"invoice_7821","title":"Invoice 7821","values":{"client_name":"Acme Ltd","total":"€2,400"},"metadata":{"source":"erp"},"tags":["invoice","api"]}}}},"responses":{"201":{"description":"Document created","headers":{"Idempotency-Replayed":{"$ref":"#/components/headers/IdempotencyReplayed"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDocumentResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/InsufficientCredits"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/documents/{id}":{"get":{"tags":["Documents"],"summary":"Get a generated document","description":"Returns the immutable template source, normalized values, rendered content, metadata, and tags. Requires the `documents:read` scope.","operationId":"getDocument","x-required-scope":"documents:read","parameters":[{"$ref":"#/components/parameters/DocumentId"}],"responses":{"200":{"description":"Document detail","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/documents/{id}/pdf":{"get":{"tags":["Documents"],"summary":"Download a generated PDF","description":"Renders and downloads the immutable document snapshot. Requires the `documents:read` scope.\n\nEach logical download uses the configured PDF-download credit cost. Repeating this request for the same document with the same `Idempotency-Key` avoids another charge; use a new key when a distinct billable download is intended.","operationId":"downloadDocumentPdf","x-required-scope":"documents:read","parameters":[{"$ref":"#/components/parameters/DocumentId"},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"Generated PDF file","headers":{"Cache-Control":{"$ref":"#/components/headers/PrivateNoStore"},"Content-Disposition":{"$ref":"#/components/headers/PdfContentDisposition"},"X-Credits-Charged":{"$ref":"#/components/headers/CreditsCharged"},"X-Credits-Remaining":{"$ref":"#/components/headers/CreditsRemaining"},"X-PDF-Cache":{"$ref":"#/components/headers/PdfCache"}},"content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/InsufficientCredits"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/InternalError"},"502":{"$ref":"#/components/responses/BadGateway"},"503":{"$ref":"#/components/responses/PdfUnavailable"}}}},"/contract-pdf-uploads":{"post":{"tags":["Contracts"],"summary":"Upload a ready PDF agreement source","description":"Uploads a non-empty, valid, non-encrypted PDF to private S3-compatible storage. The default size limit is 20 MiB and the fixed page limit is 500; an installation may configure a different byte limit.\n\nUse the returned one-time `upload_id` as `source_pdf_upload_id` when creating an agreement within 24 hours. The upload endpoint is limited to 10 requests per minute per API key, in addition to the general API limit. Requires the `contracts:write` scope.","operationId":"uploadContractPdf","x-required-scope":"contracts:write","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/PdfFileName"}],"requestBody":{"required":true,"description":"The raw PDF bytes. Do not JSON- or base64-encode the file.","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"responses":{"201":{"description":"Ready PDF uploaded","headers":{"Idempotency-Replayed":{"$ref":"#/components/headers/IdempotencyReplayed"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractPdfUpload"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/StorageUnavailable"}}}},"/contracts":{"get":{"tags":["Contracts"],"summary":"List recent agreements","description":"Returns up to 100 agreements, newest first. `external_id` is an exact-match filter. Requires the `contracts:read` scope.","operationId":"listContracts","x-required-scope":"contracts:read","parameters":[{"$ref":"#/components/parameters/ExternalIdFilter"}],"responses":{"200":{"description":"Agreement collection","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractCollection"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}},"post":{"tags":["Contracts"],"summary":"Create a standard agreement","description":"Creates an agreement from exactly one source: a reusable `template_id` or a one-time `source_pdf_upload_id`. Creation returns secure signing links but does not immediately send email. Call `POST /contracts/{id}/send` with a separate idempotency key, or supply a future `scheduled_send_at`.\n\nRequires the `contracts:write` scope. Agreement, signature-request, and optional feature credit costs are charged atomically. Encryption flags and payloads are rejected.","operationId":"createContract","x-required-scope":"contracts:write","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateContractRequest"},"example":{"template_id":"tpl_N7k2pQ4mV8xR","external_id":"order_7821","title":"Consulting agreement","language":"en","values":{"client_name":"Acme Ltd"},"recipients":[{"name":"Jane Smith","email":"jane@example.com","language":"fr"}],"metadata":{"order_id":7821},"reminder_days":3}}}},"responses":{"201":{"description":"Agreement created","headers":{"Idempotency-Replayed":{"$ref":"#/components/headers/IdempotencyReplayed"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateContractResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/InsufficientCredits"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/contracts/{id}":{"get":{"tags":["Contracts"],"summary":"Get agreement and recipient status","description":"Returns current delivery, agreement, recipient, review, and photo-evidence metadata. It does not return signing links. Requires the `contracts:read` scope.","operationId":"getContract","x-required-scope":"contracts:read","parameters":[{"$ref":"#/components/parameters/ContractId"}],"responses":{"200":{"description":"Agreement detail","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contract"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/contracts/{id}/events":{"get":{"tags":["Contracts"],"summary":"Get agreement audit events","description":"Returns events in chronological order, oldest first. Requires the `contracts:read` scope.","operationId":"listContractEvents","x-required-scope":"contracts:read","parameters":[{"$ref":"#/components/parameters/ContractId"}],"responses":{"200":{"description":"Chronological event collection","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractEventCollection"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}},"/contracts/{id}/send":{"post":{"tags":["Contracts"],"summary":"Email pending recipients","description":"Emails the secure signing link to one selected recipient or every recipient whose signing status is still `sent`. A previously emailed, still-pending recipient may be emailed again.\n\nThe API key creator must have a verified email address. Requires the `contracts:write` scope and a new `Idempotency-Key` distinct from agreement creation.","operationId":"sendContract","x-required-scope":"contracts:write","parameters":[{"$ref":"#/components/parameters/ContractId"},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendContractRequest"},"example":{"recipient_id":"rcp_B8v3nT6yL1zQ","message":"Please review and sign this agreement."}}}},"responses":{"200":{"description":"Delivery result","headers":{"Idempotency-Replayed":{"$ref":"#/components/headers/IdempotencyReplayed"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendContractResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/InternalError"},"502":{"$ref":"#/components/responses/BadGateway"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}}},"webhooks":{"agreementEvent":{"post":{"summary":"Receive an agreement lifecycle event","description":"SignThat sends this request to webhook endpoints configured in Workspace settings. Event types are selected per endpoint.\n\nVerify `X-SignThat-Signature` before parsing the body. Its `v1` value is the lowercase hexadecimal HMAC-SHA256 of `<timestamp>.<raw-request-body>`, using the endpoint signing secret. Reject stale timestamps, compare signatures in constant time, deduplicate using the body `id`, and return any 2xx response promptly. Unsuccessful deliveries are retried up to eight times with backoff.","operationId":"receiveAgreementWebhook","security":[],"parameters":[{"$ref":"#/components/parameters/WebhookEventHeader"},{"$ref":"#/components/parameters/WebhookDeliveryHeader"},{"$ref":"#/components/parameters/WebhookSignatureHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"},"example":{"id":"evt_G5n8dR2kP9wQ","type":"recipient.completed","created_at":"2026-07-11T09:24:00.000Z","data":{"contract":{"id":"agr_H4s9mK2qP7wX","external_id":"order_7821","title":"Consulting agreement","status":"completed","delivery_state":"sent","zero_knowledge":false,"created_via":"api","created_at":"2026-07-11T09:00:00.000Z","completed_at":"2026-07-11T09:24:00.000Z","viewed_at":"2026-07-11T09:18:00.000Z"},"recipient":{"id":"rcp_B8v3nT6yL1zQ","name":"Jane Smith","email":"jane@example.com","status":"completed","email_sent_at":"2026-07-11T09:01:00.000Z","viewed_at":"2026-07-11T09:18:00.000Z","submitted_at":"2026-07-11T09:24:00.000Z","completed_at":"2026-07-11T09:24:00.000Z","reviewed_at":null,"review_feedback":null}}}}}},"responses":{"2XX":{"description":"The event was accepted."}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"st_live_… or st_test_…","description":"A company-bound SignThat API key generated in Workspace settings. Keep it in a server-side secret store."}},"parameters":{"TemplateId":{"name":"id","in":"path","required":true,"description":"Opaque template identifier returned by SignThat.","schema":{"$ref":"#/components/schemas/TemplateId"}},"DocumentId":{"name":"id","in":"path","required":true,"description":"Opaque generated-document identifier returned by SignThat.","schema":{"$ref":"#/components/schemas/DocumentId"}},"ContractId":{"name":"id","in":"path","required":true,"description":"Opaque agreement identifier returned by SignThat.","schema":{"$ref":"#/components/schemas/ContractId"}},"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":8,"maxLength":190,"pattern":"^[A-Za-z0-9_.:-]+$"},"example":"order-7821-contract","description":"A stable, non-secret identifier for one logical operation. Use 8–190 letters, numbers, dots, underscores, colons, or hyphens.\n\nFor create and send operations, the same key and request replay the stored response and set `Idempotency-Replayed: true`; changing the request while reusing the key returns HTTP 409. Those keys are scoped to the API key that made the request. For a document PDF, the same key and document avoid a second download charge across the workspace."},"ExternalIdFilter":{"name":"external_id","in":"query","required":false,"description":"Return only the resource whose customer-system reference exactly matches this value.","schema":{"type":"string","minLength":1,"maxLength":190},"example":"order_7821"},"PdfFileName":{"name":"file_name","in":"query","required":false,"description":"Display name stored with the source PDF. Directory components and unsafe characters are removed. If omitted, `agreement.pdf` is used; a `.pdf` suffix is added when absent.","schema":{"type":"string","minLength":1,"maxLength":255,"default":"agreement.pdf"},"example":"filled-agreement.pdf"},"WebhookEventHeader":{"name":"X-SignThat-Event","in":"header","required":true,"description":"The lifecycle event type. It matches the body `type`.","schema":{"$ref":"#/components/schemas/WebhookEventType"}},"WebhookDeliveryHeader":{"name":"X-SignThat-Delivery","in":"header","required":true,"description":"The numeric delivery attempt record. Deduplicate business processing with the event `id` in the body.","schema":{"type":"string","pattern":"^\\d+$"}},"WebhookSignatureHeader":{"name":"X-SignThat-Signature","in":"header","required":true,"description":"Signing timestamp and HMAC-SHA256 signature over the exact raw body.","schema":{"type":"string","pattern":"^t=\\d+,v1=[a-f0-9]{64}$"},"example":"t=1783785600,v1=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"}},"headers":{"IdempotencyReplayed":{"description":"Present with the string value `true` when a completed create or send response was replayed.","schema":{"type":"string","const":"true"}},"RetryAfter":{"description":"Whole seconds to wait before retrying.","schema":{"type":"integer","minimum":1}},"PrivateNoStore":{"description":"Prevents shared or browser caches from retaining the generated PDF.","schema":{"type":"string","const":"private, no-store"}},"PdfContentDisposition":{"description":"Attachment filename derived from the document title.","schema":{"type":"string"}},"CreditsCharged":{"description":"Credits charged for this logical download. A safely repeated download reports zero.","schema":{"type":"number","minimum":0,"multipleOf":0.01}},"CreditsRemaining":{"description":"Workspace credit balance after this logical download.","schema":{"type":"number","multipleOf":0.01}},"PdfCache":{"description":"Whether PDF generation used or populated the encrypted server-side artifact cache.","schema":{"type":"string","enum":["BYPASS","HIT","HIT_LOCAL","MISS","MISS_UNCOMMITTED"]}}},"responses":{"Unauthorized":{"description":"The API key is missing, malformed, expired, revoked, or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"INVALID_API_KEY","message":"Provide a valid API key as a Bearer token."}}}}},"Forbidden":{"description":"The API key lacks the required scope, or its creator does not meet an operation prerequisite such as verified email.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"INSUFFICIENT_SCOPE","message":"This API key requires the contracts:write scope."}}}}},"BadRequest":{"description":"The request is missing a required value, contains an invalid value, or cannot be performed in the resource state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"INVALID_REQUEST","message":"title and recipients are required."}}}}},"InsufficientCredits":{"description":"The workspace balance or API key creator's monthly allocation cannot cover the operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"INSUFFICIENT_CREDITS","message":"Not enough credits. 3 required, 1 available.","details":{"required":3,"balance":1}}}}}},"Conflict":{"description":"An idempotency key or external identifier conflicts, a ready-PDF upload is unavailable, or workspace storage policy prevents the operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"IDEMPOTENCY_KEY_REUSED","message":"This Idempotency-Key was already used for a different request."}}}}},"NotFound":{"description":"The resource, source template, or linked customer does not exist in the API key company.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"CONTRACT_NOT_FOUND","message":"Contract not found."}}}}},"PayloadTooLarge":{"description":"The JSON body, template content, or PDF exceeds its applicable size or page limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"CONTENT_TOO_LARGE","message":"Template content is too large."}}}}},"UnsupportedMediaType":{"description":"The ready-PDF upload was not sent with `Content-Type: application/pdf`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"AGREEMENT_PDF_CONTENT_TYPE_REQUIRED","message":"Send the PDF bytes with Content-Type: application/pdf."}}}}},"RateLimited":{"description":"The per-key limit was exceeded. General API operations allow 120 requests per minute for each method and path; ready-PDF uploads allow 10.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"RATE_LIMITED","message":"Too many requests — retry after the delay in the Retry-After header."}}}}},"BadGateway":{"description":"An upstream PDF conversion, object storage, or email delivery operation failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"DELIVERY_FAILED","message":"No messages could be sent."}}}}},"ServiceUnavailable":{"description":"SignThat is temporarily unavailable because of maintenance or database availability.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"MAINTENANCE_MODE","message":"SignThat is temporarily unavailable while maintenance is in progress."}}}}},"PdfUnavailable":{"description":"SignThat is unavailable, or PDF generation is already in progress or temporarily unavailable.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"PDF_GENERATION_IN_PROGRESS","message":"This PDF is already being generated; retry the same download shortly."}}}}},"StorageUnavailable":{"description":"SignThat is unavailable, or private object storage is not configured or temporarily unavailable.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"OBJECT_STORAGE_NOT_CONFIGURED","message":"Private object storage is not configured for ready PDF agreements."}}}}},"InternalError":{"description":"An unexpected server error occurred. Retry with backoff and contact support if it persists.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"INTERNAL_ERROR","message":"Internal server error."}}}}}},"schemas":{"ApiMetadata":{"type":"object","additionalProperties":false,"required":["name","version","base_url","openapi_url","zero_knowledge_supported"],"properties":{"name":{"type":"string","const":"SignThat API"},"version":{"type":"string","const":"v1"},"base_url":{"type":"string","format":"uri","description":"Canonical base URL for v1 API requests."},"openapi_url":{"type":"string","format":"uri","description":"Canonical OpenAPI 3.1 document URL."},"zero_knowledge_supported":{"type":"boolean","const":false,"description":"Zero-knowledge agreement creation is browser-only."}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","additionalProperties":false,"required":["code","message"],"properties":{"code":{"type":"string","description":"Stable, machine-readable code. Branch integration logic on this value rather than `message`.","examples":["MISSING_FIELDS"]},"message":{"type":"string","description":"Human-readable explanation intended for logs or operator-facing messages."},"details":{"description":"Optional structured context whose shape depends on `code`, such as invalid fields, delivery failures, or credit balances."}}}}},"TemplateId":{"type":"string","pattern":"^tpl_[A-Za-z0-9_-]+$","description":"Opaque template identifier. Store it exactly and do not infer information from it.","examples":["tpl_N7k2pQ4mV8xR"]},"DocumentId":{"type":"string","pattern":"^doc_[A-Za-z0-9_-]+$","description":"Opaque generated-document identifier.","examples":["doc_F3d8sJ5nC2yL"]},"ContractId":{"type":"string","pattern":"^agr_[A-Za-z0-9_-]+$","description":"Opaque signature-agreement identifier.","examples":["agr_H4s9mK2qP7wX"]},"CustomerId":{"type":"string","pattern":"^cus_[A-Za-z0-9_-]+$","description":"Opaque SignThat customer identifier."},"RecipientId":{"type":"string","pattern":"^rcp_[A-Za-z0-9_-]+$","description":"Opaque agreement-recipient identifier.","examples":["rcp_B8v3nT6yL1zQ"]},"EventId":{"type":"string","pattern":"^evt_[A-Za-z0-9_-]+$","description":"Opaque webhook event identifier. Use it to deduplicate event processing."},"ExternalId":{"type":["string","null"],"maxLength":190,"description":"Customer-system correlation value. When supplied, it must be unique within this workspace and resource type.","examples":["order_7821"]},"CreditAmount":{"type":"number","multipleOf":0.01,"description":"Workspace credits, represented to two decimal places."},"FieldValue":{"type":["string","number","boolean","null"],"description":"A scalar value. SignThat trims and stores non-null values as strings before field validation."},"FieldValues":{"type":"object","description":"Values keyed by template placeholder. Unknown placeholders are ignored.","additionalProperties":{"$ref":"#/components/schemas/FieldValue"}},"Metadata":{"type":["object","null"],"description":"Customer-controlled JSON correlation data. The serialized object may not exceed 20 KB.","additionalProperties":true},"Tags":{"type":"array","maxItems":20,"uniqueItems":true,"description":"Up to 20 labels. Whitespace is normalized, duplicates are removed, and blank values are discarded.","items":{"type":"string","minLength":1,"maxLength":60}},"TemplateFieldInput":{"type":"object","additionalProperties":false,"required":["placeholder"],"properties":{"placeholder":{"type":"string","minLength":1,"maxLength":190,"pattern":"^[A-Za-z0-9_.-]+$","description":"Name inside the matching `{{placeholder}}` token in template content."},"label":{"type":"string","maxLength":255,"description":"Human-readable label. Defaults to a title-cased form of `placeholder`."},"field_type":{"type":"string","enum":["text","multiline","date","dropdown"],"default":"text"},"options":{"type":"array","maxItems":50,"uniqueItems":true,"description":"Allowed values for a dropdown field. Ignored for other field types.","items":{"type":"string","minLength":1,"maxLength":255}},"filled_by":{"type":"string","enum":["sender","recipient"],"default":"sender","description":"Whether the API caller supplies the value during creation or a signer supplies it later."},"required":{"type":"boolean","default":true,"description":"Whether a non-empty value is required from the selected party."},"default_value":{"type":["string","null"],"description":"Fallback value. A date default uses `YYYY-MM-DD`; a dropdown default must appear in `options`."}}},"TemplateField":{"type":"object","required":["placeholder","label","field_type","options","filled_by","required","default_value","position"],"properties":{"placeholder":{"type":"string","maxLength":190},"label":{"type":"string","maxLength":255},"field_type":{"type":"string","enum":["text","multiline","date","dropdown"]},"options":{"type":"array","maxItems":50,"items":{"type":"string","maxLength":255}},"filled_by":{"type":"string","enum":["sender","recipient"]},"required":{"type":"boolean","description":"Whether the field is mandatory."},"default_value":{"type":["string","null"]},"position":{"type":"integer","minimum":0}}},"TemplateSummary":{"type":"object","required":["id","name","category","format","font_family","field_count","created_at","updated_at"],"properties":{"id":{"$ref":"#/components/schemas/TemplateId"},"name":{"type":"string"},"category":{"type":"string"},"format":{"type":"string","enum":["markdown","html"]},"font_family":{"type":"string","description":"Font family used for previews and generated PDFs."},"field_count":{"type":"integer","minimum":0,"maximum":500},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"Template":{"allOf":[{"$ref":"#/components/schemas/TemplateSummary"},{"type":"object","required":["content","fields"],"properties":{"content":{"type":"string","description":"Original Markdown or HTML template source."},"fields":{"type":"array","maxItems":500,"items":{"$ref":"#/components/schemas/TemplateField"}}}}]},"TemplateCollection":{"type":"object","additionalProperties":false,"required":["data"],"properties":{"data":{"type":"array","maxItems":250,"items":{"$ref":"#/components/schemas/TemplateSummary"}}}},"CreateTemplateRequest":{"type":"object","additionalProperties":false,"required":["name","content"],"properties":{"name":{"type":"string","minLength":1,"maxLength":255},"category":{"type":"string","maxLength":80,"default":"General"},"format":{"type":"string","enum":["markdown","html"],"default":"markdown"},"font_family":{"type":"string","maxLength":120,"default":"Noto Sans"},"content":{"type":"string","minLength":1,"maxLength":1500000,"description":"Markdown or HTML source containing up to 500 unique `{{placeholder}}` tokens."},"fields":{"type":"array","maxItems":500,"description":"Optional settings for placeholders found in `content`.","items":{"$ref":"#/components/schemas/TemplateFieldInput"}}}},"CreateTemplateResponse":{"type":"object","required":["id","name","format","font_family","fields","credits_charged","credits_remaining"],"properties":{"id":{"$ref":"#/components/schemas/TemplateId"},"name":{"type":"string"},"format":{"type":"string","enum":["markdown","html"]},"font_family":{"type":"string"},"fields":{"type":"array","description":"Detected placeholder names in first-occurrence order.","items":{"type":"string"}},"credits_charged":{"$ref":"#/components/schemas/CreditAmount"},"credits_remaining":{"$ref":"#/components/schemas/CreditAmount"}}},"DocumentSummary":{"type":"object","required":["id","external_id","title","template_id","template_name","customer_id","created_via","created_at"],"properties":{"id":{"$ref":"#/components/schemas/DocumentId"},"external_id":{"$ref":"#/components/schemas/ExternalId"},"title":{"type":"string"},"template_id":{"$ref":"#/components/schemas/TemplateId"},"template_name":{"type":"string"},"customer_id":{"anyOf":[{"$ref":"#/components/schemas/CustomerId"},{"type":"null"}]},"created_via":{"type":"string","enum":["web","api"]},"created_at":{"type":"string","format":"date-time"}}},"DocumentCollection":{"type":"object","additionalProperties":false,"required":["data"],"properties":{"data":{"type":"array","maxItems":100,"items":{"$ref":"#/components/schemas/DocumentSummary"}}}},"CreateDocumentRequest":{"type":"object","additionalProperties":false,"required":["template_id","title"],"properties":{"template_id":{"$ref":"#/components/schemas/TemplateId"},"customer_id":{"$ref":"#/components/schemas/CustomerId"},"external_id":{"type":"string","minLength":1,"maxLength":190,"description":"Unique customer-system reference for generated documents in this workspace."},"title":{"type":"string","minLength":1,"maxLength":255},"language":{"type":"string","enum":["de","en","es","fr","it","mt","nl","nb","pt-BR","pt","sv","ja"],"description":"Language for recipient links, signing screens, agreement email, and completion PDFs. If omitted, a supported request language is used, then English."},"values":{"$ref":"#/components/schemas/FieldValues","description":"Values for every required template field. Defaults are used when a value is blank or omitted.","default":{}},"metadata":{"type":["object","null"],"description":"Customer-controlled JSON correlation data, up to 20 KB when serialized.","additionalProperties":true},"tags":{"$ref":"#/components/schemas/Tags"}}},"CreateDocumentResponse":{"type":"object","required":["id","external_id","title","pdf_url","credits_charged","credits_remaining","created_at"],"properties":{"id":{"$ref":"#/components/schemas/DocumentId"},"external_id":{"$ref":"#/components/schemas/ExternalId"},"title":{"type":"string"},"pdf_url":{"type":"string","format":"uri","description":"Absolute, Bearer-authenticated URL for downloading the generated PDF. The download also requires an idempotency key.","examples":["https://api.signthat.app/v1/documents/doc_F3d8sJ5nC2yL/pdf"]},"credits_charged":{"$ref":"#/components/schemas/CreditAmount"},"credits_remaining":{"$ref":"#/components/schemas/CreditAmount"},"created_at":{"type":"string","format":"date-time"}}},"Document":{"allOf":[{"$ref":"#/components/schemas/DocumentSummary"},{"type":"object","required":["format","font_family","source_content","rendered_content","fields","values","metadata","tags","customer_name","customer_email","created_by_name"],"properties":{"format":{"type":"string","enum":["markdown","html"]},"font_family":{"type":"string"},"source_content":{"type":"string","description":"Immutable template source captured when the document was created."},"rendered_content":{"type":"string","description":"Source content with known placeholder values substituted."},"fields":{"type":"array","items":{"$ref":"#/components/schemas/TemplateField"}},"values":{"$ref":"#/components/schemas/FieldValues"},"metadata":{"$ref":"#/components/schemas/Metadata"},"tags":{"$ref":"#/components/schemas/Tags"},"customer_name":{"type":["string","null"]},"customer_email":{"type":["string","null"],"format":"email"},"created_by_name":{"type":["string","null"]}}}]},"RecipientInput":{"type":"object","additionalProperties":false,"required":["name","email"],"properties":{"name":{"type":"string","minLength":1,"maxLength":255},"email":{"type":"string","format":"email","maxLength":190},"language":{"type":"string","enum":["de","en","es","fr","it","mt","nl","nb","pt-BR","pt","sv","ja"],"description":"Fallback language for this recipient. If the email belongs to a SignThat account, that account’s language takes precedence."}}},"CreatedRecipient":{"type":"object","additionalProperties":false,"required":["id","name","email","language","status","signing_url"],"properties":{"id":{"$ref":"#/components/schemas/RecipientId"},"name":{"type":"string"},"email":{"type":"string","format":"email"},"language":{"type":"string","enum":["de","en","es","fr","it","mt","nl","nb","pt-BR","pt","sv","ja"],"description":"Configured fallback language. A matching SignThat account may use its own language instead."},"status":{"type":"string","const":"sent","description":"Signing is outstanding. This status does not mean that SignThat already emailed the recipient."},"signing_url":{"type":"string","format":"uri","description":"Secure signing link returned only during agreement creation so the caller may deliver it through its own channel."}}},"RecipientStatus":{"type":"object","required":["id","name","email","status","email_sent_at","viewed_at","submitted_at","completed_at","reviewed_at","review_feedback","signature_name","photo_captured","photo_taken_at","photo_recorded_at","photo_consented_at","photo_width","photo_height","photo_mime","photo_sha256","language"],"properties":{"id":{"$ref":"#/components/schemas/RecipientId"},"name":{"type":"string"},"email":{"type":["string","null"],"format":"email"},"language":{"type":"string","enum":["de","en","es","fr","it","mt","nl","nb","pt-BR","pt","sv","ja"],"description":"Configured fallback language. A matching SignThat account may use its own language instead."},"status":{"type":"string","enum":["sent","pending_review","completed"]},"email_sent_at":{"type":["string","null"],"format":"date-time"},"viewed_at":{"type":["string","null"],"format":"date-time"},"submitted_at":{"type":["string","null"],"format":"date-time"},"completed_at":{"type":["string","null"],"format":"date-time"},"reviewed_at":{"type":["string","null"],"format":"date-time"},"review_feedback":{"type":["string","null"]},"signature_name":{"type":["string","null"]},"photo_captured":{"type":"boolean"},"photo_taken_at":{"type":["string","null"],"format":"date-time","description":"Device-reported photo time."},"photo_recorded_at":{"type":["string","null"],"format":"date-time","description":"Server-recorded evidence time."},"photo_consented_at":{"type":["string","null"],"format":"date-time"},"photo_width":{"type":["integer","null"]},"photo_height":{"type":["integer","null"]},"photo_mime":{"type":["string","null"]},"photo_sha256":{"type":["string","null"],"pattern":"^[a-f0-9]{64}$"}}},"CreateContractRequest":{"type":"object","additionalProperties":false,"required":["title","recipients"],"oneOf":[{"required":["template_id"],"not":{"required":["source_pdf_upload_id"]}},{"required":["source_pdf_upload_id"],"not":{"required":["template_id"]}}],"properties":{"template_id":{"$ref":"#/components/schemas/TemplateId"},"source_pdf_upload_id":{"type":"string","format":"uuid","description":"Unexpired, unused upload id returned by `POST /contract-pdf-uploads`."},"external_id":{"type":"string","minLength":1,"maxLength":190,"description":"Unique customer-system reference for agreements in this workspace."},"title":{"type":"string","minLength":1,"maxLength":255},"language":{"type":"string","enum":["de","en","es","fr","it","mt","nl","nb","pt-BR","pt","sv","ja"],"description":"Agreement fallback language. Each recipient may override it, while an existing recipient account remains authoritative."},"values":{"$ref":"#/components/schemas/FieldValues","description":"Sender-filled template values. Ignored for ready-PDF agreements."},"recipients":{"type":"array","minItems":1,"maxItems":20,"description":"One to 20 recipients, returned in this order. Signing is not sequential. Email addresses must be unique within the agreement.","items":{"$ref":"#/components/schemas/RecipientInput"}},"metadata":{"type":["object","null"],"description":"Customer-controlled JSON correlation data, up to 20 KB when serialized.","additionalProperties":true},"tags":{"$ref":"#/components/schemas/Tags"},"reminder_days":{"type":"integer","minimum":1,"maximum":30,"description":"Days between reminders after email delivery when workspace automatic reminders are enabled. Omit to leave reminders unscheduled for this agreement."},"valid_from":{"type":"string","format":"date-time","description":"Earliest time recipients may sign."},"valid_until":{"type":"string","format":"date-time","description":"Signing deadline. Must be later than `valid_from` when both are supplied."},"expiry_reminder_days":{"type":"integer","minimum":0,"maximum":365,"description":"Days before `valid_until` to notify the workspace about expiry. Has no effect without `valid_until`."},"scheduled_send_at":{"type":"string","format":"date-time","description":"Schedule SignThat email delivery. Must be at least one minute in the future, and the API key creator must have a verified email."},"email_message":{"type":"string","maxLength":5000,"description":"Agreement-specific message used for scheduled delivery and later send requests unless a send request replaces it."},"discussion_enabled":{"type":"boolean","default":false,"description":"Enable agreement discussion. Uses the configured discussion credit cost."},"photo_verification_enabled":{"type":"boolean","default":false,"description":"Require each recipient to capture photo evidence when signing. Adds the configured flat contract photo-verification charge."}}},"CreateContractResponse":{"type":"object","required":["id","external_id","language","status","delivery_state","zero_knowledge","source_type","source_pdf","photo_verification_enabled","recipients","credits_charged","credits_remaining","created_at"],"properties":{"id":{"$ref":"#/components/schemas/ContractId"},"external_id":{"$ref":"#/components/schemas/ExternalId"},"language":{"type":"string","enum":["de","en","es","fr","it","mt","nl","nb","pt-BR","pt","sv","ja"]},"status":{"type":"string","const":"sent","description":"The agreement is awaiting at least one signature."},"delivery_state":{"type":"string","enum":["link","scheduled"],"description":"`link` means the caller must deliver returned signing links or call the send endpoint."},"zero_knowledge":{"type":"boolean","const":false},"source_type":{"type":"string","enum":["content","uploaded_pdf"]},"source_pdf":{"anyOf":[{"$ref":"#/components/schemas/ContractPdfSource"},{"type":"null"}]},"photo_verification_enabled":{"type":"boolean"},"recipients":{"type":"array","items":{"$ref":"#/components/schemas/CreatedRecipient"}},"credits_charged":{"$ref":"#/components/schemas/CreditAmount"},"credits_remaining":{"$ref":"#/components/schemas/CreditAmount"},"created_at":{"type":"string","format":"date-time"}}},"ContractSummary":{"type":"object","required":["id","external_id","title","language","status","delivery_state","source_type","zero_knowledge","photo_verification_enabled","created_via","created_at","completed_at"],"properties":{"id":{"$ref":"#/components/schemas/ContractId"},"external_id":{"$ref":"#/components/schemas/ExternalId"},"title":{"type":"string"},"language":{"type":"string","enum":["de","en","es","fr","it","mt","nl","nb","pt-BR","pt","sv","ja"]},"status":{"type":"string","enum":["sent","completed"],"description":"Whether any recipient still needs to complete signing."},"delivery_state":{"type":"string","enum":["link","scheduled","sent"],"description":"How signing links are being delivered; independent from signing `status`."},"source_type":{"type":"string","enum":["content","uploaded_pdf"]},"zero_knowledge":{"type":"boolean"},"photo_verification_enabled":{"type":"boolean"},"created_via":{"type":"string","enum":["web","api"]},"created_at":{"type":"string","format":"date-time"},"completed_at":{"type":["string","null"],"format":"date-time"}}},"ContractCollection":{"type":"object","additionalProperties":false,"required":["data"],"properties":{"data":{"type":"array","maxItems":100,"items":{"$ref":"#/components/schemas/ContractSummary"}}}},"TemplateReference":{"type":"object","additionalProperties":false,"required":["id","name"],"properties":{"id":{"$ref":"#/components/schemas/TemplateId"},"name":{"type":"string"}}},"Contract":{"allOf":[{"$ref":"#/components/schemas/ContractSummary"},{"type":"object","required":["metadata","template","source_pdf","recipients","valid_from","valid_until","sender_review_required","photo_verification_enabled"],"properties":{"metadata":{"$ref":"#/components/schemas/Metadata"},"template":{"anyOf":[{"$ref":"#/components/schemas/TemplateReference"},{"type":"null"}]},"source_pdf":{"anyOf":[{"$ref":"#/components/schemas/ContractPdfSource"},{"type":"null"}]},"recipients":{"type":"array","minItems":1,"items":{"$ref":"#/components/schemas/RecipientStatus"}},"valid_from":{"type":["string","null"],"format":"date-time"},"valid_until":{"type":["string","null"],"format":"date-time"},"sender_review_required":{"type":"boolean"},"photo_verification_enabled":{"type":"boolean"}}}]},"ContractPdfSource":{"type":"object","required":["file_name","byte_size","sha256","page_count"],"properties":{"file_name":{"type":"string"},"byte_size":{"type":"integer","minimum":1},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"page_count":{"type":"integer","minimum":1,"maximum":500}}},"ContractPdfUpload":{"unevaluatedProperties":false,"allOf":[{"$ref":"#/components/schemas/ContractPdfSource"},{"type":"object","required":["upload_id","expires_in"],"properties":{"upload_id":{"type":"string","format":"uuid","description":"One-time upload identifier for `source_pdf_upload_id`."},"expires_in":{"type":"integer","const":86400,"description":"Seconds until an unattached upload expires."}}}]},"ContractEvent":{"type":"object","additionalProperties":false,"required":["type","detail","actor_name","created_at"],"properties":{"type":{"type":"string","description":"Internal audit event name."},"detail":{"type":["string","null"]},"actor_name":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"}}},"ContractEventCollection":{"type":"object","additionalProperties":false,"required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ContractEvent"}}}},"SendContractRequest":{"type":"object","additionalProperties":false,"properties":{"recipient_id":{"$ref":"#/components/schemas/RecipientId","description":"Send only to this recipient. Omit to send to every recipient whose signing status is still `sent`."},"message":{"type":"string","maxLength":5000,"description":"Replace the agreement-specific email message for this and later deliveries. An empty string restores the workspace default."}}},"DeliveryFailure":{"type":"object","additionalProperties":false,"required":["recipient_id","email","message"],"properties":{"recipient_id":{"$ref":"#/components/schemas/RecipientId"},"email":{"type":"string","format":"email"},"message":{"type":"string"}}},"SendContractResponse":{"type":"object","additionalProperties":false,"required":["id","sent","delivery_state","failures"],"properties":{"id":{"$ref":"#/components/schemas/ContractId"},"sent":{"type":"integer","minimum":1,"description":"Number of emails accepted for delivery."},"delivery_state":{"type":"string","enum":["sent","partially_sent"]},"failures":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryFailure"}}}},"WebhookEventType":{"type":"string","enum":["contract.created","contract.sent","contract.viewed","contract.delivery_failed","recipient.submitted_for_review","recipient.changes_requested","recipient.completed","contract.completed"]},"WebhookContract":{"type":"object","additionalProperties":false,"required":["id","external_id","title","status","delivery_state","zero_knowledge","created_via","created_at","completed_at","viewed_at"],"properties":{"id":{"$ref":"#/components/schemas/ContractId"},"external_id":{"$ref":"#/components/schemas/ExternalId"},"title":{"type":"string"},"status":{"type":"string","enum":["sent","completed"]},"delivery_state":{"type":"string","enum":["link","sent"]},"zero_knowledge":{"type":"boolean"},"created_via":{"type":"string","enum":["web","api"]},"created_at":{"type":"string","format":"date-time"},"completed_at":{"type":["string","null"],"format":"date-time"},"viewed_at":{"type":["string","null"],"format":"date-time"}}},"WebhookRecipient":{"type":"object","additionalProperties":false,"required":["id","name","email","status","email_sent_at","viewed_at","submitted_at","completed_at","reviewed_at","review_feedback"],"properties":{"id":{"$ref":"#/components/schemas/RecipientId"},"name":{"type":"string"},"email":{"type":["string","null"],"format":"email"},"status":{"type":"string","enum":["sent","pending_review","completed"]},"email_sent_at":{"type":["string","null"],"format":"date-time"},"viewed_at":{"type":["string","null"],"format":"date-time"},"submitted_at":{"type":["string","null"],"format":"date-time"},"completed_at":{"type":["string","null"],"format":"date-time"},"reviewed_at":{"type":["string","null"],"format":"date-time"},"review_feedback":{"type":["string","null"]}}},"WebhookEventData":{"type":"object","additionalProperties":false,"required":["contract"],"properties":{"contract":{"$ref":"#/components/schemas/WebhookContract"},"recipient":{"$ref":"#/components/schemas/WebhookRecipient","description":"Present for recipient-specific events; omitted for contract-level events."}}},"WebhookEvent":{"type":"object","additionalProperties":false,"required":["id","type","created_at","data"],"properties":{"id":{"$ref":"#/components/schemas/EventId"},"type":{"$ref":"#/components/schemas/WebhookEventType"},"created_at":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/WebhookEventData"}}}}}}