Skip to main content

Overview

Webhooks allow your application to receive real-time notifications about events that occur within our system, such as when a document is signed or a package is fully executed. This guide will walk you through the process of subscribing to webhooks to automatically download signed documents.

Steps

1

Setup a webhook endpoint

2

Handle incoming webhook event notifications

When a webhook event occurs, our system will send a POST request to your specified endpoint with details about the event.
When a package is fully executed, all documents signed by all signers, you will receive a webhook event with the following payload:
Payload
{
    "action": "package_executed",
    "packageId": "24428e41-8b96-40cc-96e6-b74c7c539fcb",
    "externalData": null,
    "eventId": "0ea12600-85bc-46dd-af85-f82f621c1abc",
    "eventOwnerOrganizationId": "24261ee6-5f66-4692-ba49-533c9b58999b",
    "eventOwnerMemberId": "3e09a4ce-577c-492c-ba7c-c1ebf825f9b5",
    "eventTime": "2022-02-23T20:20:15.9714327Z"
}
Depending on your application’s needs, you can handle these events accordingly. For example, when you receive a package_executed event, you can trigger the download of all executed documents in that package.
You can set externalData at the package level when creating a package to help correlate webhook events with your internal records.You can also set an externalId at the document level when uploading files to add to a package.See the External data guide for more information.
3

Verify webhook requests

To ensure that incoming webhook requests are legitimate, you should verify the signature included in the X-Syngrafii-Signature header of each request.View the Webhooks verification guide for detailed instructions on how to verify webhook signatures.
4

Get package status

Once you receive a webhook event you want to act on, such as the package_executed webhook event, call the Packages status API endpoint to get the list of documents in the package.
Request
GET /packages/{packageId}/status
Response
{
    "packageId": "24428e41-8b96-40cc-96e6-b74c7c539fcb",
    ...
    "state": "executed",
    "documents": [
        {
            "documentId": "73f34799-c3a2-49e3-aa5f-33b0c2c1f111",
            ...
        }
    ],
    ...
}
5

Download executed documents

After confirming that the package is fully executed, you can use the Packages download API endpoint to download all executed documents in the package.
Use the package status response to determine all the document IDs to download.

Download PDFs

Request
GET /packages/{packageId}/documents/{documentId}/pdf/executed/download