---
title: "File one order a retailer sent, and queue its read"
method: POST
path: "/api/v1/sales/orders/documents"
tags: ["orders"]
---

# File one order a retailer sent, and queue its read

`POST /api/v1/sales/orders/documents`

## Request

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

Files one purchase order a retailer sent you, as a PDF, a CSV, a workbook or a photographed page, against the account you name. Upload the file first with the presigned upload and send its key here. Tightly reads the paper on a worker and makes one draft sales order from it, with a line per garment resolved through that account's own codes; the answer comes back immediately with the paper in `received`, and the draft appears on it when the read lands.

Name the account in `account_id`. Tightly never takes the account off the letterhead: where the paper names a different account you have on file, nothing is created and the paper says why.

Scope: `orders:write`, which includes `orders:read`.

## Query parameters

- `account_id` string, required

## Headers

- `Tightly-Version` string
- `Idempotency-Key` string

## Request body

- ReceiveOrderDocumentRequest
  - `file_name` string, nullable
  - `mime_type` string, nullable
  - `s3_key` string, required

## Response `202`

The paper as recorded, before it has been read.

- object
  - `data` object: The paper, in the shape GET /sales/orders/documents/{document_id} serves.
  - `message` object: severity, service and desc.

## Other responses

- `400`: No account was named (`account_unknown`); the file is larger than 20 MB or is a kind Tightly does not read (`file_not_readable`); the key is not one of this organisation's uploads.
- `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 account with that id is on file.
- `409`: `edi_document_duplicate`, these bytes were already received; `file_names_another_account`, the paper names a different account you have 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)
