API recipes: Create and send a document from a template
Availability: Enterprise*
* Additional volume charge will be applied for document generation via production API.
These instructions assume:
- 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’d like to use for this particular document. When you’re viewing the template, the template ID is the section of the URL after the final slash (/). 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 at https://developers.pandadoc.com/reference/new-document to decide what metadata and details you’ll 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.”
Create the document
Using your authentication token or API key, and the content-type application/json, add the following:
POST https://api.pandadoc.com/public/v1/documents
The response will contain the document ID as the element “id.”
There is also an option to create a document on another member's behalf.
Wait for the document to enter draft status
See Listening for changes in document status. If you’re actively polling your document, the ID is “id” from the previous step.
Send the document
Once you’ve determined that the document has entered “document.draft” status, you can send it by adding the following ({id} is the document ID from above):
POST https://api.pandadoc.com/public/v1/documents/{id}/send
You can also include these optional parameters in your POST to set a subject line and body text:
Don’t set the “silent” parameter to “true” unless you don’t want an email to go out with the document link. For more information about why you might want to send silently, see “Create a document and share it in real time.”