---
title: "Upload a document"
method: POST
path: "/api/v1/documents"
tags: ["Documents"]
---

# Upload a document

`POST /api/v1/documents`

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

The upload is idempotent. The same file on the same owner answers 200 with the document that is already there, and a new file answers 201. The file hash decides.

## Response `200`

The owner already has this file. The answer is that document.

- object
  - `data` Document: A file that hangs on a purchase order or on a supplier. The file path is not here: a caller reads the file through the download link.
    - `id` integer: The id of the document.
    - `type` 'invoice' | 'confirmation' | 'credit_memo' | 'packing_slip' | 'contract' | 'authorization_letter' | 'credit_agreement' | 'other'
    - `status` 'uploaded' | 'classifying' | 'processing' | 'parsed' | 'empty' | 'failed'
    - `original_name` string
    - `mime_type` string, nullable
    - `file_size` integer, nullable: In bytes.
    - `reference_number` string, nullable
    - `notes` string, nullable
    - `targets` object[]: What the document hangs on.
      - `type` 'purchase_order' | 'supplier'
      - `id` integer: The id of the purchase order.
    - `ai_classified_type` string, nullable: What the classifier read. It differs from `type` when a person corrected it.
    - `ai_confidence` number, nullable
    - `has_parsed_data` boolean
    - `applied_at` string, date-time, nullable
    - `dismissed_at` string, date-time, nullable
    - `created_at` string, date-time, nullable
    - `updated_at` string, date-time, nullable

## Other responses

- `201`: The document is new
- `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
- `429`: Too many requests - rate limit exceeded

---

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