Error Format

All CueAPI errors follow a consistent JSON structure.

Error envelope

Every error response uses this structure:

json
{
  "error": {
    "code": "string",
    "message": "string",
    "status": 400
  }
}
FieldTypeDescription
codestringMachine-readable error code (e.g., cue_not_found)
messagestringHuman-readable description
statusintegerHTTP status code

HTTP status codes

CodeMeaning
400Bad request — invalid input
401Unauthorized — missing or invalid API key
403Forbidden — plan limit exceeded
404Not found — resource doesn't exist
409Conflict — duplicate or already exists
413Payload too large — body exceeds 2 MB
422Unprocessable — validation error (e.g., unknown fields)
429Too many requests — rate limit exceeded
500Internal server error
502Bad gateway — upstream service error (e.g., Stripe)

Validation errors (422)

FastAPI/Pydantic validation errors use a different format:

json
{
  "detail": [
    {
      "type": "missing",
      "loc": ["body", "name"],
      "msg": "Field required",
      "input": {}
    }
  ]
}

Handling errors

python
response = requests.post(url, headers=headers, json=body)
 
if response.status_code >= 400:
    error = response.json().get("error", {})
    print(f"Error {error.get('code')}: {error.get('message')}")