Errors
The error envelope, request ids and every error code.
Every error uses one JSON envelope:
{
"error": {
"category": "quota_exceeded",
"code": "insufficient_credits",
"message": "Not enough credits for this call. Ask your BeMyPlan contact to top up.",
"requestId": "0b6f3c1e-8f0a-4a39-9a55-2d4d7f3e1c11",
"details": { "required": 1, "available": 0 }
}
}| Field | Meaning |
|---|---|
category | One of nine categories. Drive your retry and alerting behaviour from it. |
code | Stable and machine-readable. Match on it. |
message | A sentence a person can read, in the language you asked for (Accept-Language, or ?locale=es; English when the language is not served). For logs and for showing to a developer; the wording may change, so never match on it. |
requestId | The id of this request. Quote it to support. |
details | Optional, specific to the code. |
fields, formErrors | Validation problems. fields is keyed by the exact parameter or body field you sent (limit, after, airlineId), one sentence each; formErrors covers the request as a whole. |
Handle codes you do not know by their category and their HTTP status: new codes are added without a new
version (see Versioning).
Status codes
The API answers with 400, 401, 402, 403, 404, 405, 410, 413, 415, 429, 500 and 503 for
errors. A 304 is not an error: it is the answer to a conditional request (see Caching).
- Malformed JSON:
400invalid_json. - A body that is too large:
413payload_too_large. - An unknown route:
404route_not_found. - A known path with a method it does not accept:
405method_not_allowed, with anAllowheader listing the methods it does accept. - A missing or unusable API key:
401, withWWW-Authenticate: Bearer.
Parameters
- An unknown query parameter is refused with
400invalid_request, naming it infields. Parameter names are case-sensitive, so a typo such as?iatacode=AMSis caught instead of returning the unfiltered list.localeis accepted everywhere. - A parameter sent twice (
?limit=2&limit=3) is refused the same way. - An empty value counts as not sent, for every parameter (
?name=is the same as noname). - A malformed id answers
400("Not a valid airline id."); a well-formed id that does not exist answers404with the resource's*_not_foundcode.
Request ids
Every response carries an X-Request-Id header. BeMyPlan generates it, and it is also in meta.requestId
on success and in error.requestId on failure. Quote it to support.
To correlate calls with your own logs, send your own id in X-Request-Id. It is returned as
X-Client-Request-Id and never replaces ours. It must be 1 to 128 characters: letters, digits and
_ . : -.
API logs
In the portal, API logs lists the calls made with one of your keys that passed key authentication, in the last 90 days: time, method
and route, status, duration, the credits the call used, key prefix and request id. A check-in is charged at its final
state, so its call shows its credits as pending until then. You can filter by status class (2xx, 4xx, 5xx,
429) and by key. Every role, Viewers included, can open it. Calls without a valid key (401) are not
logged, and neither are calls refused after the key was recognised but before the request ran: a request
from an address outside the key's IP allowlist (403 api_key_restricted) and a call on a suspended
account (403 api_key_workspace_disabled). A call whose client disconnected before the response was finished is logged when our side finishes it,
with the status it ended with, the same moment it is charged or not. Under very high load some rows can be
dropped, so the log is for debugging, not a complete audit trail.
All error codes
This table is generated from the OpenAPI document the API itself publishes, so it lists exactly the codes the API can send.
Invalid request
Fix the request; sending it again unchanged fails again.
| Code | HTTP | Meaning |
|---|---|---|
invalid_cursor | 400 | The pagination cursor is malformed or was not issued by this API. |
invalid_json | 400 | The request body is not valid JSON. |
invalid_request | 400 | The request failed schema validation; see fields and formErrors. |
invalid_request_body | 400 | The request body could not be read; resend it. |
method_not_allowed | 400 | This path does not accept this method; the Allow header lists the ones it does. |
payload_too_large | 413 | The request body is larger than this API accepts. |
place_query_invalid | 400 | Send either query, or lat + lng (+ rad) — not both, not neither. |
unsupported_content_encoding | 415 | The body charset or content encoding is not supported; send UTF-8 JSON. |
Authentication
Check the API key and that it belongs to this environment.
| Code | HTTP | Meaning |
|---|---|---|
api_key_invalid | 401 | The API key is unknown, revoked or malformed. |
api_key_missing | 401 | No `Authorization: Bearer <api key>` header was sent. |
api_key_wrong_environment | 401 | This API key belongs to another environment (live vs sandbox); use a key created there. |
Not allowed
The key or the account may not do this: check scopes, enabled services and IP allowlist.
| Code | HTTP | Meaning |
|---|---|---|
api_key_restricted | 403 | The API key is restricted (IP, referrer or domain) from this request. |
api_key_workspace_disabled | 403 | The API key belongs to a suspended workspace; contact support. |
insufficient_scope | 403 | The API key lacks the scope this route requires. |
service_not_enabled | 403 | This service is not enabled for your account; contact BeMyPlan. |
Not found
The resource, route or API version does not exist (any more).
| Code | HTTP | Meaning |
|---|---|---|
aircraft_not_found | 404 | No aircraft with that id. |
airline_not_found | 404 | No airline with that id. |
airport_not_found | 404 | No airport with that id. |
api_version_retired | 410 | This API version is retired; see the migration guide in the Link header. |
city_not_found | 404 | No city with that id. |
country_not_found | 404 | No country with that id. |
route_not_found | 404 | No route matches this method and path. |
Rate limited
Wait the Retry-After seconds, then retry.
| Code | HTTP | Meaning |
|---|---|---|
preauth_rate_limited | 429 | Too many requests from this address before authentication. |
rate_limited | 429 | Too many requests; back off and retry after Retry-After. |
Credits
The call was not run. Ask BeMyPlan to top up or unpause the account.
| Code | HTTP | Meaning |
|---|---|---|
credit_account_frozen | 402 | Paid calls are paused for this account; contact BeMyPlan support. |
insufficient_credits | 402 | Not enough credits for this call (balance plus credit allowance). Ask your BeMyPlan contact to top up. |
Temporarily unavailable
Retry with exponential backoff.
| Code | HTTP | Meaning |
|---|---|---|
auth_unavailable | 503 | The session store did not answer in time; retry shortly. |
credits_unavailable | 503 | The credit ledger is unavailable; paid calls are paused. Retry shortly. |
entitlement_unavailable | 503 | Could not check which services are enabled; retry shortly. |
price_unavailable | 503 | No price is configured for this operation; the call was not run. |
refdata_unavailable | 503 | The reference data could not be read; retry shortly. |
Unexpected error
Retry with backoff; if it persists, send the requestId to support.
| Code | HTTP | Meaning |
|---|---|---|
internal_error | 500 | An unexpected server error; quote the requestId to support. |