REST API
Errors
When the REST API refuses a request, it answers with an HTTP status and a JSON body that says what went wrong. This article describes the body, the stable reason values you can program against, and the status codes to expect.
The error body
Section titled “The error body”Every error, including one for a request that was not sent as JSON, has the same shape:
{ "error_code": 400, "reason": "filter_value_unknown", "message": "unknown filter value: state_eq=reserved"}error_coderepeats the HTTP status.reasonis a stable string, present only where the status alone does not say what to do.messageis written for a person and names the parameter at fault. Its wording can change, so do not parse it.
Switch on reason where it is present and fall back to error_code where it is not.
Reasons
Section titled “Reasons”For filters, searches and sorting:
reason |
Meaning |
|---|---|
filter_unknown |
the listing does not filter on this field, or the predicate is unknown |
filter_value_unknown |
the value is not a member of the field’s fixed set |
filter_unavailable |
the field cannot answer this comparison, typically an encrypted field |
search_field_unknown |
_search on a field without a search index |
sort_field_unknown |
q[s] names a field this listing does not sort on |
For the /aggregate routes, the reason names what was wrong with group_by, aggregate or the range, for example unknown_group_by, bucket_required, unknown_period, unknown_aggregate_field, range_reversed or too_many_groups. The message lists the values that would have been accepted. See Aggregation.
Status codes
Section titled “Status codes”| Status | Meaning |
|---|---|
400 |
the request is malformed or a parameter is not acceptable, for example per_page above 100 or a filter the listing does not offer |
401 |
the token is missing, unknown or belongs to a paused integration |
403 |
the token is valid but lacks the permission the operation needs |
404 |
the record does not exist, or it belongs to a site outside your integration’s restriction |
422 |
the record was rejected, for example because an external_id is already taken; message says why |
429 |
too many requests in a short time; wait for Retry-After and repeat, see Rate limits |
500 |
an error on sedisto’s side |
503 |
the search index is unavailable for a _search filter; retry later |
The webhook endpoint routes can also answer 502 or 503 when the delivery provider is unreachable.
A 404 deliberately looks the same for a record that does not exist and for one you may not see. Its message names the kind of record and the ID you asked for, for example Couldn't find Unit with id=....
A 403 names the missing permission in message. Authentication and permissions explains tokens and permissions.
Retrying
Section titled “Retrying”Retry 429 after the seconds in Retry-After, and 500, 502 and 503 with a delay. Do not retry 400, 401, 403, 404 or 422 unchanged: the same request will be refused again.