How to Create a Document from a Template
Create a document from a PandaDoc template via API, with optional customization of fields, images, pricing, and content.
Problem
You need to create a new document from a PandaDoc template via the API. Templates let you standardize document structure, branding, and content while dynamically filling in recipient details, field values, pricing, and images at creation time.
Prerequisites
- A PandaDoc API key or OAuth token
- A PandaDoc template created in the web app (help center guide)
- The template's UUID (found in the browser address bar:
https://app.pandadoc.com/a/#/templates/{ID}/content)
You can use the sample PandaDoc template to test your first request.
Solution
Step 1: Build the request body
At minimum, provide the template UUID and recipients:
{
"name": "Contract for Acme Corp",
"template_uuid": "ustHNnVaPCD6MzuoNBbZ8L",
"recipients": [
{
"email": "[email protected]",
"first_name": "Jane",
"last_name": "Roe",
"role": "Signer"
}
]
}See the Create Document API reference for all available parameters.
Step 2: Send the create request
POST /public/v1/documents
The response returns the document ID with status document.uploaded:
{
"id": "XHjv8z3SfDuTseFSnhprML",
"name": "Contract for Acme Corp",
"status": "document.uploaded",
"date_created": "2021-07-05T15:05:27.787341Z",
"date_modified": "2021-07-05T15:05:27.787341Z",
"uuid": "XHjv8z3SfDuTseFSnhprML"
}Step 3: Wait for draft status
Document creation is asynchronous. The document is not ready until it reaches document.draft status. See Building a Reliable Document Creation Workflow for polling and webhook strategies.
Attempting to use a newly created document before it reachesdocument.draftstatus will result in a "404 document not found" response.
Customization options
You can customize many aspects of the document at creation time. Each area has a dedicated guide:
| What | Guide |
|---|---|
| Pre-fill field values (text, date, checkbox, dropdown) | How to Pre-Fill Document Fields |
| Add images to image blocks | How to Add an Image to a Document via API |
| Populate pricing tables with rows, taxes, and fees | How to Work with Pricing Tables |
| Populate text blocks with markdown content | How to Populate and Update Text Blocks |
| Replace content placeholders with content library items | How to Use Content Placeholders |
| Set or override recipient signing order | How to Set a Signing Order |
| Create a document on a colleague's behalf | Create on Member's Behalf |
| Use variables in the document name | How to Use Variables in Document Titles |
Verification
- Check the document status — confirm it reaches
document.draft. - Open the document in the PandaDoc web app to verify recipients, fields, and content rendered correctly.
- Use the Document Details endpoint to inspect the created document programmatically.
Related
- Create Document API reference — full endpoint parameters
- Building a Reliable Document Creation Workflow — async patterns and error handling
- Create a Document from File Upload — alternative creation method using uploaded files
- Create a Document from Public PDF — create from a publicly available URL
Updated 8 days ago
