Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.sajn.se/llms.txt

Use this file to discover all available pages before exploring further.

Webhooks

sajn can send webhook notifications to your server when events occur in your account. This allows you to build integrations that react to document signings, contact changes, identity checks, and more.

Setup

Webhooks are configured per workspace under Settings > Developer > Webhooks. When creating a webhook you provide:
FieldRequiredDescription
URLYesThe endpoint that will receive POST requests. Must be publicly reachable (HTTPS recommended).
EventsYesWhich events to subscribe to.
SecretNoA shared secret sent in the X-Sajn-Secret header so you can verify requests.
The URL is validated on creation — sajn will resolve the hostname, block private/internal IPs (SSRF protection), and send a test POST to confirm the endpoint is reachable.

Request Format

All webhooks are sent as POST requests with a JSON body:
{
  "event": "DOCUMENT_SIGNED",
  "payload": { ... },
  "createdAt": "2026-04-16T12:00:00.000Z",
  "webhookEndpoint": "https://your-server.com/webhook"
}

Headers

HeaderDescription
Content-Typeapplication/json
X-Sajn-SecretThe secret you configured (empty string if not set). Use this to verify that the request came from sajn.

Verifying Requests

Compare the X-Sajn-Secret header value against the secret you configured when creating the webhook. Reject requests that don’t match.

Delivery

  • Webhooks are dispatched asynchronously via a background job queue.
  • Each webhook call is logged with request/response details and kept for 72 hours.
  • If delivery fails (network error or non-2xx response), an in-app notification is sent to organization members who have enabled webhook failure notifications.
  • There is no automatic retry. If delivery fails, you can inspect the call log in the dashboard and resend manually or handle it on your end.

Events

Document Events

These events fire on document-level state changes. The payload is a Document object.
EventDescription
DOCUMENT_CREATEDA new document was created.
DOCUMENT_SENTThe document was sent out to its signers.
DOCUMENT_SIGNEDAll signers have signed the document.
DOCUMENT_COMPLETEDThe document has been sealed and is fully completed.
DOCUMENT_REJECTEDThe document was rejected (by any signer).
DOCUMENT_EXPIREDThe document passed its expiration date while still pending.
DOCUMENT_WITHDRAWNThe document was withdrawn by the sender.

Party Events (per signer)

These events fire when a specific signer takes action. The payload is a Document + Party object.
EventDescription
DOCUMENT_PARTY_SENTThe signing notification was sent to a signer.
DOCUMENT_PARTY_DELIVERY_FAILEDThe signing notification failed to deliver to a signer.
DOCUMENT_PARTY_OPENEDA signer opened the signing link.
DOCUMENT_PARTY_READA signer read/scrolled through the document.
DOCUMENT_PARTY_SIGNEDA signer signed the document.
DOCUMENT_PARTY_REJECTEDA signer rejected the document.

Reminder Events

Reminder events also use the Document + Party object.
EventDescription
DOCUMENT_REMINDER_AUTOMATICAn automatic scheduled reminder was sent to a signer.
DOCUMENT_REMINDER_MANUALA manual reminder was sent to a signer by the document owner.

Identity Check Events

These events fire during the identity verification flow. The payload is an Identity Check object.
EventDescription
ID_CREATEDA new identity check was initiated.
ID_SENTThe verification link was sent (via email or SMS).
ID_OPENEDThe verification link was opened.
ID_VERIFIEDThe identity was successfully verified (e.g. BankID).
ID_FAILEDThe identity verification failed.
ID_CANCELEDThe identity check was canceled.

Contact Events

These events fire when contacts are modified. The payload is a Contact object.
EventDescription
CONTACT_CREATEDA new contact was created.
CONTACT_UPDATEDA contact’s details were updated.
CONTACT_DELETEDA contact was deleted.

Payloads

Document Payload

Used by document-level events (DOCUMENT_CREATED, DOCUMENT_SENT, DOCUMENT_SIGNED, DOCUMENT_COMPLETED, DOCUMENT_REJECTED, DOCUMENT_EXPIRED, DOCUMENT_WITHDRAWN).
{
  "id": "clx1abc...",
  "title": "Employment Agreement",
  "createdAt": "2026-04-16T10:00:00.000Z",
  "updatedAt": "2026-04-16T12:00:00.000Z",
  "organizationId": "clx2def...",
  "status": "COMPLETED",
  "signers": [
    {
      "id": "clx3ghi...",
      "name": "Anna Svensson",
      "email": "anna@example.com",
      "signingStatus": "SIGNED"
    }
  ]
}
FieldTypeDescription
idstringDocument ID.
titlestringDocument title.
createdAtstring (ISO 8601)When the document was created.
updatedAtstring (ISO 8601)When the document was last updated.
organizationIdstringThe organization that owns the document.
statusstringOne of: DRAFT, SENDING, PENDING_APPROVAL, PENDING, COMPLETED, EXPIRED, CANCELLED, REJECTED, IMPORTED.
signersarrayList of signers (see below).
Signer object:
FieldTypeDescription
idstringSigner ID.
namestringSigner’s name.
emailstringSigner’s email address.
signingStatusstringOne of: NOT_SIGNED, SIGNED, REJECTED.

Document + Party Payload

Used by party-level and reminder events. Wraps the document payload with the specific signer that triggered the event.
{
  "document": {
    "id": "clx1abc...",
    "title": "Employment Agreement",
    "createdAt": "2026-04-16T10:00:00.000Z",
    "updatedAt": "2026-04-16T12:00:00.000Z",
    "organizationId": "clx2def...",
    "status": "PENDING",
    "signers": [...]
  },
  "party": {
    "id": "clx3ghi...",
    "name": "Anna Svensson",
    "email": "anna@example.com",
    "signingStatus": "SIGNED"
  }
}
FieldTypeDescription
documentobjectThe full Document payload.
partyobjectThe signer that triggered this event (same shape as a signer object).

Identity Check Payload

Used by identity check events (ID_CREATED, ID_SENT, ID_OPENED, ID_VERIFIED, ID_FAILED, ID_CANCELED).
{
  "id": "clx4jkl...",
  "fullName": "Erik Johansson",
  "email": "erik@example.com",
  "phone": "+46701234567",
  "channel": "EMAIL",
  "reference": "ref-123",
  "status": "VERIFIED",
  "failureReason": null,
  "createdAt": "2026-04-16T10:00:00.000Z",
  "updatedAt": "2026-04-16T12:30:00.000Z",
  "organizationId": "clx2def...",
  "contactId": "clx5mno..."
}
FieldTypeDescription
idstringIdentity check ID.
fullNamestringFull name of the person being verified.
emailstring or nullEmail address.
phonestring or nullPhone number.
channelstringDelivery channel: EMAIL or SMS.
referencestring or nullYour custom reference string.
statusstringOne of: CREATED, SENT, OPENED, VERIFIED, FAILED, EXPIRED, CANCELED.
failureReasonstring or nullReason for failure (only set when status is FAILED).
createdAtstring (ISO 8601)When the identity check was created.
updatedAtstring (ISO 8601)When the identity check was last updated.
organizationIdstringThe organization that owns the identity check.
contactIdstring or nullAssociated contact ID, if linked.

Contact Payload

Used by contact events (CONTACT_CREATED, CONTACT_UPDATED, CONTACT_DELETED).
{
  "id": "clx5mno...",
  "firstName": "Anna",
  "lastName": "Svensson",
  "email": "anna@example.com",
  "phone": "+46701234567",
  "companyName": "Acme AB",
  "companyRole": "CEO",
  "externalId": "ext-456",
  "addressLine1": "Storgatan 1",
  "addressLine2": null,
  "city": "Stockholm",
  "state": null,
  "zipCode": "111 22",
  "country": "SE",
  "createdAt": "2026-04-16T10:00:00.000Z",
  "updatedAt": "2026-04-16T12:00:00.000Z",
  "organizationId": "clx2def...",
  "company": {
    "id": "clx6pqr...",
    "name": "Acme AB",
    "orgNumber": "5561234567",
    "country": "SE"
  }
}
FieldTypeDescription
idstringContact ID.
firstNamestringFirst name.
lastNamestringLast name.
emailstring or nullEmail address.
phonestring or nullPhone number.
companyNamestring or nullCompany name (free text on the contact).
companyRolestring or nullRole at the company.
externalIdstring or nullYour external ID for this contact.
addressLine1string or nullAddress line 1.
addressLine2string or nullAddress line 2.
citystring or nullCity.
statestring or nullState/region.
zipCodestring or nullZip/postal code.
countrystring or nullCountry code.
createdAtstring (ISO 8601)When the contact was created.
updatedAtstring (ISO 8601)When the contact was last updated.
organizationIdstringThe organization that owns the contact.
companyobject or nullAssociated company (see below).
Company object:
FieldTypeDescription
idstringCompany ID.
namestring or nullCompany name.
orgNumberstring or nullOrganization number.
countrystring or nullCountry code.

Next Steps

Managing Webhooks via API

Create, list, update, and delete webhooks programmatically

Event Reference

Learn about all document events