Recipe: write-off
Your system knows that goods were damaged or lost — it has to show up in Bito under Warehouse › Actions › Write-offs and leave stock. That is a write-off document. It is created directly as done: there is no draft.
Permissions needed: write_off_create, write_off, warehouse, employee.
1. Find the organization and warehouse
GET /organization/get-allPOST /warehouse/get-all
{ "organization_id": "6712f0a9c4d1e87b3a0f9911", "status": "active" }Keep the organization's _id and currency_id and the warehouse's _id.
2. Pick a reason
POST /reason/get-paging
{ "page": 1, "limit": 200, "type": "write_off" }Reasons and permissions
reason/* methods have no permission key. If your app declares even one permission in required_permissions, they are closed to it (Creating an integration). In such an app, keep the reason id in your settings, or take it from existing documents: write-off/get-paging rows carry reason._id.
3. Pick the responsible employee
POST /employee/get-paging
{ "page": 1, "limit": 200 }4. Create the document
POST /write-off/create
{
"organization_id": "6712f0a9c4d1e87b3a0f9911",
"source_warehouse_id": "6712f0a9c4d1e87b3a0f9955",
"currency_id": "6712f0a9c4d1e87b3a0f9988",
"write_date": "2026-11-05T10:00:00Z",
"responsible_id": "6712f0a9c4d1e87b3a0f99aa",
"reason_id": "6712f0a9c4d1e87b3a0f99bb",
"action": "remove",
"products": [
{ "product_id": "6712f0a9c4d1e87b3a0f9933", "amount": 2 }
],
"code": "WMS-10482",
"note": "Damaged packaging"
}| Field | Required | Description |
|---|---|---|
organization_id | Yes | Organization |
source_warehouse_id | Yes | Warehouse the goods leave |
currency_id | Yes | The document's cost is calculated in it — usually the organization's currency |
write_date | Yes | ISO 8601 |
responsible_id | Yes | Responsible employee |
reason_id | Yes | Reason |
action | Yes | remove — write off for good, defect — move to defective goods |
destination_warehouse_id | For defect | Warehouse that accounts for the defective goods |
products[].product_id | Yes | Product |
products[].amount | Yes | A positive number in the product's unit of measure |
products[].marks | For marked goods | Codes; their count must equal amount |
products[].expiration_date | No | Take only from batches with this expiry date |
code | No | The document number in your system |
note | No | Comment |
The reference lists organization_id, source_warehouse_id and currency_id as optional, but the call fails without them. Send an existing warehouse of the same organization as destination_warehouse_id.
The response carries _id, number, state: "done", total_cost and the products lines.
Retries
create is not idempotent: a repeated call writes the goods off a second time. If no response came back, first read write-off/get-paging with warehouse_id, date_from, date_to and look for your code in the rows (search matches the Bito number only).
5. What changes
amountgoes down in the source warehouse. Reserved goods are not written off.- With
action: "defect", the same quantity is added to thein_trashcounter ofdestination_warehouse_id. - Cost is calculated from the batches (
total_cost), and Bito issues an expense-type invoice for it — it shows up ininvoice/get-pagingrows, wherewrite_off_idis the write-off's id. No money leaves a cashbox. - There is no webhook event for write-offs.
What the counters mean: stock and prices.
6. Cancel
PUT /write-off/set-status/6712f0a9c4d1e87b3a0f99cc
{ "status": "canceled" }The only transition is done → canceled. The goods return to the source warehouse (for defect, in_trash also goes down) and the invoice is cancelled. There is no method to edit or delete the document: if it is wrong, cancel it and create a new one.
Errors
code | Cause |
|---|---|
10001 | Validation: a required field is missing or a value is wrong — read message |
10003 (HTTP 403) | A permission was not approved; data names it |
26000, 26022 | Product not found, or not available in this organization |
26008, 26014 | A compound product or a service cannot be written off |
124000, 124009 | No stock, or not enough of it |
124003 | Wrong marking codes |
125000 | Reason not found |
132000 | Document not found |
132002 | Cannot cancel: already cancelled, or the goods were used afterwards |
On an error no document is created at all — lines are never partly written off.
Methods
| Step | Method |
|---|---|
| Organization | GET /organization/get-all |
| Warehouse | POST /warehouse/get-all |
| Reason | POST /reason/get-paging |
| Employee | POST /employee/get-paging |
| Create | POST /write-off/create |
| Check | POST /write-off/get-paging, GET /write-off/get-by-id/{id} |
| Cancel | PUT /write-off/set-status/{id} |