Errors
Every error has the same shape, whatever the endpoint:
{
"error": {
"code": "invalid_range",
"message": "The range is longer than 366 days.",
"fields": {"stop": ["At most 366 days after start."]}
}
}
| Field |
Always |
Content |
code |
yes |
a stable code, from the list below: the one to use in the program |
message |
yes |
an explanation for a person, in the language of Accept-Language (in English when that language has no translation of it); it may change |
fields |
no |
errors per parameter or field: a flat object, each entry with a list of messages (strings). A nested field has its path with dots and indexes: repeat.until, repeat.on[1], vehicles[1]. non_field_errors: those of the request as a whole |
reason |
no |
with not_allowed only: why, see below |
feature |
no |
with plan_required only: module:get_api |
The program decides on code and on the HTTP status, never on the text of
message.
The codes
| Code |
Status |
When |
invalid_request |
400 |
a parameter or a field is not valid (details in fields), dates outside the years 2000-2100 and dates or ids in non-ASCII digits included; the body is not valid JSON, or is null, a list or a number instead of an object; a malformed Idempotency-Key |
invalid_range |
400 |
stop before start, or a range longer than 366 days |
invalid_key |
401 |
no key, a malformed, unknown or revoked key |
invalid_token |
401 |
MCP only, in place of invalid_key: a missing or expired token, or one of a revoked link (see MCP server) |
expired_key |
401 |
the key has expired |
inactive_user |
401 |
the key's author is deactivated or gone |
plan_required |
402 |
the organization is on the Lite plan |
not_superuser |
403 |
the key's author is no longer an administrator |
missing_scope |
403 |
the key lacks the permission the request needs |
module_not_active |
403 |
the API and AI assistants module is not active |
forbidden |
403 |
the app's rules do not allow this operation on this item |
not_found |
404 |
the address does not exist, or the item does not exist or is not visible to the key's author |
method_not_allowed |
405 |
a method this address does not take |
not_acceptable |
406 |
Accept asks for a format other than JSON |
not_allowed |
409 |
the calendar does not allow the change right now: why in reason |
no_person |
409 |
the key's author has no record in the registry, or their record was removed from it, so cannot sign up for shifts |
idempotency_in_progress |
409 |
the same request, with the same Idempotency-Key, is still running |
unsupported_media_type |
415 |
the body is not sent as application/json (Content-Type header) |
idempotency_key_reused |
422 |
the same Idempotency-Key was used for a different request, even one still running |
rate_limited |
429 |
a per-minute limit was passed: wait for Retry-After |
quota_exceeded |
429 |
the included usage of the month or day is used up: see Limits and usage |
server_error |
500 |
an unexpected error, which reaches us automatically |
service_unavailable |
503 |
the organization's settings cannot be read right now: retry after a minute |
The reasons of not_allowed
They are the calendar's rules, the same the app applies to people signing up
by themselves. They apply to sign-ups and withdrawals, and only to people who
are not staff: a key acts for an administrator, so through the REST API they
are rare. Through the MCP server, where the assistant acts for a volunteer,
they are normal.
reason |
Meaning |
past_shift |
the shift is over |
current_shift |
the shift has already started |
too_close_to_add |
too close to the start to sign up |
too_far_to_add |
too far ahead to sign up |
too_close_to_delete |
too close to the start to withdraw |
too_close_to_change |
too close to the start to leave an overlapping shift |
add_not_allowed |
the calendar does not let people sign up by themselves |
delete_not_allowed |
the calendar does not let people withdraw by themselves |
What to retry
| Status |
Retry? |
| 400, 401, 402, 403, 404, 405, 406, 415, 422 |
no: fix the request or the configuration |
409 idempotency_in_progress |
yes, after Retry-After, with the same Idempotency-Key |
409 not_allowed, no_person |
no |
| 429 |
yes, after Retry-After |
| 500, 503 |
yes, after a few seconds and with growing waits; for a write, with the same Idempotency-Key |