---
title: "Update a document"
method: PATCH
path: "/api/v1/documents/{id}"
tags: ["Documents"]
---

# Update a document

`PATCH /api/v1/documents/{id}`

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

Changes the type of a document, or turns its import offer off or on. A document that becomes an invoice of a purchase order goes to the parser again. `dismissed: false` shows the import offer again.

## Path parameters

- `id` integer, required

## Request body

- object
  - `type` 'invoice' | 'confirmation' | 'credit_memo' | 'packing_slip' | 'contract' | 'authorization_letter' | 'credit_agreement' | 'other'
  - `dismissed` boolean

## Response `200`

The 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

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