API reference

Webhooks API

Rather than polling, subscribe a URL and hear about signatures, views and access requests as they happen. Every delivery is signed with HMAC-SHA256, retried on failure and kept in a log you can read back. This is the shape Zapier, Make and n8n expect.

Base URL https://xdocs.io/api/v1, with Authorization: Bearer xdk_… on every request. Pagination, rate limits, scopes and error codes are the same for every endpoint and are described once, in how the API behaves.

Webhooks

Subscriptions an integration creates and removes on its own, one per thing it wants to hear about. This is the shape Zapier, Make and n8n expect, and a subscription is the same endpoint row the developer settings page shows with its delivery log — so these calls see and change the workspace's endpoints wherever they were made.

GET/api/v1/hooksdocuments:read

Every webhook endpoint in the workspace, newest first — including those added on the settings page — and the catalogue of events.

Returns

{ data: Hook[], events: [{ name, description }] } — events includes ping, the test event

POST/api/v1/hooksdocuments:write

Subscribe a URL. Re-subscribing the same URL to the same events returns the existing row rather than a duplicate, because platforms retry.

Body (JSON)

urlstringrequired
Must be https.
eventsstring[]
Event names, up to 50. Empty, with no event either, means every event.
eventstring
A single event, for platforms that subscribe one at a time. Merged with events.

Returns

201 { data: Hook & { secret } } — the signing secret. An identical re-subscribe answers 200 with the existing row and its secret, and switches it back on if it had been switched off.

  • 422 Unknown event names; `details.known` lists the valid ones.
GET/api/v1/hooks/:iddocuments:read

One subscription, with its recent health.

Returns

{ data: Hook } — id, url, events, active, failureCount, lastStatus, lastAttemptAt, createdAt. failureCount is consecutive failed deliveries; at 10 the endpoint is switched off.

PATCH/api/v1/hooks/:iddocuments:write

Change the URL or events, or switch it on and off. Switching it on resets the failure count.

Body (JSON)

urlstring
Must be https.
eventsstring[]
Replaces the list. Empty means every event.
activeboolean

Returns

{ data: Hook }

  • 422 Unknown event names; `details.known` lists the valid ones.
DELETE/api/v1/hooks/:iddocuments:write

Unsubscribe. Idempotent: a second call is a 204 too.

Returns

204

POST/api/v1/hooks/:id/pingdocuments:write

Send a ping delivery now, whatever the endpoint subscribes to and even if it is switched off, and report how it answered.

Returns

{ data: Delivery & { payload } } — status, responseStatus, attempts, error

  • 422 The test delivery could not be recorded.
POST/api/v1/hooks/:id/rotatedocuments:write

Replace the signing secret. The new one is returned once.

Returns

{ data: Hook & { secret } }

GET/api/v1/hooks/:id/deliveriesdocuments:read

Every delivery attempt, newest first — which is how a webhook that “does not work” turns out to be one specific 401.

Query parameters

eventstring
statusstring
pending, delivered or failed. Anything else is a 400.
includestring
payload adds the body that was sent.
limitinteger
Rows per page, up to 100. Defaults to 50.
cursorstring
The previous page's nextCursor. Opaque — pass it back unchanged.

Returns

{ data: Delivery[], nextCursor } — id, endpointId, event, status, attempts, responseStatus, error, deliveredAt, createdAt, payload?

GET/api/v1/hooks/samplesdocuments:read

Recent real payloads for one event, for a platform's “load sample” step. A synthetic one of the same shape when nothing has happened yet.

Query parameters

eventstring
The event name.

Returns

{ data: object[] } — up to three delivered bodies, each { id, event, createdAt, data }

  • 422 Unknown event name; `details.known` lists the valid ones.

Events

What a subscription can listen for. Signing and verifying deliveries is covered on the overview.

envelope.sent
A document went out for signature.
recipient.notified
A signing email left for a recipient.
recipient.bounced
A signing email could not be delivered.
recipient.viewed
A recipient opened their signing page.
recipient.authenticated
A recipient passed the access code.
recipient.signed
A recipient completed their fields.
recipient.declined
A recipient declined to sign, with a reason.
recipient.delegated
A recipient reassigned signing to someone else.
recipient.attached
A recipient returned a file.
envelope.reminded
Reminders went to whoever is holding things up.
envelope.completed
Every signer has signed; the PDF is final.
envelope.voided
The sender cancelled the envelope.
envelope.expired
The envelope passed its expiry unsigned.
consent.accepted
A signer agreed to sign electronically.
consent.withdrawn
A signer withdrew that consent.
document.created
A new document was created.
document.edited
A document's body changed.
document.redacted
Text was permanently removed from a document.
document.trash_refused
Moving a document to the trash, or deleting it, was refused because it is under a legal hold.
document.retention_trashed
A retention rule moved a document to the trash.
legal_hold.placed
A legal hold was placed.
legal_hold.changed
A legal hold was widened to cover more.
legal_hold.released
A legal hold was released.
retention_rule.changed
A retention rule was created, changed or deleted.
link.created
A tracked link was published.
link.updated
A link's gates or settings changed.
link.enabled
A link was switched back on.
link.disabled
A link was switched off.
link.deleted
A link was removed.
link.viewed
A visitor cleared every gate and opened the link.
link.nda_accepted
A visitor accepted the link's confidentiality terms.
link.downloaded
A visitor downloaded a PDF copy.
link.bulk_downloaded
A visitor downloaded a room or folder as a zip.
link.access_requested
Somebody turned away by a link, or by a document they are not on, asked for access.
link.access_approved
An access request was approved and the person let in.
link.access_denied
An access request was denied.
ping
A test delivery sent from the settings page.
← The whole API referenceNext: Legal hold and retention API →