Errors
Errors from the endpoints use one shape with a matching HTTP status. Branch on code, which is stable.
The error object
JSON
{
"success": false,
"error": {
"code": "validation_failed",
"message": "Campaign name is required.",
"details": [ { "field": "name", "code": "required", "message": "Name is required." } ],
"requestId": "0HN7Q2..."
}
}codeis stable: branch on it.messageis for people and can change.detailslists field-level problems when a request fails validation.requestIdidentifies the request. Quote it when you contact support.
Codes
Status
Code
400
validation_failed, workspace_required, unsupported_version, version_retired401
unauthenticated402
plan_limit_reached403
forbidden404
not_found409
conflict, invalid_state429
rate_limited, quota_exceeded500
internal_error503
service_unavailable401 and 429 from the gateway
Some 401 and 429 responses come from the authentication and rate-limit layers in front of the endpoints. They do not use the error object, so branch on the HTTP status for them:
401: the API key is missing, invalid or revoked. The body is{ "error": "Invalid or revoked API key" }or empty.429: your key or your IP sent too many requests. Wait and retry, and honorRetry-Afterwhen the response carries it.