---
title: "Generate PDF from template."
method: POST
path: "/documents/generate/template/"
tags: ["documents"]
---

# Generate PDF from template.

`POST /documents/generate/template/`

**Default (Latest)**: Generate PDF document from an existing template with merge tags.

## Request body

- object
  - `templateId` string, required — ID of the template to use for generation
  - `mergeTags` object — Optional merge tags for personalization
  - `filename` string — Optional filename for the generated PDF

## Response `200`

Default Response

- object
  - `documentId` string — Unique document identifier
  - `pdfUrl` string, uri — URL to download the generated PDF
  - `status` 'generating' | 'completed' | 'failed'
  - `filename` string — Generated filename

## Other responses

- `400` — Default Response
- `404` — Default Response

## Changes

- **2025-12-09** `53ff0a03b255` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/unlayer/apis/unlayer-api/changes/documents/generate/template/post.md)

---

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