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

# Import an invoice

`POST /api/v1/documents/{id}/import`

## 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`
- Auth: one of:
  - API key in query parameter `api_key`
  - API key in header `X-Api-Key`

The caller sends the lines it confirmed, not the lines the parser read. A line with no ASIN does not go in. Every item of the order goes back through the profit calculation, because the order level costs are spread over all of them. The plan must carry the feature `invoice_parsing`.

    One document goes into the order once. The import adds the quantity of a line to the item that already carries that ASIN, so a second call would count the same goods twice. A document that carries `applied_at` answers 409, and a retry cannot make it work.

## Path parameters

- `id` integer, required

## Request body

- object
  - `items` object[], required
    - `asin` string, nullable
    - `title` string, nullable
    - `sku` string, nullable
    - `upc` string, nullable
    - `ean` string, nullable
    - `image_url` string, nullable
    - `brand` string, nullable
    - `quantity` integer, required
    - `unit_price` number, required
  - `order_costs` object
    - `taxes` number
    - `shipping_cost` number
    - `misc_expenses` number

## Response `200`

What the import wrote

- object
  - `data` object
    - `purchase_order_id` integer
    - `imported_count` integer
    - `costs_applied` boolean
    - `applied_at` string, date-time, nullable

## Other responses

- `400`: Bad request - validation failed or invalid parameters
- `403`: Access denied - insufficient permissions, invalid API key, or the API request limit is used up (`public_api_key_limit`)
- `404`: Resource not found
- `409`: Conflict - the row is there, and another row already holds the place the call asks for
- `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)
