Skip to main content
The API uses conventional HTTP status codes. 2xx responses mean success, 4xx mean a problem with the request and 5xx mean a problem on Routa’s side.

Error format

API errors share the same structure, in the style of the payment APIs you probably already know:
code is part of the contract: it is never renamed. New codes can be added at any time, so handle unknown codes generically, using type and the HTTP status.
The same request_id also comes in the Routa-Request-Id header of every response.

Actionable details

Some errors carry details with values you can use in your code:

Error types

billing_error uses 402, never 429. Clients retry 429, but waiting does not increase the allowance of a plan.

HTTP status codes

Malformed request

When the body, the query or the path do not have the documented format, for example because a required field is missing or a field has the wrong type, the API responds 422 request_invalid:
param names the field, such as template.button_parameters.0.index. It is absent when the API cannot point at a field, and it never repeats a key you made up, such as one in metadata. The response does not return the value you sent. A body that is not valid JSON gets a plain text 400 (Bad Request), without the error object.

How to handle each error

Trying again without changing anything is pointless. Read code, param and message, fix it and send another request. The exception is 409 idempotency_in_progress, which is worth a new attempt.
Respect the Retry-After header and use exponential backoff with jitter. See Rate limits.
Failures on Routa’s side are safe to retry if you use Idempotency-Key. Resend with the same key. See Idempotency.
You do not know whether the request arrived. Resend with the same Idempotency-Key. It guarantees there is no duplicate message.

Errors in the SDK

The SDK turns error responses into typed classes. See Error handling.

Code catalog

See every code, with its cause and fix, in Error codes.