---
title: "Preview a single PDF page (file upload)"
method: POST
path: "/api/preview"
tags: ["Preview"]
---

# Preview a single PDF page (file upload)

`POST /api/preview`

## Request

- Base URL: `https://api.dokmatiq.com`
- URL: `https://api.dokmatiq.com/api/preview`
- Auth: API key in header `X-API-Key`

Upload a PDF and get a single page rendered as PNG or JPEG image. Returns the image directly as binary (not JSON). For multi-page previews, use the /api/preview/pages endpoint.

## Query parameters

- `page` integer
- `format` string
- `dpi` integer
- `maxWidth` integer

## Response `200`

Page preview image

## Other responses

- `400`: Invalid PDF or page number

---

[API](https://skmtc.dev/dokmatiq/apis/docgen-api.md) · [All operations](https://skmtc.dev/dokmatiq/apis/docgen-api/llms.txt) · [OpenAPI document](https://skmtc.dev/dokmatiq/apis/docgen-api/revisions/3fa1a922764d?raw)
