---
title: "Document Generation API & SDK for DOCX and PDF"
description: "Document generation API and SDK: fill DOCX templates with your data in 1 call, download DOCX or PDF. 6 SDKs: JS, Python, PHP, Go, Java, Ruby. Free plan."
url: "https://www.turbodocx.com/products/api-and-sdk"
---

# Document Generation API & SDK

> TurboDocx's document generation API fills the `{placeholders}` in a Word (DOCX) template with your data in 1 call, then returns the result as a DOCX or PDF. 6 published SDKs (JavaScript/TypeScript, Python, Go, PHP, Java, Ruby) wrap the same REST API, so document automation fits the stack you already run. The same API key also sends the generated document for e-signature.

Platform stats: 3,000+ documents generated, 5 free documents a month, 6 published SDKs.

## Document Generation API & SDK: Key Takeaways

- **1 call** creates a document: `Deliverable.generateDeliverable()` takes a templateId and variables, then `downloadSourceFile()` returns the DOCX and `downloadPDF()` returns the PDF.
- **4 types** of template variable: plain text, HTML, Markdown, and images.
- **6 published** SDKs (JavaScript/TypeScript, Python, Go, PHP, Java, Ruby) are built on the same REST API.
- **$0** Free plan includes 5 documents and 5 signatures a month; paid plans start at $10/user/mo.
- **1,000,000+** downloads a month ([npm](https://www.npmjs.com/package/@turbodocx/html-to-docx)) for the related open-source @turbodocx/html-to-docx package, free and independent of the paid API.

## Features

- **Template-Based Generation**: Upload a Word (DOCX) template with {placeholders} once; every API call fills a fresh copy with your data.
- **DOCX and PDF Output**: Download each generated document in its original DOCX format or as a PDF, over the same REST API.
- **4 Variable Types**: Fill placeholders with plain text, HTML, Markdown, or images, so one template covers customized documents.
- **Signature Webhooks**: When a generated document goes out for signature, webhooks report sent, viewed, signed, completed, and voided.
- **6 Published SDKs**: JavaScript/TypeScript, Python, Go, PHP, Java, and Ruby, all versioned together at 0.9.0.
- **One Key, Two Modules**: Deliverable generates documents; TurboSign sends them for signature. Same API key, same SDK install.

## Can an AI coding agent install the document generation SDK?

Skip the boilerplate. Drop the TurboDocx SDK and `@turbodocx/html-to-docx` into any project with the open-source Agent Skill. It detects your language and framework, installs the package, configures env vars, and writes working integration code that matches your existing patterns. Works with Claude Code, GitHub Copilot, Cursor, OpenCode, Codex CLI, and Gemini CLI.

```bash
# both skills
npx skills add TurboDocx/quickstart
# in your editor
/turbodocx-sdk
```

[Read the docs](https://docs.turbodocx.com/docs/SDKs/agent-skills) or [view on GitHub](https://github.com/TurboDocx/quickstart). See also the [Quickstart page](https://www.turbodocx.com/quickstart.md).

## How do I generate a DOCX or PDF from a template with an API?

Call the Deliverable module with a templateId and your variables, then download the file. Straight from the official SDK examples (production ready). Examples are shown for TypeScript and Python.

### TypeScript SDK

```typescript
// npm install @turbodocx/sdk
import { Deliverable } from '@turbodocx/sdk';

Deliverable.configure({
  apiKey: process.env.TURBODOCX_API_KEY,
  orgId: process.env.TURBODOCX_ORG_ID,
});

const created = await Deliverable.generateDeliverable({
  templateId: 'YOUR_TEMPLATE_ID',
  name: 'Employee Contract - John Smith',
  variables: [
    { placeholder: '{EmployeeName}', text: 'John Smith', mimeType: 'text' },
    { placeholder: '{JobTitle}', text: 'Senior Software Engineer', mimeType: 'text' },
  ],
});

const id = created.results.deliverable.id;
const docx = await Deliverable.downloadSourceFile(id); // filled DOCX
const pdf = await Deliverable.downloadPDF(id); // same document as PDF
```

### Python SDK

```python
# pip install turbodocx-sdk
import asyncio, os
from turbodocx_sdk import Deliverable

async def generate():
    Deliverable.configure(
        api_key=os.getenv("TURBODOCX_API_KEY"),
        org_id=os.getenv("TURBODOCX_ORG_ID"),
    )

    created = await Deliverable.generate_deliverable(
        template_id="YOUR_TEMPLATE_ID",
        name="Employee Contract - John Smith",
        variables=[
            {"placeholder": "{EmployeeName}", "text": "John Smith", "mimeType": "text"},
        ],
    )

    deliverable_id = created["results"]["deliverable"]["id"]
    docx = await Deliverable.download_source_file(deliverable_id)  # filled DOCX
    pdf = await Deliverable.download_pdf(deliverable_id)  # same document as PDF

asyncio.run(generate())
```

Need e-signatures on that document? Same API key, same SDK: send it with the TurboSign module. Full endpoints, pricing, and code samples are on the [E-Signature API](https://www.turbodocx.com/e-signature-api.md) page.

Need Go, PHP, Java, or Ruby? Every SDK exposes the same generate call:

- JavaScript / TypeScript: `Deliverable.generateDeliverable({ templateId, name, variables })`
- Python: `await Deliverable.generate_deliverable(template_id=..., name=..., variables=[...])`
- PHP: `Deliverable::generateDeliverable([...])`
- Go: `client.Deliverable.GenerateDeliverable(ctx, &turbodocx.CreateDeliverableRequest{...})`
- Java: `client.deliverable().generateDeliverable(request)`
- Ruby: `TurboDocxSdk::Deliverable.generate_deliverable(request)`

[Deliverable (document generation) SDK reference](https://docs.turbodocx.com/docs/SDKs/deliverable). Full documentation: [docs.turbodocx.com](https://docs.turbodocx.com). [Get a free API key](https://app.turbodocx.com/signup?utm_source=website&utm_medium=api-and-sdk&utm_campaign=document-generation).

## Which REST endpoints generate documents?

7 REST endpoints cover document generation end to end, from template to DOCX and PDF, plus the hand-off to signing. Base URL: `https://api.turbodocx.com`

| Method | Path | Description |
| --- | --- | --- |
| POST | `/v1/deliverable` | Generate a document from a template |
| GET | `/v1/deliverable` | List generated documents |
| GET | `/v1/deliverable/:id` | Get document details and variables |
| GET | `/v1/deliverable/file/:id` | Download the generated file in its original format (DOCX) |
| GET | `/v1/deliverable/file/pdf/:id` | Download the generated PDF |
| PATCH | `/v1/deliverable/:id` | Update document metadata or tags |
| POST | `/turbosign/single/prepare-for-signing` | Send the generated document for signature |

## Which languages have a document generation SDK?

6 published SDKs wrap the same REST API and ship at version 0.9.0, each with a Deliverable module for document generation and a TurboSign module for signatures.

| Language | Install |
| --- | --- |
| JavaScript / TypeScript | `npm install @turbodocx/sdk` |
| Python | `pip install turbodocx-sdk` |
| PHP | `composer require turbodocx/sdk` |
| Go | `go get github.com/TurboDocx/SDK/packages/go-sdk` |
| Java | `implementation 'com.turbodocx:turbodocx-sdk:0.9.0'` |
| Ruby | `gem install turbodocx-sdk` |

[Full SDK reference](https://docs.turbodocx.com/docs/SDKs)

## Can the SDK handle high-volume document generation?

Each document is 1 `generateDeliverable()` call, so a batch job loops over your records and can run calls concurrently: `Promise.all` in Node.js, `asyncio.gather` in the async Python SDK, or goroutines with the Go client. `listDeliverables()` pages back through what you generated, and Enterprise plans set custom API rate limits for sustained volume.

Generating proposals, contracts, or reports from a CRM? See [the Developer Hub](https://www.turbodocx.com/developers.md) for quickstarts, or [book a demo](https://www.turbodocx.com/demo?product=turbosign) to size an Enterprise rate limit.

## For Developers: Build Document Features Fast

Add document generation and e-signatures to your SaaS with 1 API key and 1 SDK install.

- Generate invoices, contracts, reports on-demand
- Send the generated document for signature
- Fill text, HTML, Markdown, and image variables
- Webhooks instead of polling for status

Chat with developers on [Discord](https://discord.gg/NYKwz4BcpX).

## For Enterprises: Need a Tailored Integration?

Most teams self-serve with the API above. If your Salesforce, SharePoint, or legacy ERP setup needs a custom document workflow built and maintained for you, our team delivers that as a tailored integration, at software pricing.

- High-availability infrastructure
- Priority support
- Enterprise security & audit logs
- Custom API rate limits

[Book a demo](https://www.turbodocx.com/demo?product=turbosign)

## How much does the document generation API cost?

Document generation is included in every plan: 5 documents a month on Free, 10 on Team, and unlimited in-app on Pro.

E-signature pricing: API plans start at $0.30 per signature, with no minimums. Start on the free plan and pay only for the signatures you send beyond it, so a month with one extra signature costs $0.30.

| Plan | Price | Detail |
| --- | --- | --- |
| Free | $0 | 5/mo documents, 1,000 AI credits |
| Team | $10/user/mo | 10/mo documents |
| Pro | $20/user/mo | Unlimited documents & signatures in-app |
| Enterprise | Contact us | Custom API rate limits |

Full details: [pricing](https://www.turbodocx.com/pricing.md).

## Workflow Automation: Automate with n8n

Connect TurboDocx to 400+ apps with the official n8n nodes. Automate document generation and signature workflows without writing code.

- Generate documents from templates automatically
- Send documents for signature and track status
- Trigger actions on signature completion
- Works with Salesforce, Slack, Google Drive & more
- Open source & community driven, available on the npm registry, works with self-hosted & cloud n8n

```bash
# Install in your n8n instance
npm install @turbodocx/n8n-nodes-turbodocx
```

[View on npm](https://www.npmjs.com/package/@turbodocx/n8n-nodes-turbodocx)

## Frequently Asked Questions

### Is there a free tier for the TurboDocx document automation API?

$0 to start: the Free plan includes 5 document generations and 5 e-signatures a month, plus 1,000 AI credits, no credit card required. The $10/user/month Team plan raises that to 10 documents and 15 signatures a month shared across the team. The $20/user/month Pro plan gives named users unlimited document generation, signatures, and AI credits in the app. API signatures beyond any plan's included allowance start at $0.30 each with no minimums.

### Which SDKs does the TurboDocx API support?

6 published SDKs cover JavaScript/TypeScript, Python, Go, PHP, Java, and Ruby, all built on the same REST API and versioned together at 0.9.0. Each ships a Deliverable module for document generation and a TurboSign module for e-signatures, so one install covers both. Install with npm, pip, composer, Go modules, Maven Central, or RubyGems.

### Can the API generate DOCX and PDF documents from templates?

1 API call generates a document: Deliverable.generateDeliverable() takes a templateId and a list of variables, such as a placeholder like {EmployeeName}, and creates the filled document. Deliverable.downloadSourceFile() then returns it as a DOCX and Deliverable.downloadPDF() returns it as a PDF. Each variable is plain text, HTML, Markdown, or an image.

### Does the document automation API include e-signatures, or is that separate?

1 platform, 2 capabilities: the same API key and SDK generate documents with the Deliverable module and send them for signature with the TurboSign module, so a contract can be created, sent, and signed without switching tools or credentials. For endpoints, pricing, and code samples focused only on signing, see /e-signature-api.

### Is TurboDocx open source?

1,000,000+ downloads a month on npm: @turbodocx/html-to-docx is a free, MIT-licensed package that converts HTML to Word documents in Node.js, independent of the paid API and usable without a TurboDocx account. It runs standalone in any Node.js project or alongside the TurboDocx SDK, and its source is public on GitHub.

## Related Resources

- [E-Signature API](https://www.turbodocx.com/e-signature-api.md): Endpoints, pricing, and quickstarts focused only on the signing API.
- [Developer Hub](https://www.turbodocx.com/developers.md): All TurboDocx SDKs, quickstarts, and the AI agent install skill in one place.
- [Full SDK Reference](https://docs.turbodocx.com/docs/SDKs): API reference and guides for all SDK languages on docs.turbodocx.com.

Ready to generate your first document? Get an API key in minutes. Start with 5 free documents a month, scale as you grow. 5 min setup, no credit card required. Need a tailored integration into Salesforce, SharePoint, or a legacy system instead? [Book a demo](https://www.turbodocx.com/demo?product=turbosign).

[Get an API key](https://app.turbodocx.com/signup?utm_source=website&utm_medium=api-and-sdk&utm_campaign=document-generation)
