BeMyPlan API

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 }
  }
}
FieldMeaning
categoryOne of nine categories. Drive your retry and alerting behaviour from it.
codeStable and machine-readable. Match on it.
messageA 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.
requestIdThe id of this request. Quote it to support.
detailsOptional, specific to the code.
fields, formErrorsValidation 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: 400 invalid_json.
  • A body that is too large: 413 payload_too_large.
  • An unknown route: 404 route_not_found.
  • A known path with a method it does not accept: 405 method_not_allowed, with an Allow header listing the methods it does accept.
  • A missing or unusable API key: 401, with WWW-Authenticate: Bearer.

Parameters

  • An unknown query parameter is refused with 400 invalid_request, naming it in fields. Parameter names are case-sensitive, so a typo such as ?iatacode=AMS is caught instead of returning the unfiltered list. locale is 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 no name).
  • A malformed id answers 400 ("Not a valid airline id."); a well-formed id that does not exist answers 404 with the resource's *_not_found code.

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.

CodeHTTPMeaning
invalid_cursor400The pagination cursor is malformed or was not issued by this API.
invalid_json400The request body is not valid JSON.
invalid_request400The request failed schema validation; see fields and formErrors.
invalid_request_body400The request body could not be read; resend it.
method_not_allowed400This path does not accept this method; the Allow header lists the ones it does.
payload_too_large413The request body is larger than this API accepts.
place_query_invalid400Send either query, or lat + lng (+ rad) — not both, not neither.
unsupported_content_encoding415The body charset or content encoding is not supported; send UTF-8 JSON.

Authentication

Check the API key and that it belongs to this environment.

CodeHTTPMeaning
api_key_invalid401The API key is unknown, revoked or malformed.
api_key_missing401No `Authorization: Bearer <api key>` header was sent.
api_key_wrong_environment401This 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.

CodeHTTPMeaning
api_key_restricted403The API key is restricted (IP, referrer or domain) from this request.
api_key_workspace_disabled403The API key belongs to a suspended workspace; contact support.
insufficient_scope403The API key lacks the scope this route requires.
service_not_enabled403This service is not enabled for your account; contact BeMyPlan.

Not found

The resource, route or API version does not exist (any more).

CodeHTTPMeaning
aircraft_not_found404No aircraft with that id.
airline_not_found404No airline with that id.
airport_not_found404No airport with that id.
api_version_retired410This API version is retired; see the migration guide in the Link header.
city_not_found404No city with that id.
country_not_found404No country with that id.
route_not_found404No route matches this method and path.

Rate limited

Wait the Retry-After seconds, then retry.

CodeHTTPMeaning
preauth_rate_limited429Too many requests from this address before authentication.
rate_limited429Too many requests; back off and retry after Retry-After.

Credits

The call was not run. Ask BeMyPlan to top up or unpause the account.

CodeHTTPMeaning
credit_account_frozen402Paid calls are paused for this account; contact BeMyPlan support.
insufficient_credits402Not enough credits for this call (balance plus credit allowance). Ask your BeMyPlan contact to top up.

Temporarily unavailable

Retry with exponential backoff.

CodeHTTPMeaning
auth_unavailable503The session store did not answer in time; retry shortly.
credits_unavailable503The credit ledger is unavailable; paid calls are paused. Retry shortly.
entitlement_unavailable503Could not check which services are enabled; retry shortly.
price_unavailable503No price is configured for this operation; the call was not run.
refdata_unavailable503The reference data could not be read; retry shortly.

Unexpected error

Retry with backoff; if it persists, send the requestId to support.

CodeHTTPMeaning
internal_error500An unexpected server error; quote the requestId to support.

On this page