Skip to content

Error response shape

All errors return a consistent JSON body:

json
{
  "success": false,
  "error": {
    "message": "Human-readable description",
    "code": "ERROR_CODE"
  }
}

HTTP status codes

StatusMeaning
200Success
400Bad request — invalid input (see message for details)
401Unauthorized — missing or invalid API key
402Insufficient credits
403Forbidden — endpoint requires a higher plan
404Profile not found
422Validation error — request body failed validation
429Rate limit exceeded
500Server error

Common errors

Invalid API key

http
HTTP/1.1 401 Unauthorized

{
  "error": { "message": "Invalid or revoked API key" }
}

Insufficient credits

http
HTTP/1.1 402 Payment Required

{
  "error": { "message": "Insufficient credits. Required: 5, available: 2" }
}

Rate limit exceeded

http
HTTP/1.1 429 Too Many Requests

{
  "error": { "message": "Rate limit exceeded. Try again in 8 seconds." }
}

Validation error

http
HTTP/1.1 422 Unprocessable Entity

{
  "error": {
    "message": "Validation failed",
    "details": ["profileId must be a MongoDB ObjectId"]
  }
}

Rate limit headers

Every response includes:

http
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 57
X-RateLimit-Reset: 1716700860

X-RateLimit-Reset is a Unix timestamp indicating when the window resets.

Retrying

For 429 responses, wait until X-RateLimit-Reset before retrying. For 500 errors, use exponential backoff starting at 1 second.