Download a completed document

This recipe assumes:

Configure your event listener

To create a new Pandadoc webhook open and use the “Create webhook” button in the Webhooks section.


Create webhook

Give your webhook a friendly name that you will remember and add your listener URL in the Webhook Endpoint URL field. At the very least for this exercise you should check “Document state changed” under the “Subscribe to events” section, although you may wish to take advantage of other features offered in the webhook configuration that are described outside the scope of this recipe. Save your changes when you are finished.


Create webhook

Capture Document ID from “completed” event

When your document changes status you’ll get a postback from the webhook contains a “status” item

  "data": {
    "id": "tKoqk92d2jiVuxUQH8i9iB",
  "status": "document.completed",

When the status changes to “document.completed” you can proceed to download your document. It’s important to wait for the document status to change to completed rather than use the recipient_completed event because recipient_completed will occur multiple times for documents with multiple recipients.

Download Document

Using the ID from the webhook above, you can leverage the document download endpoint to retrieve your completed document.
where {id} is from the webhook.