← Blog

Claude API Error Code Reference List (Full Guide)

2026-11-13 · 5 min read · SubToAPI Team

When a request to the Claude API fails, you get back an HTTP status code and a JSON body with an error.type field. This article lists every error code you'll encounter, what triggers it, and how to handle it in production code.

The short version: Claude's API errors fall into eight categories — invalid_request_error, authentication_error, permission_error, not_found_error, request_too_large, rate_limit_error, api_error, and overloaded_error. Each maps to a specific HTTP status and requires a different fix. The table below covers all of them, followed by a working retry pattern.

Full error code reference

| HTTP Status | error.type | Meaning | Typical fix | |---|---|---|---| | 400 | invalid_request_error | Malformed request — bad JSON, wrong field type, missing required parameter | Validate payload against the API schema before sending | | 401 | authentication_error | Missing or invalid API key | Check the Authorization/x-api-key header is set and the key is active | | 403 | permission_error | Key is valid but lacks permission for this resource or model | Confirm the key's scope and the organization's model access | | 404 | not_found_error | Requested resource (e.g., a model ID) doesn't exist | Check model name spelling and availability | | 413 | request_too_large | Request body exceeds the size limit | Reduce prompt size, trim conversation history, or split the request | | 429 | rate_limit_error | Too many requests or tokens per minute for your tier | Back off and retry; consider upgrading your rate limit tier | | 500 | api_error | Unexpected error on Anthropic's infrastructure | Retry with backoff; if persistent, check status page | | 529 | overloaded_error | API is temporarily over capacity | Retry with exponential backoff |

A typical error response body looks like this:

{
  "type": "error",
  "error": {
    "type": "invalid_request_error",
    "message": "messages: at least one message is required"
  }
}

Always parse error.type, not just the HTTP status — some integrations only check the status code and miss useful detail in the message field.

invalid_request_error (400): the most common one

This covers a wide range of malformed-request issues:

The fix is almost always in your request construction, not a transient issue — retries won't help. Log the full error message; it usually names the exact field that failed validation.

curl https://api.anthropic.com/v1/messages \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model": "claude-sonnet-4-5", "messages": []}'
# -> 400 invalid_request_error: messages: at least one message is required

authentication_error and permission_error (401 / 403)

A 401 means the key itself is the problem — expired, revoked, or malformed. A 403 means the key is fine but doesn't have access to what you're asking for (e.g., a model not enabled on your plan, or an organization-level restriction).

These are not retryable. If you're seeing intermittent 401s across a fleet of services, the likely cause is a key rotation that didn't propagate everywhere, or an environment variable being read before it's set.

rate_limit_error (429): the one you'll see most in production

Claude enforces limits on requests per minute and tokens per minute, scaled to your usage tier. When you hit either, you get a 429 with a retry-after header indicating how long to wait.

async function callWithBackoff(fn, maxRetries = 5) {
  for (let attempt = 0; attempt < maxRetries; attempt++) {
    try {
      return await fn();
    } catch (err) {
      if (err.status === 429 || err.status === 529) {
        const delay = Math.min(2 ** attempt * 1000, 30000);
        await new Promise(r => setTimeout(r, delay));
        continue;
      }
      throw err;
    }
  }
  throw new Error("Max retries exceeded");
}

If 429s are frequent even under normal load, it's usually a sign your account is on a lower rate-limit tier than your traffic needs, or you have multiple services sharing one key without coordinated throttling.

overloaded_error (529) and api_error (500)

Both are server-side and both are safe to retry with exponential backoff. The difference: api_error suggests something genuinely went wrong on Anthropic's side (worth checking their status page if it persists), while overloaded_error is capacity-related and usually clears within seconds.

Never retry these in a tight loop — that makes overload worse. Use jittered exponential backoff, cap retries at 3-5 attempts, and surface a clear error to the end user if retries exhaust.

Why error handling gets harder at scale

A single integration checking error types is manageable. The problem shows up when you have multiple apps, each with its own retry logic, its own key management, and its own interpretation of what counts as a "transient" vs "permanent" error. Debugging becomes: which app, which key, which error, at what time.

This is one of the practical reasons teams put SubToAPI in front of their Claude usage. Every request through SubToAPI gets normalized logging — you see the error type, status, request, and which application key triggered it, in one dashboard, instead of grepping logs across services. It also gives each application its own sub_live_... key, so a bad deploy in one app's retry logic doesn't get conflated with another app's traffic when you're diagnosing a spike in 429s or 500s. See the docs or the quickstart for setup, and pricing if you're evaluating it for a team.

A minimal error-handling checklist

Questions

What does a 529 error mean in the Claude API? It means overloaded_error — the API is temporarily over capacity. It's not caused by your request; retry with exponential backoff and it will typically succeed within a few attempts.

How do I know if a 429 is a request-rate or token-rate limit? The error message in the response body specifies which limit was exceeded (requests per minute vs tokens per minute). Check the retry-after header for how long to wait before retrying.

Should I retry every error type? No. Only retry rate_limit_error, api_error, and overloaded_error. Errors like invalid_request_error, authentication_error, and permission_error won't resolve on retry — they require fixing the request or credentials.

Turn your Claude access into an HTTPS API

SubToAPI gives you application API keys, streaming, tool use and usage insights on top of your existing Claude access — set up in minutes.

Start free  Read the quickstart →