Skip to content

Integration patterns

Download Signed Documents

Download the signed PDF when its deliverable.generated webhook arrives, verify the request, and save the file to your own storage by deliverable ID.

After all recipients have signed, SignatureAPI generates a deliverable: the signed documents, by default with an audit log. This guide shows how to detect when a deliverable is ready, download the signed PDF, and save it to your own storage.

Overview

The flow has three parts:

  1. SignatureAPI sends a deliverable.generated webhook event when the signed document is ready. The event includes a download URL.
  2. Your server verifies the request, then downloads the PDF from the URL in the event.
  3. Your server saves the file to your storage and responds with 200 OK.
Saving the signed documents when they are ready
SignatureAPI
Your webhook endpoint
Your storage
  1. SignatureAPI to Your webhook endpoint: Webhook deliverable.generated
  2. Your webhook endpoint: Verify the signature
  3. Your webhook endpoint to SignatureAPI: Download GET data.url
  4. SignatureAPI to Your webhook endpoint: The signed PDF
  5. Your webhook endpoint to Your storage: Save as <deliverable id>.pdf
  6. Your webhook endpoint to SignatureAPI: Respond 200 OK
  1. Webhook deliverable.generated

    The event's data.url is a download link for the signed PDF, valid for one hour.

  2. Verify the signature

    Verify the raw body against the webhook-* headers before trusting data.url.

  3. Save as <deliverable id>.pdf

    Name the file by data.object_id (the deliverable ID): one envelope can have several deliverables.

  4. Respond 200 OK

    Any status outside 2XX counts as a failed delivery, and SignatureAPI sends the event again.

Dashed: a reply, or an asynchronous call such as a webhook.

Step 1: Set Up a Webhook

Register a webhook endpoint in the Dashboard and subscribe to the deliverable.generated event. See Set Up Webhooks for detailed instructions.

Step 2: Handle the Webhook Event

When the deliverable is generated, SignatureAPI sends an event with the download URL included directly in the payload:

JSON
{
  "id": "evt_4GpGD1cNnrkemsTLAvPW9G",
  "type": "deliverable.generated",
  "timestamp": "2026-11-02T15:21:45.000Z",
  "data": {
    "object_id": "del_6FF89lKNyTNamOJCJd1tLL",
    "object_type": "deliverable",
    "envelope_id": "eb4cf433-a8af-4161-b37b-7ef57d423e56",
    "envelope_metadata": {
      "deal_id": "50055"
    },
    "deliverable_type": "standard",
    "deliverable_name": null,
    "included_documents": ["contract", "addendum"],
    "url": "https://vault.signatureapi.com/envelopes/eb4cf433-a8af-4161-b37b-7ef57d423e56/deliverables/del_6FF89lKNyTNamOJCJd1tLL/sealed.pdf?Signature=..."
  }
}

Key properties in data:

  • url: A download link for the signed PDF. It expires after one hour.
  • object_id: The deliverable ID. An envelope can have several deliverables, so use this ID, not the envelope ID, to name the file.
  • deliverable_type: The type of deliverable (standard or simple).
  • deliverable_name: The custom name, if one was set when the deliverable was created.
  • included_documents: The document keys included in this deliverable.
  • envelope_metadata: The metadata you attached when creating the envelope.

Step 3: Download and Save the PDF

Verify the request first, against the raw body and the webhook-* headers, so a forged request can’t make your server download and store a file. Then download the PDF from data.url and save it, named by deliverable ID. This example uses Express and the Standard Webhooks library:

JavaScript
import express from "express";
import { Webhook } from "standardwebhooks";

const app = express();
const wh = new Webhook(process.env.SIGNATUREAPI_WEBHOOK_SECRET);

app.post("/webhooks/signatureapi", express.raw({ type: "application/json" }), async (req, res) => {
  let event;
  try {
    // Verify the raw bytes; parse the JSON only after this succeeds
    event = wh.verify(req.body.toString("utf8"), {
      "webhook-id": req.header("webhook-id"),
      "webhook-timestamp": req.header("webhook-timestamp"),
      "webhook-signature": req.header("webhook-signature"),
    });
  } catch {
    return res.status(400).send("Invalid signature");
  }

  if (event.type === "deliverable.generated") {
    const pdfResponse = await fetch(event.data.url);
    if (!pdfResponse.ok) return res.status(500).send("Download failed"); // SignatureAPI retries the event
    const pdf = Buffer.from(await pdfResponse.arrayBuffer());

    // One file per deliverable: an envelope can have several
    await storage.save(`signed-documents/${event.data.envelope_id}/${event.data.object_id}.pdf`, pdf);
  }

  res.status(200).send("OK");
});

storage.save stands for your own storage client, such as a cloud bucket or a file system. If the same event arrives twice, the second save overwrites the file with identical content.

The download URL in the event expires after one hour. If you need to download the file later, call the Retrieve Deliverable endpoint to get a fresh link.

Alternative: Retrieve the Deliverable via API

If you prefer to fetch deliverables without relying on the webhook URL, call the deliverables endpoint with the deliverable ID from the event:

HTTP
GET /v1/deliverables/del_6FF89lKNyTNamOJCJd1tLL HTTP/1.1
Host: api.signatureapi.com
X-API-Key: YOUR_API_KEY

The response is the deliverable object, with a fresh url once its status is generated.

You can also list all deliverables for an envelope:

HTTP
GET /v1/envelopes/eb4cf433-a8af-4161-b37b-7ef57d423e56/deliverables HTTP/1.1
Host: api.signatureapi.com
X-API-Key: YOUR_API_KEY

Keep Learning