Errors
An error has an HTTP status and a JSON body:
HTTP/1.1 402 Payment Required
Content-Type: application/json
{
"error": {
"code": "payment_required",
"message": "No card saved. The user adds one in Bibu, on the Billing page: https://meetbibu.com/settings/billing",
"key": "billing.err.noCard"
}
}codestable, one per status (table below). Idempotency errors have their own (further down).messageone sentence for a person, in English (in French withAccept-Language: fr). It may change: don't test it.keyBibu's reason, stable, when it has one (for examplebilling.err.noCard): test this one. A refused field may give onlyfield.fieldthe field at fault, when there is one. For update_campaign, which changes several blocks in turn, the block that refused: the ones before it were applied.detailwhat the other side answered, word for word, when there is one (a mail server refusing a login).
Statuses
| Status | Code | What it means |
|---|---|---|
400 | bad_request | The request isn't valid: a field (error.field), a field it doesn't take, or the JSON. A missing Idempotency-Key answers 400 too, with its own code: idempotency_key_required. |
401 | unauthorized | No valid API key. |
402 | payment_required | A payment method or budget is needed (no card on file, a payment failed). |
403 | forbidden | This key can't do that (read only), or it isn't yours to do. |
404 | not_found | Nothing with this id in this company. |
409 | conflict | Not in this state (e.g. a campaign not running, already launched), or the same Idempotency-Key still running. |
422 | unprocessable | Bibu refuses these values (its reason in error.key), or the Idempotency-Key was used for another request. |
429 | rate_limited | More than 120 requests in a minute: wait (Retry-After). |
500 | server_error | Something failed on Bibu's side, or a service it uses: try again. |
Idempotency errors
400 idempotency_key_required: the operation sends an email or spends money, and the Idempotency-Key header is missing.422 idempotency_mismatch: this key was used for another request.409 idempotency_in_progress: the first request with this key is still running.
When to retry
After a 429, wait the seconds in Retry-After. After a 500, try again a little later with the same Idempotency-Key. Any other error: fix the request before you send it again.
In the MCP server
A tool that fails gives its error as its result (isError), with the same code, sentence and reason: the assistant reads it and corrects itself. A read-only key sees every tool; those that change something answer api.err.readOnly. An assistant signed in by OAuth with read only gets HTTP 403 insufficient_scope instead: it asks you to sign in again, with full access. The tools that send an email or spend money take an optional idempotency_key argument instead of the header: give the same one when you retry. A wrong key answers HTTP 401; too many requests, HTTP 429.