---
title: "One order file, its reading and the source to check it against"
method: GET
path: "/api/v1/sales/orders/documents/{document_id}"
tags: ["orders"]
---

# One order file, its reading and the source to check it against

`GET /api/v1/sales/orders/documents/{document_id}`

## Request

- Base URL: `https://api.app.tightly.io`
- URL: `https://api.app.tightly.io/api/v1/sales/orders/documents/{document_id}`
- Auth: HTTP bearer

One purchase order as it arrived, and what Tightly read off it: the header facts, a line per garment with the codes as printed, and where on the paper each figure was read from, a page and the passage cited on it or a sheet row and column. `source.url` is a short lived link to the paper itself, so a person can stand the extracted lines beside it.

`matched` says which rung answered for each printed row: the account's own code, a barcode, your SKU, a pack code or a size grid row. `unmatched_lines` is how many rows still wait on somebody; while it is above zero, confirming the draft is refused.

Scope: `orders:read`.

## Path parameters

- `document_id` integer, required

## Headers

- `Tightly-Version` string

## Response `200`

The paper, whole. Alongside the fields below the answer carries `reading`, the reader's own stored frame, which `facts`, `lines`, `matched` and `header_match` are each drawn from and which also holds the totals it tied and the pages it read. The example leaves it out for length rather than because it is absent; where you want one field, read the four above it, and where you want the reading as the reader wrote it, read `reading`.

- object
  - `data` object
  - `message` object

## Other responses

- `401`: No usable key: malformed, unknown, revoked, expired or stopped. One refusal covers all five.
- `403`: The key may not reach this operation. `plan_excludes` when this organisation's plan does not include Tightly Connect, which the arriving order file needs and which is sold with Essentials+; `scope_missing` when the key does not hold Orders; `ip_not_allowed` when the caller's address is outside the key's allowlist; `account_mismatch` when a key issued to one account names another, or a paper that is not that account's.
- `404`: No order file with that id is on file (`document_not_on_file`).
- `429`: The key has spent its allowance for this minute. 600 reads and 120 writes a minute, counted per key, refused calls included. `Retry-After` says how long to wait.
- `503`: The database is briefly out of reach, which is what a failover or a full connection pool looks like from outside. Wait the seconds `Retry-After` names and send the request again. A read is safe to repeat. A write is not, because the connection was lost in the middle of it, so read the object back before sending it a second time. Branch on the status rather than on `code`, which is `POSTGRES_UNAVAILABLE` from one of the two seams that raise this and `SERVICE_UNAVAILABLE` from the other.

---

[API](https://skmtc.dev/tightly/apis/tightly-api.md) · [All operations](https://skmtc.dev/tightly/apis/tightly-api/llms.txt) · [OpenAPI document](https://skmtc.dev/tightly/apis/tightly-api/revisions/199f7eb35afb?raw)
