Mixedbread

Error Handling

Common Status Codes

Understanding the status codes returned by the API is the first step in handling responses correctly. Here are the most common codes you might encounter:

CodeMeaningDescription
200OKRequest successful. The response contains the requested data.
201CreatedResource successfully created. Common for POST requests.
400Bad RequestMalformed request or missing required parameters.
401UnauthorizedInvalid, expired, or missing API key.
402Payment RequiredInsufficient balance. Top up your account to continue.
403ForbiddenValid credentials but insufficient permissions for this resource.
404Not FoundThe requested resource doesn't exist.
409ConflictOperation conflicts with current resource state.
422Unprocessable EntityRequest format is correct but cannot be processed.
429Rate Limit ExceededToo many requests. Wait before retrying.
500Internal Server ErrorUnexpected server error. Retry after a brief wait.
503Service UnavailableService temporarily down for maintenance or overloaded. Retry later.

Best Practices

Build reliable applications with these error handling patterns:

  1. Catch specific errors first - Handle specialized error types before generic exceptions
  2. Check status codes early - Validate response status before processing the body
  3. Implement smart retries - Use exponential backoff for transient errors

Code Examples

Last updated: September 10, 2025