Create History Purchase
POST/api/ledger/history/purchases
Add a supplier purchase line to the history before go-live.
accounting:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Body: purchased_on (required, YYYY-MM-DD, before the inventory start date), product_id (required), received_on (optional, YYYY-MM-DD, not before purchased_on): when the goods arrived; the purchase counts in that month, and a line received on or after the start date is reported as in transit at go-live. quantity (required, not 0; negative for a supplier return), unit_cost (required, ≥ 0), warehouse_id (optional; a line with no warehouse counts only in the all-warehouses total), landed_cost (≥ 0, for the whole line), supplier_name, document_reference (≤191), cost_basis (manual_entry default; invoice for a line from a supplier invoice), note. value = quantity × unit cost + landed cost.
Authentication: Requires Bearer token + accounting.manage_settings permission.
Request
Responses
- 201
- 401
- 403
- 422
- 429
Created
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Unprocessable Content
Response Headers
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.