Download Signed Documents

1

Setup webhooks

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": "form.completed",
  "timestamp": "2023-09-24T13:48:36Z",
  "data": {
    "id": 1,
    "submission_id": 12,
    "email": "john.doe@example.com",
    "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36",
    "ip": "132.216.88.83",
    "sent_at": "2023-08-20T10:09:05.459Z",
    "opened_at": "2023-08-20T10:10:00.451Z",
    "completed_at": "2023-08-20T10:12:47.579Z",
    "created_at": "2023-08-20T10:09:02.459Z",
    "updated_at": "2023-08-20T10:12:47.907Z",
    "name": null,
    "phone": null,
    "role": "First Party",
    "external_id": null,
    "application_key": null,
    "status": "completed",
    "preferences": {
      "send_email": true,
      "send_sms": false
    },
    "submission": {
      "id": 12,
      "audit_log_url": "https://docuseal.co/blobs/proxy/eyJfcmFpbHMiOnsib/audit-log.pdf",
      "status": "completed",
      "url": "https://docuseal.co/e/N5JsdkFGPeQF7J",
      "created_at": "2023-08-20T10:09:05.258Z"
    },
    "template": {
      "id": 6,
      "name": "Invoice",
      "external_id": null,
      "created_at": "2023-08-19T11:09:21.487Z",
      "updated_at": "2023-08-19T11:11:47.804Z"
    },
    "values": [
      {
        "field": "First Name",
        "value": "John"
      },
      {
        "field": "Last Name",
        "value": "Doe"
      },
      {
        "field": "Signature",
        "value": "https://docuseal.co/blobs/proxy/eyJfcmFpbHMiOnsib/signature.png"
      },
      {
        "field": "Signature",
        "value": "John Doe"
      }
    ],
    "metadata": {
      "customData": "custom value"
    },
    "audit_log_url": "https://docuseal.co/blobs/proxy/eyJfcmFpbHMiOnsib/audit-log.pdf",
    "submission_url": "https://docuseal.co/e/N5JsdkFGPeQF7J",
    "documents": [
      {
        "name": "sample-document",
        "url": "https://docuseal.co/blobs/proxy/eyJfcmFpbHMiOnsib/sample-document.pdf"
      }
    ]
  }
}
2

Download documents via API

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:

REST API Reference

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)
});