Create and download document in realtime
This recipe assumes:
- You have authenticated via OAuth (see Authentication process) or have an API key (see API key authentication process)
- You have created a template (see Save time with templates)
Locate your template ID
In the PandaDoc app navigate to the template you would like to use for this particular document. When you are viewing the template the ID is the final part of the URL. For example, in
https://app.pandadoc.com/a/#/templates/ustHNnVaPCD6MzuoNBbZ8L the template ID is “ustHNnVaPCD6MzuoNBbZ8L”
Structure your Document details
Use the create document endpoint description to decide what metadata and details you need to pass to your document. The simplest possible document schema consists of a name, template ID, and at least one recipient. Include your template ID under “template_uuid”
{
"name": "My minimal document",
"template_uuid": "ustHNnVaPCD6MzuoNBbZ8L",
"recipients": [
{
"email":"[email protected]"
}
]
}
Create the Document
Using your authentication token or API key, and the content-type application/json
POST https://api.pandadoc.com/public/v1/documents
The response will contain the document ID as the element “id”
{
"id":"XHjv8z3SfDuTseFSnhprML",
"name":"My minimal document",
"Status":"document.uploaded",
"date_created":"2021-07-05T15:05:27.787341Z",
"date_modified":"2021-07-05T15:05:27.787341Z",
"Expiration_date":null,
"Version":null,
"uuid":"XHjv8z3SfDuTseFSnhprML"
}
Wait for the Document to enter a draft status
See Listening for changes in document status. If you are actively polling your document ID is “id” from the previous step.
Download Document
Using the document ID you can leverage the document download endpoint to retrieve your document.
GET https://api.pandadoc.com/public/v1/documents/{id}/download
.
Updated over 1 year ago