Inventory import
POST /inventory/import imports a location's shelf from the CSV your point of sale exports. Post it on a schedule — nightly, from a task on the back-office PC — and the counts stay current without anyone uploading a file. Requires a key with the write scope.
Why name the source
A file uploaded by hand is treated as *your* numbers. A file posted here carries source — the system it came from — and that changes how the counts are used: they are treated as a mirror of your register. Bottl.Service then sells only the share of each item you allow on My Catalog, and pauses items once the count is older than staleAfterMinutes (default 36 hours, so one missed nightly export pauses nothing and two do). A feed that stops therefore fails safe instead of overselling your shelf.
Request
curl https://distryb.com/api/v1/inventory/import \
-H "Authorization: Bearer dk_live_…" \
-H "Content-Type: application/json" \
-d @- <<'JSON'
{ "businessId": "<location id>", "source": "cre", "fileName": "nightly.csv", "csv": "<file text>" }
JSON| field | ||
|---|---|---|
businessId | required | The location this file describes. Never guessed — a file landing on the wrong store looks perfectly right once it is there. |
source | required | cre, heartland, or the name of your system. |
staleAfterMinutes | optional | How long the counts may be trusted. Default 2160. |
csv | one of | The file's text. Columns are worked out from the headers and values. |
rows | one of | Already-shaped rows: { upc, quantity, retailPrice?, cost?, name?, category? }. Send your register's department as category — it is kept on each item and decides wine from spirits ahead of our own guess. |
columns | optional | Pin a column by header text or 0-based index: { "upc": "Item Number", "quantity": 4 }. |
fileName | optional | Shown in the import history. |
The whole file is one import run: it appears in My Inventory's recent imports and can be undone as one.
When columns don't resolve
The response is 422 with the headers seen and which of upc / quantity is missing. Pin them once with columns and the same request works every night thereafter. No model is consulted for a scheduled feed.
Response
The same result the dashboard upload reports — items added and updated, rows skipped as non-beverages, negative stock in the file, items awaiting photos — plus importRunId.


