---
title: "Export a PDF"
method: POST
path: "/v1/documents/{id}/export/"
tags: ["Documents"]
---

# Export a PDF

`POST /v1/documents/{id}/export/`

## Request

- Base URL: `https://api.pdfbetter.com`
- URL: `https://api.pdfbetter.com/v1/documents/{id}/export/`
- Auth: HTTP bearer

Renders the current version and returns a download link valid for 5 minutes. Counts against your plan exactly like a download in the app: the first export of new content uses one export; re-exporting unchanged content is free.

Idempotency-Key is ignored: the response holds a short-lived URL, so a replay would hand back an expired link. Retrying is safe — re-exporting unchanged content is free.

## Path parameters

- `id` string, required

## Request body

- object
  - `flatten` boolean: Burn fields and annotations into the page content
  - `includeComments` boolean
  - `fileName` string

## Response `201`

Export a PDF

- Export
  - `object` 'export', required
  - `id` string, required
  - `url` string, required
  - `fileName` string, required
  - `size` integer, required
  - `expiresAt` string, required: ISO 8601 timestamp (UTC)

## Other responses

- `400`: Invalid request (see `error.details.issues`)
- `401`: Missing or invalid API key
- `402`: Your plan doesn't include this (API access needs Business) or a monthly allowance is used up
- `403`: The API key lacks the required scope
- `404`: Not found (or not yours)
- `409`: Conflict with the current state
- `422`: Validation failed
- `429`: Rate limited — see RateLimit-* and Retry-After

---

[API](https://skmtc.dev/pdfbetter/apis/pdfbetter-api.md) · [All operations](https://skmtc.dev/pdfbetter/apis/pdfbetter-api/llms.txt) · [OpenAPI document](https://skmtc.dev/pdfbetter/apis/pdfbetter-api/revisions/6960b18754a8?raw)
