Errors and rate limits
The error body, what the SDK does with it, every code an agent can receive, and the limits behind a 429.
When the API refuses a call, it answers with a 4xx or 5xx status and the same JSON body every time. The status says what kind of failure it is; the code in the body says which one, and is what your code should branch on. This page lists every code an agent can receive, and the limits behind a 429 and a 402.
The error body
Say invoice-flow asks about Kiwi Studio's invoice with a variant its File it button does not have. Nothing is created, and the API answers 422:
error.code: one of the codes below. It does not change once published, so branch on it.error.message: a sentence for the person reading the log. It can change; do not parse it.error.details: only when the body you sent is at fault, one entry per problem.pointeris a dotted path into what you sent,notification.quickActions[1].name;messagesays what is wrong there. A surface that fails the catalog also names thecomponentby theidyou gave it, and itsproperty, so you can search your own code for both.
In the SDK
@nibify/sdk turns every failure into a NibifyError with the API's status and code, and its details. A call that never got an HTTP answer has status: null and code: 'network_error'; an answer with no code of ours has http_<status>.
The SDK retries a network failure, a 429 and a 5xx on its own, waiting for Retry-After when there is one. It never retries notify(), cancel() or nudge(), and no other status is retried: a 401, 402, 404, 409 or 422 will answer the same way until you change the call. Which calls are retried and how to send a request again without asking twice are in Idempotency and retries; the class itself is in the SDK reference.
Codes
The codes the endpoints of the agent API name in their responses, by status. The REST reference lists them again under each endpoint.
Any endpoint
These can come back from any call, whatever the endpoint: a body that is not JSON or is too large, a path that does not exist, a failure on our side. The SDK retries an internal_error like any 5xx; a request_rejected carries the status it was refused with.
Rate limits
Each project has two limits: a number of calls per second, and a volume over the last 24 hours. The day is a rolling window, so a burst at nine in the morning frees its budget at nine the next morning, not at midnight.
- The budget is the project's. Every API key of the project shares it, so a second key does not get a second budget.
testandliveare counted apart. A loop onsk_test_…cannot spend what your live agents need.- Only calls the API carries out count. A call refused with
429is neither carried out nor counted. - Waiting is free. The long poll,
GET /v1/requests/{id}/response, is never counted, however long and however often you wait.
Over either limit, the API answers 429 with rate_limited and a Retry-After header: a whole number of seconds, never below 1. The message says which of the two limits it was, and its value. When both are spent the per-second limit answers first. Wait for Retry-After and send again; the SDK does it for you.
Plan limits
Your plan allows a number of live Messages a month, a number of test Messages a month, and a number of projects. The pricing page has the numbers.
- Requests and notifications count together, across every project of the account. A message you delete still counts.
testandliveare counted apart. Each has its own allowance, so a loop onsk_test_…never spends what your live agents need, and ansk_live_…key keeps working when thetestallowance is spent. The demos the dashboard sends to your phone are not counted.- The month is the calendar month in UTC. The count starts again on the first day.
- We email you once a month, when 80% of the live allowance is gone.
Once an allowance is spent, POST /v1/requests and POST /v1/notifications with a key of that environment answer 402 with plan_limit_reached, and nothing is created. There is no Retry-After: retrying is refused the same way until the month turns or the plan changes, so do not retry it. The message names the environment, the plan, its limit, the day the count starts again and where to upgrade. A retry with the Idempotency-Key of a request that was already created still returns it.
Many requests to the same person in a short time are never refused on that person's behalf. Every message reaches the inbox, and Nibify spaces out the pushes so the phone does not ring twenty times in a minute. That is about the sound, not about errors: no status or code tells you it happened.