Navigate to https://console.docuseal.co/webhooks to set up the webhooks. Configure the endpoint URL of your backend API where you'll handle the received webhook data. Ensure this endpoint is secured with a token to authenticate incoming requests. Here's an example of how you might structure this:
https://your-backend-api.com/webhook/docuseal/YOUR_TOKEN_HERE
Once the document is signed by one of the parties the "form.completed" event is triggered. DocuSeal will send a webhook payload containing a "documents" list which includes URLs with downloadable signed documents.
Webhook payload includes the "external_id"
value which works as a identifier for that specific signer. External ID can be specified via REST API or Embedded Form. This association allows you to maintain a clear mapping between signed documents and the individual signers in your database.
{
"event_type": "submission.created",
"timestamp": "2024-05-26T17:32:33.518Z",
"data": {
"id": 1,
"archived_at": null,
"created_at": "2024-05-26T17:32:33.447Z",
"updated_at": "2024-05-26T17:32:33.447Z",
"source": "invite",
"submitters_order": "random",
"audit_log_url": null,
"submitters": [
{
"id": 1,
"submission_id": 1,
"uuid": "6b92a2d0-b511-4678-bccf-1e8a131f5030",
"email": "mike@example.com",
"slug": "S6fWFYRZus6suW",
"sent_at": null,
"opened_at": null,
"completed_at": null,
"created_at": "2024-05-26T17:32:33.466Z",
"updated_at": "2024-05-26T17:32:33.466Z",
"name": null,
"phone": null,
"external_id": null,
"metadata": {},
"status": "awaiting",
"application_key": null,
"values": [],
"documents": [],
"preferences": {},
"role": "First Party"
}
],
"template": {
"id": 1,
"name": "Sample Document",
"created_at": "2024-05-26T16:57:28.092Z",
"updated_at": "2024-05-26T16:58:07.314Z",
"external_id": null,
"folder_name": "Default"
},
"created_by_user": {
"id": 1,
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com"
},
"submission_events": [],
"documents": [],
"status": "pending",
"completed_at": null
}
}
Documents can be downloaded from DocuSeal using the following API request:
GET https://api.docuseal.co/submitters?external_id=value
This API responds with the documents[]
array that contains downloadable PDF URLs.
Submitters (aka Signers) can be filtered with the specified external_id
to make it easier to map documents to records in your database.
Learn more:
import axios from "axios";
const API_KEY = 'YOUR_API_KEY';
axios.request({
method: 'GET',
url: 'https://api.docuseal.co/submitters?external_id=customer_123',
headers: {
'X-Auth-Token': API_KEY,
'content-type': 'application/json'
}
}).then((response) => {
console.log(response.data)
});