docs

    Error Codes

    Comprehensive reference for all API error responses.

    Trying to fix a specific symptom? The Troubleshooting guide walks through the most common failures (401/403/429, empty results, tiles not rendering, CORS) with step-by-step fixes.

    Error response format

    Most error responses follow this JSON structure:

    error.json
    {
      "error": "error_code",
      "message": "Human-readable description of the error.",
      "details": {}  // Optional additional context
    }

    The plan-gate 403s below are the exception: they carry the code under code or error, the prose under detail rather than message, and add plan — the team's current plan id:

    plan-gate-403.json
    {
      "code": "offline_requires_pro_plan",
      "plan": "free",
      "detail": "CHRToffline requires the Pro plan or above. Upgrade at https://platform.chrt.co/plans."
    }

    If you use the SDK you don't need to care: it normalizes both shapes into a typed .code you can switch on.

    HTTP status codes

    Client errors (4xx)

    CodeErrorDescriptionAction
    400bad_requestMissing or invalid query parametersCheck parameter types and required fields
    401unauthorizedMissing or invalid API keyVerify your x-api-key header
    403forbiddenKey lacks required scope or coverage accessCheck key scopes and team coverage plan
    403offline_requires_pro_planCHRToffline requires the Pro plan or aboveUpgrade at /plans, or drop the offline:download scope
    403offline_not_enabledThe key lacks the offline:download scope (separate from the plan gate)Add the scope to the key on an entitled plan
    403interact_not_enabledCHRTinteract requires the Dev plan or aboveUpgrade at /plans; see CHRTinteract
    403style_requires_dev_planBinding a custom style requires the Dev plan or aboveUpgrade, or use the free S-52 / S-101 / CHRT / INT-1 / U.S. Chart No. 1 families via ?symbols=
    429monthly_limit_exceededThe plan's monthly tile or feature allowance is spentWait for the next billing cycle, upgrade, or enable overage billing
    404not_foundResource does not exist (cell, tileset group)Verify the endpoint URL and resource ID
    429rate_limit_exceededToo many requests in the current windowWait for Retry-After seconds, implement backoff

    Server errors (5xx)

    CodeErrorDescriptionAction
    500internal_errorUnexpected server errorRetry after a brief delay; contact support if persistent
    502upstream_errorUpstream tile provider returned an errorRetry; the upstream service may be temporarily unavailable
    503service_unavailableAPI is temporarily down for maintenanceRetry after the maintenance window

    Common error scenarios

    Invalid API key

    response.json
    // 401 Unauthorized
    {
      "error": "unauthorized",
      "message": "Invalid or missing API key."
    }

    Coverage not available

    response.json
    // 403 Forbidden
    {
      "error": "forbidden",
      "message": "Your coverage plan does not include this chart source.",
      "details": {
        "required_coverage": "CA",
        "current_coverage": ["US"]
      }
    }

    Invalid bounding box

    response.json
    // 400 Bad Request
    {
      "error": "bad_request",
      "message": "Invalid bbox parameter. Expected format: west,south,east,north",
      "details": {
        "param": "bbox",
        "received": "invalid"
      }
    }

    Monthly limit reached

    response.json
    // 429 Too Many Requests
    {
      "error": "monthly_limit_exceeded",
      "message": "You have exceeded your monthly tile serve limit.",
      "details": {
        "limit": 5000,
        "used": 5000,
        "resets_at": "2026-04-01T00:00:00Z"
      }
    }

    Handling errors

    error-handling.ts
    async function fetchFeatures(bbox: string) {
      const res = await fetch(
        `https://api.chrt.co/v1/features?bbox=${bbox}`,
        { headers: { 'x-api-key': API_KEY } }
      );
    
      if (!res.ok) {
        const error = await res.json();
        
        switch (res.status) {
          case 429:
            const retryAfter = res.headers.get('Retry-After');
            console.log(`Rate limited. Retry after ${retryAfter}s`);
            break;
          case 401:
            console.error('Invalid API key');
            break;
          case 403:
            console.error('Coverage access denied:', error.details);
            break;
          default:
            console.error('API error:', error.message);
        }
        
        throw new Error(error.message);
      }
    
      return res.json();
    }

    For situational awareness only — not for primary navigation. CHRT is not an ECDIS and is not SOLAS-compliant.

    CHRT uses only the cookies and local storage the site needs to work — keeping you signed in, remembering your preferences, and protecting the forms. There is no analytics, no advertising and no cross-site tracking, so there is nothing here to opt out of. Privacy Policy