Create Document via API
curl --request POST \
--url https://api.docsautomator.co/createDocument \
--header 'Content-Type: application/json' \
--data '
{
"docId": "<string>",
"data": {},
"documentName": "<string>",
"async": true,
"webhookParams": {},
"existingPdfs": [
"<string>"
],
"docTemplateLink": "<string>"
}
'Documents
Create Document via API
Pass data directly via the API to generate documents
POST
/
createDocument
Create Document via API
curl --request POST \
--url https://api.docsautomator.co/createDocument \
--header 'Content-Type: application/json' \
--data '
{
"docId": "<string>",
"data": {},
"documentName": "<string>",
"async": true,
"webhookParams": {},
"existingPdfs": [
"<string>"
],
"docTemplateLink": "<string>"
}
'When your automation’s data source is set to API, you pass all field data directly in the request body. This is the most flexible option, as you control exactly what data goes into the document.
Additional fields are included depending on your automation’s configuration:
Endpoint
POST https://api.docsautomator.co/createDocument
Request Body
The automation ID. Find it on the automation’s settings page or via
GET /automations.Key-value pairs for template placeholders. Keys must match the placeholder names in your template (e.g.,
{{customer_name}} in your template → "customer_name" in the data object). Line items are also included inside this object as line_items_1, line_items_2, etc. — see Example with Line Items below.Custom name for the generated document. Overrides the automation’s document name setting.
When
true, returns immediately with a jobId (HTTP 202). Poll GET /job/{jobId} for the result.Custom parameters passed through to webhook notifications as
additionalParams.Array of publicly accessible PDF URLs to merge or prepend to the generated document.
Override the automation’s Google Doc template URL for this request only. Pass a full Google Docs URL or just the document ID.
Basic Example
curl -X POST https://api.docsautomator.co/createDocument \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"docId": "YOUR_AUTOMATION_ID",
"data": {
"customer_name": "Acme Corp",
"invoice_number": "INV-2025-001",
"invoice_date": "2025-01-15",
"due_date": "2025-02-15",
"total": "$5,500.00"
}
}'
Example with Line Items
Pass line items as arrays inside thedata object. Use line_items_1 for the first group, line_items_2 for a second group, and so on — there is no limit on the number of line item groups. Each object’s keys must match the line item placeholder names in your template.
curl -X POST https://api.docsautomator.co/createDocument \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"docId": "YOUR_AUTOMATION_ID",
"data": {
"customer_name": "Acme Corp",
"invoice_date": "2025-01-15",
"subtotal": "$5,500.00",
"tax": "$495.00",
"total": "$5,995.00",
"line_items_1": [
{ "description": "Consulting", "quantity": 10, "rate": "$150", "amount": "$1,500" },
{ "description": "Development", "quantity": 20, "rate": "$200", "amount": "$4,000" }
]
}
}'
Nested Line Items
Use thechildren key for nesting (up to 2 levels):
{
"docId": "YOUR_AUTOMATION_ID",
"data": {
"project_name": "Website Redesign",
"line_items_1": [
{
"phase": "Design",
"children": [
{
"task": "Wireframes",
"hours": 8,
"children": [
{ "detail": "Homepage wireframe", "status": "Complete" }
]
}
]
}
]
}
}
Learn more about setting up line items in your template in the Line Items guide.
Async Mode
For high-volume or latency-sensitive workflows, use async mode. The API returns ajobId immediately, and you poll for the result.
# 1. Start async document creation
curl -X POST https://api.docsautomator.co/createDocument \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"docId": "YOUR_AUTOMATION_ID",
"async": true,
"data": {
"customer_name": "Acme Corp",
"total": "$5,500.00"
}
}'
# Returns: { "message": "Document creation request queued.", "jobId": "job_abc123", "logId": "..." }
# 2. Poll for the result
curl https://api.docsautomator.co/job/job_abc123 \
-H "Authorization: Bearer YOUR_API_KEY"
# Returns: { "status": "completed", "result": { "pdfUrl": "https://...", ... } }
Response
Sync mode (200)
{
"message": "success",
"pdfUrl": "https://files.docsautomator.co/..."
}
| Field | Included when |
|---|---|
googleDocUrl | Save Google Doc is enabled |
savePdfGoogleDriveFolderId | Save PDF to Google Drive is enabled |
savePdfGoogleDriveFileId | Save PDF to Google Drive is enabled |
savePdfGoogleDriveUrl | Save PDF to Google Drive is enabled |
wordFileUrl | Save Word document is enabled (Word templates; download URL for the generated .docx) |
saveWordGoogleDriveFolderId | Save Word document to Google Drive is enabled |
saveWordGoogleDriveFileId | Save Word document to Google Drive is enabled |
signingSessionId | E-signature is enabled |
signingStatus | E-signature is enabled ("created" or "queued") |
signingLinks | E-signature is enabled (array of signer objects with signerIndex, email, name, signingUrl, status) |
signingDeliveryMethod | E-signature is enabled |
Async mode (202)
{
"message": "Document creation request queued.",
"jobId": "job_abc123",
"logId": "log_xyz789"
}
Last modified on June 4, 2026
⌘I