---
title: "Generate document from template"
method: POST
path: "/templates/{slug}.{ext}"
tags: ["templates"]
---

# Generate document from template

`POST /templates/{slug}.{ext}`

Generates a document from a template using provided data. Supported extensions: html, pdf, jpeg, png, webp.

## Path parameters

- `slug` string, required
- `ext` 'html' | 'pdf' | 'jpeg' | 'png' | 'webp', required

## Request body

- TemplateGenerateForm — unresolved $ref

## Response `200`

Generated document

- object

## Other responses

- `400` — Bad request.
- `401` — Unauthorized. Invalid auth key.
- `404` — Template not found.
- `429` — Too Many Requests. You have been rate limited.
- `500` — Internal Server Error.

---

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