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

# Generate PDF from template.

`POST /documents/v1/generate/template/`

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

---

[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/6bef9fa0591c/schema)
