Download Signed Documents

1

Setup webhooks

Navigate to https://console.docuseal.com/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": "template.create",
  "timestamp": "2024-05-26T16:59:47.237Z",
  "data": {
    "id": 1,
    "slug": "UwRU9ir5dvhSRY",
    "name": "Sample Document",
    "schema": [
      {
        "attachment_uuid": "84fa7c01-8b89-47e2-83f0-8623e7e4aa1c",
        "name": "sample-document"
      }
    ],
    "fields": [
      {
        "uuid": "f86dbf07-2d84-490c-b372-1aaaaf0549c1",
        "submitter_uuid": "6b92a2d0-b511-4678-bccf-1e8a131f5030",
        "name": "First Name",
        "type": "text",
        "required": true,
        "preferences": {},
        "areas": [
          {
            "x": 0.2541666666666667,
            "y": 0.2266854052667579,
            "w": 0.3132975260416667,
            "h": 0.04878270348837208,
            "attachment_uuid": "84fa7c01-8b89-47e2-83f0-8623e7e4aa1c",
            "page": 0
          }
        ]
      },
      {
        "uuid": "1b41711b-f765-41c5-b2b9-000b88b96c6e",
        "submitter_uuid": "6b92a2d0-b511-4678-bccf-1e8a131f5030",
        "name": "Last Name",
        "type": "text",
        "required": true,
        "preferences": {},
        "areas": [
          {
            "x": 0.5419813368055556,
            "y": 0.3057829599863201,
            "w": 0.2188802083333333,
            "h": 0.05516843365253077,
            "attachment_uuid": "84fa7c01-8b89-47e2-83f0-8623e7e4aa1c",
            "page": 0
          }
        ]
      }
    ],
    "submitters": [
      {
        "name": "First Party",
        "uuid": "6b92a2d0-b511-4678-bccf-1e8a131f5030"
      }
    ],
    "author_id": 1,
    "account_id": 1,
    "archived_at": null,
    "created_at": "2024-05-26T16:57:28.092Z",
    "updated_at": "2024-05-26T16:57:28.092Z",
    "source": "native",
    "folder_id": 1,
    "external_id": null,
    "preferences": {},
    "application_key": null,
    "folder_name": "Default",
    "author": {
      "id": 1,
      "first_name": "John",
      "last_name": "Doe",
      "email": "john.doe@example.com"
    },
    "documents": [
      {
        "id": 12,
        "uuid": "84fa7c01-8b89-47e2-83f0-8623e7e4aa1c",
        "url": "https://docuseal.com/file/hash/sample-document.pdf",
        "preview_image_url": "https://docuseal.com/file/hash/0.jpg",
        "filename": "sample-document.pdf"
      }
    ]
  }
}
2

Download documents via API

Documents can be downloaded from DocuSeal using the following API request:
GET https://api.docuseal.com/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.com/submitters?external_id=customer_123',
  headers: {
    'X-Auth-Token': API_KEY,
    'content-type': 'application/json'
  }
}).then((response) => {
  console.log(response.data)
});