---
title: "Preview an invoice import"
method: GET
path: "/api/v1/documents/{id}/import-preview"
tags: ["Documents"]
---

# Preview an invoice import

`GET /api/v1/documents/{id}/import-preview`

## Request

- Base URL: `https://app.sellerassistant.app` (the document declares no server; this is the origin it was published from)
- URL: `https://app.sellerassistant.app/api/v1/documents/{id}/import-preview`
- Auth: one of:
  - API key in query parameter `api_key`
  - API key in header `X-Api-Key`

A document the parser is still reading answers its status and no items. A document the parser failed on answers 422 with the reason, and 503 when the fault is ours. The plan must carry the feature `invoice_parsing`.

    The answer holds `resolved` and `unresolved` (what the parser read), `invoice_meta` (what the invoice itself says) and `diff` (how the invoice compares with the order). `diff` reads for a person: the import writes the lines of the body and removes nothing. Every list of the diff stops at 100 lines, and `diff.diff_summary` keeps the real counts.

    `po_level_changes` compares the order with the lines the parser matched, so its `subtotal` counts `resolved` alone. The total of the invoice is `invoice_meta.subtotal`.

## Path parameters

- `id` integer, required

## Response `200`

What the parser read

- object
  - `data` object
    - `status` 'uploaded' | 'classifying' | 'processing' | 'parsed' | 'empty' | 'failed'
    - `document_id` integer
    - `items` object[]

## Other responses

- `403`: Access denied - insufficient permissions, invalid API key, or the API request limit is used up (`public_api_key_limit`)
- `404`: Resource not found
- `422`: Business logic error - operation cannot be completed due to business rules
- `429`: Too many requests - rate limit exceeded
- `503`: A service of ours did not answer. The call is right, and it can run again later.

---

[API](https://skmtc.dev/sellerassistant/apis/seller-assistant-public-api.md) · [All operations](https://skmtc.dev/sellerassistant/apis/seller-assistant-public-api/llms.txt) · [OpenAPI document](https://skmtc.dev/sellerassistant/apis/seller-assistant-public-api/revisions/5b3ecdbcadb6?raw)
