---
title: "Extract receipt and generate expense report document"
method: POST
path: "/api/receipts/to-document"
tags: ["Receipts"]
---

# Extract receipt and generate expense report document

`POST /api/receipts/to-document`

## Request

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

Combines receipt extraction and document generation in a single call.

1. Extracts data from the uploaded receipt image using AI
2. Generates a formatted expense report PDF or DOCX using the extracted data

Optionally provide a template name to use a custom expense report template. Without a template, a clean default HTML-based expense report is generated.

This endpoint consumes AI credits for the extraction step plus standard credits for the document generation.

## Query parameters

- `format` string
- `templateName` string
- `title` string

## Response `200`

Generated expense report document

## Other responses

- `400`: No file uploaded or unsupported file type
- `500`: Processing failed

---

[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)
