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

# Generate PDF document.

`POST /documents/generate/`

**Default (Latest)**: Generate PDF document from JSON design, HTML content, or URL.

## Request body

- union
  - object
    - `design` object, required — Proprietary design format JSON
    - `html` string — HTML content to convert to PDF
    - `url` string, uri — URL to convert to PDF
    - `mergeTags` object — Optional merge tags for personalization
    - `filename` string — Optional filename for the generated PDF
  - object
    - `design` object — Proprietary design format JSON
    - `html` string, required — HTML content to convert to PDF
    - `url` string, uri — URL to convert to PDF
    - `mergeTags` object — Optional merge tags for personalization
    - `filename` string — Optional filename for the generated PDF
  - object
    - `design` object — Proprietary design format JSON
    - `html` string — HTML content to convert to PDF
    - `url` string, uri, required — URL to convert to PDF
    - `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

## Changes

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

[Change history](https://skmtc.dev/unlayer/apis/unlayer-api/changes/documents/generate/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)
