Errors

All error responses follow a consistent format with an error message and machine-readable error code.

Error Format

Error Response
{
  "error": "Human-readable error message",
  "code": "MACHINE_READABLE_CODE",
  "details": {}  // Optional additional context
}

Error Codes

HTTPCodeDescription
400VALIDATION_ERRORInvalid request parameters
400CONTENT_BLOCKEDContent violates policy
401UNAUTHORIZEDMissing or invalid API key
402NO_CREDITSInsufficient credits for this action
403FORBIDDENNo permission for this resource
404NOT_FOUNDResource not found
429RATE_LIMITEDToo many requests
500INTERNAL_ERRORUnexpected server error

Common Scenarios

Out of Credits

402 No Credits
{
  "error": "Insufficient credits",
  "code": "NO_CREDITS",
  "details": {
    "needsProfile": false
  }
}

Validation Error

400 Validation Error
{
  "error": "Character ID is required",
  "code": "VALIDATION_ERROR",
  "details": {
    "field": "characterId"
  }
}

Best Practices

  • Always check the HTTP status code first, then the code field for specific error handling
  • Implement exponential backoff for 429 rate limit errors
  • For 402 errors, prompt users to purchase more credits
  • Log 500 errors and report them — they indicate a bug on our end