Skip to main content
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": {},
  "skipEsign": true,
  "actingUserEmail": "<string>",
  "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.

Endpoint

POST https://api.docsautomator.co/createDocument

Request Body

docId
string
required
The automation ID. Find it on the automation’s settings page or via GET /automations.
data
object
required
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.
documentName
string
Custom name for the generated document. Overrides the automation’s document name setting.
async
boolean
default:"false"
When true, returns immediately with a jobId (HTTP 202). Poll GET /job/{jobId} for the result.
webhookParams
object
Custom parameters passed through to webhook notifications under both webhookParams and additionalParams (identical content; the latter is kept for backward compatibility).
skipEsign
boolean
default:"false"
When true, skips e-signing for this request even if the automation has e-signing enabled. The document is generated and delivered normally (Drive save, email, webhook), but no signing session is started and no signing invitations are sent. Useful for two-step approval flows: generate a draft for review first, then re-run without skipEsign to send the document for signing. Also accepted as a query parameter (?skipEsign=true) on GET requests.
actingUserEmail
string
Email address of the team member generating this document. When the automation’s email delivery (or e-signature email settings) has Send from the team member who generates the document enabled, the email is sent from this member’s own connected Gmail or Outlook account instead of the configured sender. The address must match a mailbox connected to the workspace; otherwise DocsAutomator falls back to the automation’s configured sender. Also accepted as a query parameter (?actingUserEmail=...) on GET requests or as an X-Acting-User-Email request header (the header takes precedence). The in-app Generate button passes this automatically.
existingPdfs
string[]
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 the data 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 the children 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.

Images

Any placeholder whose name contains image is filled with a picture. Pass a publicly accessible URL as the value (a single URL, or an array for a multi-image placeholder):
{
  "docId": "YOUR_AUTOMATION_ID",
  "data": {
    "image_logo": "https://example.com/logo.png",
    "image_gallery": [
      "https://example.com/a.jpg",
      "https://example.com/b.jpg"
    ]
  }
}
To make an image a clickable link, pass it as a { "url", "link" } object instead of a plain URL string. No automation setup is required, and the link survives PDF export (Google Doc and Word templates). Arrays work too, with a link per image:
{
  "docId": "YOUR_AUTOMATION_ID",
  "data": {
    "image_product": {
      "url": "https://example.com/product.jpg",
      "link": "https://shop.example.com/products/123"
    }
  }
}
See Dynamic Images for supported formats, resizing, choosing which image to insert, and clickable links.

Async Mode

For high-volume or latency-sensitive workflows, use async mode. The API returns a jobId 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/..."
}
Additional fields are included depending on your automation’s configuration:
FieldIncluded when
googleDocUrlSave Google Doc is enabled
savePdfGoogleDriveFolderIdSave PDF to Google Drive is enabled
savePdfGoogleDriveFileIdSave PDF to Google Drive is enabled
savePdfGoogleDriveUrlSave PDF to Google Drive is enabled
wordFileUrlSave Word document is enabled (Word templates; download URL for the generated .docx)
saveWordGoogleDriveFolderIdSave Word document to Google Drive is enabled
saveWordGoogleDriveFileIdSave Word document to Google Drive is enabled
signingSessionIdE-signature is enabled
signingStatusE-signature is enabled ("created" or "queued")
signingLinksE-signature is enabled (array of signer objects with signerIndex, email, name, signingUrl, status)
signingDeliveryMethodE-signature is enabled
esignSkippedE-signature is enabled but skipped for this request via skipEsign: true

Async mode (202)

{
  "message": "Document creation request queued.",
  "jobId": "job_abc123",
  "logId": "log_xyz789"
}
Last modified on June 12, 2026