Skip to main content

Import Initial Inventory

POST 

/api/initial-inventory/import

Loads a warehouse's opening stock from a CSV file and reports every row it did not load. Authentication: Requires Bearer token.

Required scope: inventory:write

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

Upload the CSV first with POST /api/store-file (multipart, destination=models) and pass the returned original_name and stored_name here.

CSV columns:

  • sku (or barcode) — identifies the product. A row with neither is skipped.
  • quantity — required, 0 or more.
  • unit_cost — per unit, 0 or more. Leave blank to use the product's best available cost; a row whose product has no cost is skipped instead of being loaded at zero. An explicit 0 is loaded at zero.
  • name is accepted and ignored, so a file downloaded from Export Initial Inventory can be uploaded again.

Behaviour:

  • Stock is dated on the account's inventory start date.
  • Each row sets that product's opening stock in the warehouse; products not in the file keep theirs.
  • Rows for an unknown SKU or barcode, a missing, non-numeric or negative quantity, a negative or non-numeric cost, or a repeat of a product already in the file (the first row wins) are skipped and listed in skipped_rows with a reason.
  • Files with more than 50 loadable rows are applied in the background: the response has queued: true, and the user is emailed when the import finishes.
  • Only one import per warehouse runs at a time.

Errors:

  • 422 nothing_imported — every row was skipped; nothing was written. data carries the summary.
  • 422 inventory_start_date_not_set — set the inventory start date first.
  • 422 warehouse_required — meta.warehouse_id is missing or unknown.
  • 422 invalid_csv — the file could not be read as CSV.
  • 409 import_in_progress — another import for this warehouse is running.

Request​

Responses​

OK

Response Headers
    Content-Type