Errors
HTTP status codes and error shapes.
HTTP status codes
| Status | Meaning |
|---|---|
200 | Success. The response body contains the result. |
202 | Report accepted. Poll with GET /api/v1/reports/{request_id}. |
400 | The request body is malformed or a field is invalid. |
401 | Missing, invalid, or revoked API key. |
402 | Insufficient credits to start the report. |
404 | The request_id does not exist or belongs to another account. |
500 | Internal server error. Retry the request. |
Error shapes
Validation errors (400) return a message field:
{
"message": "options must contain between 2 and 20 items."
}Insufficient credits (402) return a structured error with your current balance:
{
"error": {
"code": "insufficient_credits",
"message": "Insufficient credits: 50 available, 100 required.",
"credits_left": 50
}
}Failed reports embed an error object in the status response:
{
"request_id": "req_4f3a9c21e8b7d6c5",
"status": "failed",
"error": {
"code": "report_generation_failed",
"message": "Sampling failed. Please retry."
}
}Retries
500errors are safe to retry.- A failed report can be resubmitted as a new
POST /api/v1/reportsrequest. Credits are only settled for reports that actually sample respondents; a failed pipeline releases its reservation.