---
title: "Create a document"
method: POST
path: "/createDocument"
tags: ["Documents"]
---

# Create a document

`POST /createDocument`

Triggers document generation from an automation template (Google Doc or PDF). Supports sync mode (waits for result) and async mode (returns a job ID for polling). The response includes PDF and optional Google Doc URLs.

When the automation has e-signatures enabled and the template contains e-sign placeholders, a signing session is automatically created and included in the response.

## Request body

- object
  - `docId` string, required — The automation ID to execute. Also accepted as `automationId`.
  - `data` object — Key-value pairs for template placeholders. Keys must match placeholder names in your template (Google Doc syntax or PDF placeholder names). Line items are also included inside this object as `line_items_1`, `line_items_2`, etc. — each is an array of objects whose keys match line item placeholder names. Use the `children` key within line item objects for nested line items (up to 2 levels).
  - `documentName` string — Custom name for the generated document. Overrides the automation's document name setting.
  - `async` boolean — When `true`, returns immediately with a `jobId` (HTTP 202). Poll `GET /job/{jobId}` for the result. When `false` (default), the request blocks until the document is ready (up to 5 minutes).
  - `webhookParams` object — Custom parameters passed through to webhook notifications and stored on signing sessions. Returned in webhook payloads as `webhookParams` (an identical `additionalParams` key also exists, kept only for legacy integrations). The trigger record identifier (`recId`, Notion `pageId`, ClickUp `taskId`, Google Sheets `rowNumber`) is folded in automatically — your own keys are never overwritten.
  - `existingPdfs` string[] — PDF URLs to merge or prepend to the generated document.
  - `docTemplateLink` string, uri — Override the automation's Google Doc template URL for this request only.

## Response `200`

Document created successfully (sync mode)

- DocumentCreationResponse
  - `message` string
  - `pdfUrl` string, uri — URL of the generated PDF.
  - `documentName` string — Name of the generated document.
  - `googleDocUrl` string, uri — URL of the saved Google Doc (if `saveGoogleDoc` is enabled).
  - `savePdfGoogleDriveUrl` string, uri — Google Drive URL of the saved PDF (if Drive saving is configured).
  - `savePdfGoogleDriveFileId` string — Google Drive file ID of the saved PDF.
  - `signingSessionId` string — E-signature session ID (if e-signing is enabled on the automation).
  - `signingStatus` 'created' | 'queued' — Status of the signing session creation.
  - `signingLinks` object[] — Signing links for each signer (if delivery method is `link`).
    - `signerIndex` integer
    - `email` string
    - `name` string
    - `signingUrl` string, uri
    - `status` string

## Other responses

- `202` — Document creation queued (async mode)
- `400` — Invalid request parameters
- `401` — Invalid or missing API key
- `402` — Document limit exceeded
- `404` — Resource not found

---

[API](https://skmtc.dev/docsautomator/apis/docsautomator-api.md) · [All operations](https://skmtc.dev/docsautomator/apis/docsautomator-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/docsautomator/docsautomator-api/revisions/3ec829ff5817/schema)
