Skip to content
Errors

Guides

Errors

Every error response has the same shape, with a stable code you can branch on.

Error format

Any response with a status of 400 or above has this JSON body, whatever the endpoint and whatever went wrong:

400 Bad Request
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "The latitude value is invalid.",
    "details": {
      "field": "lat"
    }
  }
}

Error fields

error.code
string
Stable, machine-readable code. Branch on this.
error.message
string
Human-readable explanation. The wording may change, so do not parse it.
error.details
object
Optional context, for example field (the invalid parameter), reason or limit. Only present when there is something useful to add.

Error codes

Errors

400
INVALID_REQUEST

Meaning

A parameter is missing or invalid. details.field names it. Also used with status 405 for a wrong HTTP method and 413 for an oversized body.

What to do

Fix the request; retrying it unchanged will fail again.
401
INVALID_API_KEY

Meaning

The Authorization header is missing or malformed, the key does not exist, or it has expired (details.reason is expired).

What to do

Send a valid key as Authorization: Bearer YOUR_API_KEY.
402
PAYMENT_REQUIRED

Meaning

The account has no active tier or has used its 500 free requests, so its API keys are paused.

What to do

Activate the free tier or buy a paid plan on the Billing page, then retry with the same key.
403
API_KEY_REVOKED

Meaning

The key was revoked in the dashboard.

What to do

Use another key or create a new one.
403
ENDPOINT_NOT_ALLOWED

Meaning

The key is not allowed to call this endpoint. Each key is limited to the endpoints chosen when it was created; details.allowed_endpoints lists them.

What to do

Use a key that includes this endpoint, or create one in the dashboard.
404
NOT_FOUND

Meaning

Nothing was found: no address near the point (reverse geocoding), no route or no road near a waypoint (routing, details.reason explains), or an unknown path.

What to do

Check the coordinates. For routing, move the point closer to a road or try another mode.
408
REQUEST_TIMEOUT

Meaning

The data service behind the API did not answer in time.

What to do

Retry after a short delay with exponential backoff.
429
RATE_LIMIT_EXCEEDED

Meaning

The key used up its requests for the current one-minute window.

What to do

Wait for the number of seconds in the Retry-After header, then retry.
429
QUOTA_EXCEEDED

Meaning

The authenticated key or tenant used its daily or monthly cost-unit quota.

What to do

Wait until the Retry-After reset, reduce expensive operations, or change the customer plan.
500
INTERNAL_ERROR

Meaning

An unexpected error in the API.

What to do

Retry later. If it persists, report the X-Request-ID.
502
UPSTREAM_ERROR

Meaning

The data service behind the API failed or returned an invalid answer.

What to do

Retry with backoff.
503
SERVICE_UNAVAILABLE

Meaning

The service is temporarily unavailable, for example while a data source is being configured or loaded.

What to do

Retry with backoff. details.retryable is true when a retry can succeed.

400 INVALID_REQUEST

400 response
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "Invalid value for 'lat': input should be less than or equal to 90",
    "details": {
      "field": "lat"
    }
  }
}

401 INVALID_API_KEY

401 response
{
  "error": {
    "code": "INVALID_API_KEY",
    "message": "The API key is missing or invalid."
  }
}

402 PAYMENT_REQUIRED

402 response
{
  "error": {
    "code": "PAYMENT_REQUIRED",
    "message": "Activate the free tier or a paid plan to use API keys."
  }
}

403 API_KEY_REVOKED

403 response
{
  "error": {
    "code": "API_KEY_REVOKED",
    "message": "This API key has been revoked."
  }
}

403 ENDPOINT_NOT_ALLOWED

403 response
{
  "error": {
    "code": "ENDPOINT_NOT_ALLOWED",
    "message": "This API key is not allowed to call this endpoint. Create a key that includes it.",
    "details": {
      "allowed_endpoints": [
        "geocode",
        "reverse-geocode"
      ]
    }
  }
}

404 NOT_FOUND

404 response
{
  "error": {
    "code": "NOT_FOUND",
    "message": "No address or place was found near this location."
  }
}

408 REQUEST_TIMEOUT

408 response
{
  "error": {
    "code": "REQUEST_TIMEOUT",
    "message": "The data service did not respond in time."
  }
}

429 RATE_LIMIT_EXCEEDED

429 response
{
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Too many requests.",
    "details": {
      "limit": 100
    }
  }
}

429 QUOTA_EXCEEDED

429 response
{
  "error": {
    "code": "QUOTA_EXCEEDED",
    "message": "The usage quota has been exhausted."
  }
}

500 INTERNAL_ERROR

500 response
{
  "error": {
    "code": "INTERNAL_ERROR",
    "message": "Internal server error."
  }
}

502 UPSTREAM_ERROR

502 response
{
  "error": {
    "code": "UPSTREAM_ERROR",
    "message": "The upstream data service returned an error."
  }
}

503 SERVICE_UNAVAILABLE

503 response
{
  "error": {
    "code": "SERVICE_UNAVAILABLE",
    "message": "This service is temporarily unavailable.",
    "details": {
      "retryable": true
    }
  }
}

Handling errors

  • Fix and resend: INVALID_REQUEST, NOT_FOUND. Retrying the same request gives the same answer.
  • Fix the credentials: INVALID_API_KEY, API_KEY_REVOKED. Do not retry in a loop.
  • Activate a tier: PAYMENT_REQUIRED. Activate the free tier or buy a paid plan on the billing page, then retry with the same key.
  • Retry with backoff: RATE_LIMIT_EXCEEDED (wait for Retry-After), REQUEST_TIMEOUT, UPSTREAM_ERROR, SERVICE_UNAVAILABLE and INTERNAL_ERROR. Use exponential backoff with a cap, and give up after a few attempts.
const RETRYABLE = new Set(["RATE_LIMIT_EXCEEDED", "REQUEST_TIMEOUT", "UPSTREAM_ERROR", "SERVICE_UNAVAILABLE"]);

async function getWithRetry(url: string, attempts = 3): Promise<unknown> {
  for (let attempt = 1; ; attempt++) {
    const response = await fetch(url, {
      headers: { Authorization: `Bearer ${process.env.GEO_API_KEY}` },
      signal: AbortSignal.timeout(10_000),
    });
    if (response.ok) return response.json();
    const { error } = (await response.json()) as { error: { code: string; message: string } };
    if (!RETRYABLE.has(error.code) || attempt === attempts) {
      throw new Error(`${error.code}: ${error.message}`);
    }
    // Honour Retry-After on 429, otherwise back off exponentially.
    const retryAfter = Number(response.headers.get("Retry-After"));
    const waitMs = retryAfter > 0 ? retryAfter * 1000 : 500 * 2 ** attempt;
    await new Promise((resolve) => setTimeout(resolve, waitMs));
  }
}

Request IDs

Every response, successful or not, carries an X-Request-ID header. Log it with errors and include it when you ask for help: it identifies the exact request. You can also send your own X-Request-ID (8–64 letters, digits, ., _ or -) to correlate requests with your logs; otherwise one is generated. Rate-limit headers are described in Rate limits.