Skip to main content

Import History

POST 

/api/ledger/history/imports

Import counts or purchases from a CSV or XLSX file (up to 20 MB). The import runs in the background; the response gives the job id to follow. Rows upsert on their natural key (counts: date, warehouse and SKU; purchases: date, document, SKU and warehouse), so importing the same file again updates rows instead of duplicating them. Each row is validated first; a bad row is rejected with its reason and the rest import. The finished job's results list created, updated and each rejected row (row, date, warehouse, sku, problem).

Required scope: accounting:write

Grant this scope to your token under Settings → Developer → Personal Access Tokens.

Count columns: date, warehouse, sku, quantity, unit_cost, basis, cost_basis, reference, note. Purchase columns: date, supplier, document, sku, warehouse, quantity, unit_cost, landed_cost, cost_basis, note, source_document.

Headers match case-insensitively. Dates are YYYY-MM-DD or MM/DD/YYYY. sku matches a product's SKU, then a supplier SKU, then a barcode. warehouse is a name or id; when blank, the account's only warehouse is used. landed_cost is for the whole line. source_document is stored on the row's note.

Authentication: Requires Bearer token + accounting.manage_settings permission.

Optional: default_warehouse_id: the warehouse for purchase lines whose file has none. The purchases file also accepts a received_on column.

Request​

Responses​

Accepted

Response Headers
    Content-Type