Skip to Content
Error Codes

Error Codes

All errors return JSON with error and code fields, even when the request specified an image format.

Error response format

{ "error": "No credits remaining", "code": "PAYMENT_REQUIRED", "buy_url": "/pricing" }

Error reference

HTTPCodeErrorFix
400BAD_REQUESTMissing or invalid parametersCheck the required parameters for the endpoint.
400INVALID_REQUESTMissing or invalid parameters on /api/v1/locationsbrand is required; radius_km requires city.
400INVALID_FORMATFormat not served by /api/v1/locationsThat route serves json and geojson only. The body returns valid_formats.
400INVALID_COUNTRYcountry is not ISO 3166-1 alpha-2Send the country’s own alpha-2 code. Never map a subdivision code to its prefix — CN-TW → CN returns mainland China for a Taiwan query. Taiwan is TW.
401UNAUTHORIZEDInvalid or missing API keyAdd the x-api-key header with a valid bm_live_* key.
403INSUFFICIENT_SCOPEYour key is not authorized for that routeThe body returns required_scope and granted_scopes. Authorization is by scope, not billing model.
403DATA_ACCESS_FORBIDDENA standard-tier key asked for location dataUse a data-enabled key.
402PAYMENT_REQUIREDNo credits remainingPurchase credits at /pricing  or switch to metered billing.
402TRIAL_EXPIREDTrial duration ran outUpgrade at /billing . The upgrade_url field in the error body points there.
402TRIAL_EXHAUSTEDTrial credits ran out before durationSame as above — convert your trial to a paid plan.
402TRIAL_INSUFFICIENTThis request would cost more credits than your trial has leftTrim the query (filter by country/state/city), or upgrade.
404NOT_FOUNDNo locations found for brandCheck brand spelling. Must match an indexed OSM brand tag exactly.
429RATE_LIMIT_EXCEEDEDToo many requestsWait for the seconds given in Retry-After. See Rate Limits.
500INTERNAL_ERRORServer errorRetry after a few seconds. If persistent, contact support.

On GET /api/v1/locations specifically

402 and the trial-cap headers are not reachable on that route: both formats it serves are data formats, so a trial or standard-tier key is refused at the data-access gate before any row is served, and every principal that can reach a 200 is charged nothing. See Locations API.

A 500 there never degrades to an empty success — 200 with count: 0 genuinely means zero matching rows. Treat 500 as retryable and never overwrite a good snapshot with the result of a failed call.

Handling errors in code

const res = await fetch("https://api.brandmappr.com/api/v1/locations?brand=Dutch%20Bros&country=US", { headers: { "x-api-key": process.env.BRANDMAPPR_KEY }, }); if (!res.ok) { const err = await res.json(); console.error(`${err.code}: ${err.error}`); if (res.status === 402) { // Redirect to purchase page window.location.href = err.buy_url; } return; } const data = await res.json();
Last updated on