Skip to main content
A
Docs

Error codes

The HTTP status codes that the Anar product APIs return, what each status means, and what to do next when you get one.

Status codes

StatusMeaningWhat to do
400The request is not valid. For example, a file type is not supported.Read detail and correct the request.
401The token is missing, expired or not valid.Get a new token and send it again.
402A Gateway budget is used up.Wait for the budget to reset, or ask your administrator.
403Your role cannot do this action, or a policy blocked the content.Ask your administrator for the role, or change the content.
404The item does not exist, or it belongs to another tenant.Check the identifier.
409The action conflicts with the state of the item. For example, a tender no longer accepts bids.Read detail. Get the item again and check its state.
422One or more fields are not valid.Correct the fields listed in detail.
429A rate limit is reached.Wait and send the request again.
500The product had an internal error.Try again. If it continues, contact Anar support with the time of the request.
502, 503A service that the product needs did not answer. For example, the model provider or Guard.Try again later.

Validation errors

A 422 response lists each field in error:

{
  "detail": [
    {
      "loc": ["body", "title"],
      "msg": "String should have at least 1 character",
      "type": "string_too_short"
    }
  ]
}

Role errors

A 403 response for a missing role names the roles that can do the action:

{"detail": "Role 'user' not authorized. Requires: admin, manager"}

Gateway errors

The Gateway uses its own error format. Read Gateway API reference.