Skip to main content
All CollectionsIntegrationsAPI
API recipes: Create and send a document from a template
API recipes: Create and send a document from a template
Updated over 3 months ago

Availability: Enterprise*

* Additional volume charge will be applied for document generation via production API.

These instructions assume:

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.”

mceclip0.png

Create the document

Using your authentication token or API key, and the content-type application/json, add the following:

The response will contain the document ID as the element “id.”

mceclip1.png

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):

You can also include these optional parameters in your POST to set a subject line and body text:

mceclip3.png


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.”

To use the session view flow you need the document in Sent status. Currently, the best way to achieve that without actually sending the document is using the document sent call with silent=true parameter.

Note:

When sending documents via API, the sender is the person who generated the API key, even if the document was created on another member’s behalf. You can set up a different document sender by adding an email address or membership_id to the "Send document" body request.

Did this answer your question?