Skip to main content

API errors

When a request fails, the API responds with a 4xx or 5xx HTTP status and a JSON body that describes the error. The format is the same for all methods.

Response format​

400 response
{
"code": "BadRequest",
"error": "Missing required field 'name'",
"param": "name",
"rule": "missing_required_field",
"request_id": "2qNfB7c4XkPZ1mVd8sHwR3tYgLe"
}
FieldContents
codeError code, such as NotFound or PlanLimitReached. Check this field in your code, not the text.
errorHuman-readable description in English. The text may change, and sometimes it is empty: rely on code then.
request_idRequest ID, the same as in the X-Request-ID header. See Request ID.
documentation_urlLink to the documentation page about this error. Not every error has one.
paramValidation errors only: the request field that failed validation.
ruleValidation errors only: the rule that was broken.

Validation errors​

If a field in the request body fails validation, the API responds with 400, code BadRequest, and adds the param and rule fields. The response always describes one error, for the first invalid field. Fix it and send the request again: if several fields are invalid, you will get an error for the next one.

Common rule values:

ruleWhat is wrong
missing_required_fieldA required field is missing.
below_minimum, above_maximumThe value or string length is out of the allowed range.
invalid_enum_valueThe value is not in the list of allowed values.
invalid_email, invalid_uuid, invalid_urlInvalid email address, UUID or URL format.
invalid_hostname, invalid_fqdnInvalid host or domain name.
invalid_cronInvalid cron expression.

HTTP status codes​

StatusCommon code valuesWhat to do
400BadRequestCheck the request parameters and body. error, param and rule give a hint.
401AuthorizationRequiredThe request has no API key, or the key is invalid. Check the Authorization: Bearer … header and that the key has not been revoked.
402PaymentRequired, PlanLimitReachedThe feature is not available on your plan, or you have reached a plan limit.
403ForbiddenInsufficient permissions: either your team role or the key itself lacks them.
404NotFoundThe object was not found. Check the ID: the object may belong to another team.
409Conflict, SlugTakenThe request conflicts with the current state, for example, the name is already taken.
429TooManyRequests, RateLimitedA limit was exceeded. Wait and retry, see Rate limits.
500InternalServerErrorAn error on our side. Retry the request later. If the error persists, contact support.
503ServiceUnavailableThe service is temporarily unavailable. Retry the request in a few seconds.

Request ID​

Every API response, successful or not, has an X-Request-ID header. We use it to find the request in our logs. If you contact support about an error, include the request_id from the response.

You can send your own X-Request-ID with the request: the API returns it in the response and writes it to the logs. This makes it easier to match the request with your application's logs.

curl -i -H "Authorization: Bearer {API-key}" \
-H "X-Request-ID: deploy-2026-12-05-001" \
https://api.tuna.am/v1/user