# FAQ & troubleshooting

## Symptom map

Find the response or behaviour you see, then follow the link.

| Symptom | Likely cause | Go to |
|---|---|---|
| `Integration is not installed` | The integration was never installed, or was uninstalled | [Not installed](#not-installed) |
| `403` naming your IP address | The address is not on `ip_whitelist` | [IP refused](#ip-refused) |
| `401` on every call | The header is not `api-key`, or the value lacks the `username:` part | [401 on every call](#401-every-call) |
| An OAuth token returns `401` before 24 hours | The secret was rotated, or the merchant uninstalled you | [Token stopped early](#token-revoked) |
| `403`, `code: 10003` | The permission for this action was not approved at install; `data` names it | [Create an integration](https://docs.bito.uz/en/guide/create.md) |
| `404` on a documented endpoint | Wrong HTTP method (`GET` vs `POST`), or the base URL lacks `/integration/api/v2/` | [HTTP methods](https://docs.bito.uz/en/guide/api.md#http-methods) |
| `400` naming an id | The referenced record does not exist or was deleted | [Soft delete](https://docs.bito.uz/en/guide/api.md#soft-delete) |
| `Too Many Requests` | More than one call per second to one route | [Too Many Requests](#rate-limit) |
| Duplicates after a retry | `create` is not idempotent | [Idempotency](#idempotency) |
| A deleted record keeps coming back | Soft delete | [Deleted record](#deleted-comes-back) |
| Your copy drifts from Bito | Deletes were missed, or stock is read from the wrong resource | [Syncing changes](#sync-changes) |
| Webhooks never arrive | Private-network destination, or the change came from a bulk operation | [Nothing arrives](#webhook-silent) |
| Webhook signature never matches | The HMAC is computed over a re-serialized body, not the raw bytes | [Signature](#webhook-signature) |
| An event came twice, out of order or not at all | Webhooks do not guarantee delivery | [Delivery](#webhook-delivery) |
| `Invalid credentials` on code exchange or refresh | Code reused or expired, wrong secret, stale refresh token | [Code](#invalid-code), [refresh](#refresh-invalid) |

## Credentials

### I lost my client secret. Can I read it again?

No. It is shown once, at creation. [Rotate it](https://docs.bito.uz/en/guide/rotate.md#client-secret) to get a new
one — but understand that rotation disconnects every merchant currently connected to your
integration, in every account.

### Do my credentials change when Bito approves my integration?

No. Approval does not touch credentials. Visibility, too, changes only on **card** approval —
`PRIVATE` becomes `PUBLIC`. Approving a release makes its code runnable but does not make the app
public.

`client_id` never changes. `secret` and `api_key` change only when you rotate them yourself: **Reissue
keys** in the panel replaces **both** in one call; there is no panel button for the API key alone —
that is done over the API with `regenerate_api_key: true`. See [Rotating credentials](https://docs.bito.uz/en/guide/rotate.md).

### What is the app or integration code?

A permanent public slug stored as `system_id` in the API. In **My apps** you choose it, check
availability and claim it before publication. It is Bito's equivalent of an amoCRM widget code;
it cannot be renamed after it is saved.
It is also the `{widget_code}` in [left-menu](https://docs.bito.uz/en/guide/widget-package.md#left-menu) URLs and the value of `bito.widget.code`.

### Can I use one integration for several merchants with just the API key?

No. An `api_key` belongs to one account. Serving many merchants means [OAuth](https://docs.bito.uz/en/guide/oauth/index.md), where each
install has its own token pair.

## Authentication

### `Integration is not installed` on every call

A new integration is created uninstalled. Open it from the **Installed** list on the **Integration**
page and press **Install** — see [Create an integration](https://docs.bito.uz/en/guide/create.md#install). The same error comes back
after a merchant uninstalls the integration.

### `403` with `You don't have permission to access from this IP`

The integration has an `ip_whitelist` and the request came from an address that is not on it. Add
your server's address (IPv4 or CIDR) or clear the list — see [Create an integration](https://docs.bito.uz/en/guide/create.md).

### `401 Unauthorized` on every call

Check, in this order: the header name (`api-key` for the key path, `Authorization: Bearer …` for
OAuth), that the key includes the `username:` prefix, and that the access token is under 24 hours
old.

### My access token suddenly stopped working before 24 hours

Something terminated the session behind it. The usual cause is a
[secret rotation](https://docs.bito.uz/en/guide/rotate.md#client-secret); a merchant uninstalling you is the other.
Re-authorize.

### `Invalid credentials` when exchanging the authorization code

Either the code was already used, or it is older than 20 minutes, or the `client_secret` does not
match. Codes are single-use — restart the flow to get a fresh one.

### Refresh fails with `Invalid credentials`

Refresh tokens rotate on every use. If you kept the old one after a successful refresh, it is dead.
Persist the new pair in the same transaction that consumes the old one.

## Webhooks

### I subscribed but nothing arrives

Check that your destination is `https://`, publicly reachable, and not on a private network — Bito
refuses loopback, RFC1918, link-local and cloud-metadata addresses. Then check whether the change
you are testing came from a **bulk** operation: mass imports and bulk updates emit no webhooks at
all.

### The signature never matches

You are almost certainly hashing a re-serialized body. Compute the HMAC over the **raw request
bytes**, before any `JSON.parse`. The key is your client secret (`client_secret`); if you rotated it,
use the new one. See [verifying the signature](https://docs.bito.uz/en/guide/webhooks.md#signature).

### An event was delivered twice / out of order / not at all

All three are possible by design. Delivery is single-attempt, unordered, and never retried. Treat a
webhook as a hint to re-fetch the record, and reconcile periodically with a full read.

### My integration was uninstalled and my webhooks stopped

Uninstalling deletes every webhook the integration owns. Re-installing re-creates the `webhook_uri`
subscription automatically; destinations added with `webhook/subscribe` must be subscribed again. The
signing secret does not change: it is your client secret (`client_secret`), and it changes only when
you [rotate it](https://docs.bito.uz/en/guide/rotate.md#client-secret).

## Publication

### How long does review take, and what is checked?

Bito reviews the marketplace card and a widget release separately. It checks the listing, permissions,
public HTTPS lifecycle URLs, archive and manifest, declared surfaces, install/uninstall behavior and
the real in-product test path. A release passes three ordered stages — code, listing and usability. See [Submit for review](https://docs.bito.uz/en/guide/submit.md#stages) and [Review & publication](https://docs.bito.uz/en/guide/review.md).

### My submission was rejected

First check which track was rejected. A card rejection appears in **General info**; a release rejection
appears on that version in **Versions**. Fix and resubmit only that track. The public card and an open
release do not share one status.

### My release is approved. Why is the app not in the marketplace?

Release approval makes the code runnable; it does not approve the marketplace card. Submit the card
from **General info**. For a widget app, card publication also verifies that the current release was
moderator-approved rather than only activated locally.

### Does approval install my integration for everyone?

No. Approval only lists it in the marketplace. Each merchant still installs it themselves, and each
install triggers your [install hook](https://docs.bito.uz/en/guide/lifecycle-hooks.md#install).

## API behaviour

### Why are list endpoints `POST` rather than `GET`?

Because their filters are a JSON body, not a query string — paging, date ranges and nested filters
do not fit comfortably in a URL. Single-record reads are `GET`, updates are `PUT`, deletes are
`DELETE`. The [method table](https://docs.bito.uz/en/guide/api.md#http-methods) has the full picture.

Note that the Bito **admin** API (what the web panel uses) is POST-only. That rule does not apply
here.

### I deleted a record but it still comes back

Bito soft-deletes. The record is flagged, not removed, and most resources have a `get-deleted`
endpoint. Filter on your side if you need only live rows.

### How do I sync only what changed?

Most `get-paging` endpoints accept an `updated_at` filter. Store the timestamp of your last sync and
pass it — this is much cheaper than paging the whole collection.

Two subtleties. Deleted records drop out of `get-paging` — fetch them with `get-deleted`. And read
stock from `product-warehouse/get-paging`: it accepts `updated_at`, and its `amount` is the quantity
available to sell, already net of reservations and goods in transit. `product-stock` holds batch-level
rows (cost, marking codes) and has no `updated_at` filter.

### Are writes idempotent?

No. Every `create` makes a second record on a repeat, so deduplicate on your side before retrying.

### `Too Many Requests`

Some methods limit the call rate: one request per second per method. Over the limit, the response
carries `code: 10021` with a "try again later" text in `message`. The HTTP status is currently
`400`, not `429`, so check `code`. Wait a moment and retry.

Still stuck? [Contact support](https://docs.bito.uz/en/guide/support.md).
