Skip to main content
All CollectionsIntegrationsAPI
API recipes: Download a document on completion
API recipes: Download a document on completion
M
Written by Marya Maksimchuk
Updated over a week ago

Availability: Enterprise

These instructions assume:

Configure your event listener

To create a new PandaDoc webhook, open https://app.pandadoc.com/a/#/api/configuration and use the “Create webhook” button in the Webhooks section.

mceclip0.png

Give your webhook a friendly name you’ll remember, then add your listener URL in the Webhook Endpoint URL field. We recommend checking “Document state changed” under the “Subscribe to events” section, although you may wish to take advantage of other features offered in the webhook configuration described outside the scope of these instructions. Once you’re finished, save your changes.

mceclip1.png

Capture document ID from “completed” event

When your document’s status changes, you’ll get a post back from the webhook containing a “status” item:

mceclip2.png


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

Download document

Using the ID from the webhook above, you can use the document download endpoint to retrieve your completed document:

{id} is from the webhook.

Did this answer your question?