Skip to content
View as Markdown

Warehouse documents ​

You cannot write stock directly through the API — it changes as a result of documents. The counters per product × warehouse are amount (available to sell), booked, in_transit, on_the_way and in_trash — see stock and prices.

What the API exposes ​

DocumentCreateState changesRead permission
Order to a supplier (purchase-order)Yesset-statepurchase_order
Purchase (purchase)Yesset-statepurchase
Income (income)Yes, against a purchasecancelincome
Return to a supplier (purchase-return)NoNopurchase_return
Internal transfer (internal-transfer)Yesset-status, receiveinternal_transfer
Transfer between organizations (organizational-transfer)Yesset-status, receiveorganizational_transfer
Write-off (write-off)Yesset-statuswrite_off
Stocktaking (revision)Yesset-statusrevision_customer_cashback

The exact permission of every method is in Permissions. All of them have get-paging and get-by-id/{id}. create methods are not idempotent.

Order to a supplier ​

new → accepted or in_progress → done; canceled only from new. state: "new" is required on create. No effect on stock.

Methods: create, set-state.

Purchase and income ​

A purchase goes new → in_progress → done; canceled from any state. It is created as new or in_progress, and update works only while new.

ActionStock
Purchase → in_progresson_the_way goes up
Purchase → doneStock does not change: the supplier balance and an invoice are recorded
Creating an incomeon_the_way goes down, amount goes up in the income's warehouse
Cancelling an incomeThe reverse. If the goods were already used, it fails
Cancelling a purchaseon_the_way is rolled back; for a done purchase its incomes are cancelled too. If an in_progress purchase is already partly received, cancel those incomes first

Which warehouse holds on_the_way

on_the_way is recorded on the organization's first warehouse, which may not be the warehouse named in the purchase. If you need a product total, add the warehouses up.

Through the API an income is created only against a purchase: it needs purchases[].purchase_id and a purchase_item_id on every line, and the purchase must have been moved to in_progress. An income is done at once. A purchase created with is_auto_income: true becomes done and records its income itself.

Methods: purchase/create, purchase/set-state, income/create, income/cancel.

Return to a supplier ​

States: done, canceled. A return lowers amount in the warehouse. The API is read-only here: get-paging — the document is created in Bito.

Transfers ​

An internal transfer moves goods between the warehouses of one organization; an organizational transfer sends them to another organization's warehouse. Both are created with state: "new" and can be edited while new.

TransitionHowStock
new → acceptedset-statusIn the sending warehouse amount goes down, in_transit goes up
accepted → in_progressset-statusNo change
accepted, in_progress → donereceiveSender's in_transit goes down, receiver's amount goes up
→ canceledset-statusFrom new, no change; otherwise the goods return to the sending warehouse

done cannot be set with set-status — only receive does it.

Mind two differences:

set-status bodyreceive body
Internal{ "status": "accepted" }empty
Organizational{ "state": "accepted" }{ "receiver_warehouse_id": "…" } — a warehouse of the receiving organization

Methods: Internal transfer, Organizational transfer.

Write-off ​

Created directly as done; the only transition is to canceled. amount goes down; for defect, in_trash goes up. Step by step: write-off recipe.

Stocktaking ​

pending → in_progress → done; canceled from pending or in_progress. A done document cannot be cancelled. update works only while pending. Pass the state to set-status as { "status": "…" }.

Creating it and moving it to in_progress do not change stock. done sets the stock of every listed product to its counted quantity and issues invoices for the surplus or shortage.

Do not complete it uncounted

The API has no method for entering counted quantities. Without set_counted, the counted quantity of every line is 0: if you set done before staff have counted in Bito, the stock of the listed products drops to zero, and it cannot be cancelled.

Methods: Revision.

Webhooks ​

There are events for purchaseOrders, purchases, purchaseReturns and incomes (webhooks). There are none for transfers, write-offs or stocktaking — poll them with get-paging. An app that declares required_permissions cannot subscribe to webhooks.

Sales documents are not covered here — see the sale lifecycle.

Bito 2.0 Integration API