Skip to content

Document Webhooks

As a document changes status during its life cycle there is often a need to track this progress in an external system. One way to accomplish that is to subscribe to document webhooks.

Webhook eventTrigger
document.createdA new document was created
document.sentDocument status was changed to sent
document.viewedFirst time any client views the document
document.answeredA client answered a document
document.acceptedDocument status was changed to accepted
document.acceptedPdfThe auto generated PDF after accept is ready to be downloaded from url
document.deniedDocument status was changed to denied
document.expiredDocument status was changed to expired
document.voidedDocument status was changed to voided
document.smsDroppedFailed to deliver SMS
document.mailDroppedFailed to deliver email
companyExpense.createdA new companyExpense was created (only for some accounts)

Example

When a webhook is triggered we send a POST request on the format:

js
const request = {
  method: 'POST',
  url: 'https://example.com', // You decide which URL to call
  body: {
    type, // Webhook type such as 'document.created'
    typeId, // Document.id
    source, // webhookSubscription
    sourceId, // webhookSubscription.id
    companyId,
    createdAt, // When the webhook was triggered
    data // JSON data of the document
  }
}

You should respond with a successful HTTP response status such as 200, we will retry up to five times with exponential back off if we were not able to receive a valid HTTP response status.