Errors
Every refusal is a JSON problem with a stable code your code can read.
A refused call answers an HTTP error status with an RFC 9457 problem, as
application/problem+json:
{
"type": "about:blank",
"title": "Forbidden",
"status": 403,
"code": "insufficient_scope",
"detail": "create_with_awen needs a key with awen:create and awen:write. Make a key with that access in Settings."
}Read code in your code, and show detail to people. Codes are only ever added. Some problems carry more:
issues, withinvalid_request: where each invalid argument is and why, never the value it held.retry_after_seconds, withrate_limitedandbusy: how long to wait, as theRetry-Afterheader says.limit, withrate_limited: the limit the call went over, asscope(key,organisationoraddress),unitsandwindow_seconds.
Codes
| Status | code | Means |
|---|---|---|
| 400 | invalid_json | The body is not JSON. |
| 400 | invalid_request | The arguments are not valid; issues lists them. |
| 400 | idempotency_key_required | create_with_awen needs an Idempotency-Key header. |
| 401 | missing_api_key | The call has no Authorization header. |
| 401 | invalid_api_key | The key is mistyped, revoked or expired. |
| 403 | browser_not_allowed | A browser sent the call. Call from a server. |
| 403 | unavailable | The API is not open to your account yet. |
| 403 | access_off | An Owner turned assistant and API access off. |
| 403 | plan_required | The organisation's plan does not include API access. |
| 403 | membership_suspended | Your access to the organisation is suspended. |
| 403 | insufficient_scope | The key lacks the permission this operation needs. |
| 404 | unknown_operation | No operation has this name. |
| 404 | not_found | An id in the arguments names nothing you can reach. |
| 409 | conflict | The request conflicts with the current state, such as a name in use. |
| 409 | limit_reached | A limit is reached, such as a full project. |
| 413 | payload_too_large | The body is larger than the operation accepts. |
| 415 | unsupported_media_type | Send Content-Type: application/json. |
| 422 | refused | The request is valid, but Awen cannot do it; detail says why. |
| 429 | rate_limited | Over a rate limit; limit names it. Wait retry_after_seconds. See Limits. |
| 500 | internal_error | Awen failed. We are told; try again later. |
| 503 | busy | Awen is busy and started nothing. Wait retry_after_seconds. |
| 503 | not_configured | The API is not available right now. |
| 504 | timeout | The operation took too long. |
Retrying
Retry 429 and 503 after retry_after_seconds, and 504 after a few seconds. Send
create_with_awen again with the same Idempotency-Key, so a retry never charges twice. Do not retry other codes
unchanged: they give the same answer.