## Read a receipt (photo or PDF) with AI into a draft expense

`POST /api/hr/v1/travel-reports/{id}/receipts/{receiptId}/extract`

Module: HR · operationId: `extractTravelReceipt` · Tag: Travel expenses · Auth: access token (`Authorization: Bearer <accessToken>`)

Extraction of date, merchant, amount and VAT of a clean receipt: a photo is read with OCR, a PDF
through the text the DMS extracted from it. The answer is a draft only – nothing is saved; the
person checks it and saves the report. `409 receipt_reading` while the DMS is still reading the
PDF (retry shortly), `422 receipt_no_text` when the PDF has no readable text (encrypted, failed
or empty – enter the expense by hand), `503 unavailable` when AI is not configured or fails.

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string (uuid) | yes |  |
| `receiptId` | path | string (uuid) | yes |  |

### Responses

- **200** Draft (`application/json`)
- **400** Error (`application/json`)
- **404** Error (`application/json`)
- **409** Error (`application/json`)
- **422** Error (`application/json`)
- **503** Error (`application/json`)

Fields of the 200 answer:

- `amountCents` (integer): Gross amount in cents
- `date` (string (date)): Date of the receipt (YYYY-MM-DD)
- `description` (string): What was paid for
- `kind` (string): Kind of expense (one of `transport`, `lodging`, `other`)
- `merchant` (string): Issuer of the receipt
- `vatCents` (integer): VAT contained in the amount, in cents
- `vatRate` (number): VAT rate in percent

Example 200 answer:

```json
{
  "amountCents": 9800,
  "date": "2026-11-05",
  "description": "Übernachtung mit Frühstück",
  "kind": "lodging",
  "merchant": "Alpenhotel Seeblick",
  "vatCents": 641,
  "vatRate": 7
}
```

### Example request

```bash
curl -X POST 'https://api.mbcom.cloud/api/hr/v1/travel-reports/3f2b8c1e-7d4a-4e9b-9c2a-5b1d6e8f0a12/receipts/3f2b8c1e-7d4a-4e9b-9c2a-5b1d6e8f0a12/extract' \
  -H "Authorization: Bearer $ACCESS_TOKEN"
```
