# Error codes

An error response has a non-zero `code`. The HTTP status table is in
[Calling the API → Errors](https://docs.bito.uz/en/guide/api.md#errors).

The status alone is not enough: many errors, including a wrong API key and rate limiting, come back as
`400`. **Branch on `code`.**

```json
{
    "code": 10001,
    "message": "Please pay attention to the filled information",
    "data": "organization_id",
    "status_code": 400,
    "messages": { "uz": "...", "ru": "...", "en": "..." },
    "time": "2026-11-05T12:00:00Z"
}
```

- When `data` is present, the detail is there: a field name, a missing permission, a record id. Its type
  differs by code.
- `Accept-Language` sets the language of `message`. Some codes only have English text.

These are the codes you are most likely to meet. For a code that is not listed, read `message` and
`data`.

## Auth and permissions

Step-by-step checks: [Diagnosing 403 and 404](https://docs.bito.uz/en/guide/403-404.md).

| `code` | HTTP | Meaning | What to do |
|---|---|---|---|
| `10004` | 401 | No key or token sent, or the session was ended | Check the header; with OAuth, authorize again |
| `10014` | 401 | The access token is invalid or expired | [Refresh the token](https://docs.bito.uz/en/guide/oauth/tokens.md#refresh) |
| `115006`, `11000` | 400 | Wrong API key, or user not found | Copy the whole key again and check the `user_id` header |
| `115004` | 400 | The integration is not installed, or was uninstalled | The merchant has to install it again |
| `115000` | 400 | Integration not found | The merchant has to install it again |
| `10003` | 403 | No permission for the action; `data` names the permission or section | [Diagnosing 403](https://docs.bito.uz/en/guide/403-404.md#403) |
| `10024` | 403 | The call came from an IP outside `ip_whitelist`; `data` is the IP Bito saw | Add the IP to the list |

## Request, rate limit and server

| `code` | HTTP | Meaning | What to do |
|---|---|---|---|
| `10001` | 400 | Validation failed; `data` is usually the field name | Compare the field's type and format with the [API reference](https://docs.bito.uz/en/api/index.md) |
| `10028` | 400 | The data does not match the storage format | Check the field values |
| `10031` | 400 | A date is later than the current time; `data` is the field name | Check your server's clock and time zone |
| `10021` | 400 | [Rate limited](https://docs.bito.uz/en/guide/faq.md#rate-limit) | Wait and retry |
| `10000` | 400 | Unexpected error; malformed JSON lands here too | Check the JSON. If it persists, send the time and path to [support](https://docs.bito.uz/en/guide/support.md) |
| `10030` | 503 | The account's data is being updated | Retry in a few minutes |
| `10032` | 503 | The service is temporarily unavailable | Retry with backoff; keep your token |

::: warning
Do not retry a write blindly: `create` is not idempotent. Check first that the record was not created.
:::

## Referenced records

An id in the request does not exist, is deleted or belongs to another account. This is a `400`, not a
`404`.

| `code` | What is missing or does not fit | What to do |
|---|---|---|
| `13000` | Organization | Take the id from `organization/get-all` |
| `182000` | Warehouse | Take the id from the `warehouse` list |
| `182006` | The organization has no main warehouse | Send `warehouse_id`, or ask the merchant to set a main warehouse |
| `127000` | Price list | Check `price_id` |
| `127002` | No main price list | Ask the merchant to set one up |
| `19000` | Currency | Take the id from `currency/get-all` |
| `18000`, `18005` | Payment method not found, or not usable for this operation | Pick another payment method |
| `62000` | Payment type (`payment-type`) | Check the id |
| `60000` | Cashbox | Take the id from `cashbox/get-all` |
| `176000` | Unit of measure | Check the id |
| `174000`, `174005`, `174006` | State (pipeline column) not found, from another organization, or of another type | Take a matching column from `states/get-all` |
| `164000`, `164002` | Custom field not found, or its value is wrong | Check the field id and value type |
| `251000` | Tag | Check the id |
| `227000` | The source in the `source_id` header is not your integration's | Send the id of your own source |

## Sales

How states change: [Sale lifecycle](https://docs.bito.uz/en/guide/concepts/sale-lifecycle.md).

| `code` | Meaning | What to do |
|---|---|---|
| `149000` | Sale not found | Check the id |
| `149002` | The sale state cannot be changed this way | Re-read the current state |
| `149005`, `149021` | No credit sale without a customer / settings require a customer | Send `customer_id` |
| `149024`, `149023` | Credit or installment sales are switched off | Send full payment |
| `149036` | A debt return date is required | Send `paying_date` or an installment plan |
| `149008` | The installment plan does not match the debt | The plan must add up to `debt` |
| `149025`, `149026` | Total quantity in the sale is below the minimum / above the maximum; `data` is the limit | Adjust quantities |
| `149012` | The account owner has to approve the debt or discount | A merchant setting; the owner approves the sale |
| `149004` | Refunding more than was sold | Account for `refunded_amount` on the lines |
| `149009` | A sale with a refund cannot be cancelled | Refund the rest instead |
| `149010` | Goods from the sale were already used, so it cannot be cancelled | Use a refund |
| `149020` | A product in the sale is deleted | The merchant has to restore the product |
| `123002`, `123003` | The refund amount exceeds what was paid / what is payable | Recalculate the amount |
| `123004` | The payment exceeds the unpaid remainder | Recalculate the amount |
| `157002` | Not enough money in the cashbox | Pick another cashbox or lower the amount |
| `236014` | An open cashbox session is required | Send `cashbox_session_id` |
| `236007`, `236009` | The cashbox session is closed / must be closed | Close it and open a new one |

### Orders (`sale-order`)

| `code` | Meaning | What to do |
|---|---|---|
| `151000` | Order not found | Check the id |
| `151002` | A `done` or `canceled` order cannot be changed | Read the state before updating |
| `151003` | The organization has no regular pipeline column | Ask the merchant to add one |
| `151005` | Selling more than was ordered | Stay within the order's remainder |
| `151006` | Required custom fields are empty; `data` lists their ids | Send those fields |
| `151007`, `149028` | The discount exceeds the allowed limit | Lower the discount |
| `151011`, `151012` | A payment needs a customer / the order already has a payment | Send `customer_id`; do not add a second payment |

::: warning Bulk operations
`sale-order/delete-many` and `update-status-many` respond **before** the records are processed: errors on
individual orders never reach the response. Verify the result by reading the orders again.
:::

## Warehouse and stock

See [Warehouse and stock](https://docs.bito.uz/en/guide/concepts/warehouse.md).

| `code` | Meaning | What to do |
|---|---|---|
| `124009`, `149003` | Not enough stock; `data` is the product id or name | Check `amount` in `product-warehouse/get-paging` |
| `124000`, `146000` | No stock record for the product | Check that product, warehouse and organization match |
| `124005`, `124006` | Marking codes missing / their count differs from the quantity | Send one code per unit |
| `124003`, `124007` | A marking code is wrong or not in the warehouse | Check it with `product-stock/get-by-mark` |
| `124008` | That marking code already exists | Remove the duplicate |
| `26008` | The operation is not possible with a compound product | Work with its components |
| `26014` | It is a service, not a product | Do not put services in warehouse documents |
| `132000` | Write-off not found | Check the id |
| `132002` | Goods from the document were already used, so it cannot be cancelled | Correct the stock with a new document |
| `144000` | Transfer not found | Check the id |
| `144002`, `144003`, `144004` | The current state does not allow changing the state, editing or receiving | Re-read the state |
| `144007` | The transfer request is neither in progress nor approved | Check the request's state |
| `144009`, `144011` | Transferred goods were already used; `data` lists the products | Make a reverse transfer |

## Customers

| `code` | Meaning | What to do |
|---|---|---|
| `43000`, `43009` | Customer not found / deleted | Check the id |
| `43001`, `142001` | That customer or person already exists (for example by phone number) | Search with `customer/get-by-phone-number` first |
| `142000` | Person record not found | Check `person_id` |
| `166000` | Customer category not found | Check the id |
| `43006` | The debt limit would be exceeded | Lower the debt or take a payment |
| `43003`, `43004` | A customer with an order / a sale cannot be deleted | Do not delete |
| `142003` | A customer with a non-zero balance cannot be deleted | Settle the balance first |
| `43005`, `142007` | The customer is merged with another record or linked to an organization | The merchant has to unlink it in Bito |

## Products

| `code` | Meaning | What to do |
|---|---|---|
| `26000` | Product not found | Check the id |
| `26022` | The product is not available in this organization | Enable it for the organization |
| `26001`, `26018` | That product or barcode already exists | Find it with `get-by-barcode` or `get-by-sku` and update it |
| `26003` | None of `is_product`, `is_material`, `is_semi_product`, `is_service` is `true` | Set at least one |
| `26002` | The `image` value is not in `images` | Add the main image to `images` too |
| `25000`, `141000`, `167000` | Category, box type or attribute not found | Check the id |
| `26004`–`26007` | A product in stock, in transit or booked cannot be deleted | Bring the stock to zero first |
| `26010`–`26013` | It cannot be archived for the same reasons | Bring the stock to zero first |
| `26009` | Not possible on a single variant of a variant product | Send the parent product id |
| `26017` | The delivery service cannot be modified | Leave it out of the list |
| `26023`, `26024`, `26025` | MXIK or package code not found in the tasnif catalog / the catalog is not responding | Check `class_code` and `package_code`; on `26025` retry later |
