Guides
Errors
A failed request returns a 4xx or 5xx status and a JSON body that says what went wrong. Every error has the same shape.
The error body
{
"error": {
"code": "not_found",
"message": "The resource does not exist, or this API key cannot see it.",
"request_id": "2f9d6c1e-7a4b-4d3c-8e5f-1a2b3c4d5e6f"
}
}| Field | Description |
|---|---|
errorobject | |
error.codestring | A stable, machine-readable error code. One of |
error.messagestring | A description for people. The wording may change. |
error.detailsobject[]optional | For |
error.details[].fieldstringoptional | |
error.details[].messagestringoptional | |
error.request_idstring | nulloptional | Quote this when contacting support. |
For invalid_request, details names the fields that failed validation:
{
"error": {
"code": "invalid_request",
"message": "The request is not valid.",
"details": [
{
"field": "title",
"message": "Invalid value."
}
],
"request_id": "2f9d6c1e-7a4b-4d3c-8e5f-1a2b3c4d5e6f"
}
}Error codes
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request | A parameter or the request body is missing or not valid. details lists the fields that failed. |
| 401 | unauthorized | The API key is missing, invalid, revoked or expired. |
| 403 | insufficient_scope | A read-only key was used for a request that writes. |
| 403 | forbidden | The key's owner is not allowed to make this change. |
| 404 | not_found | The resource does not exist, or this API key cannot see it. |
| 409 | conflict | The request conflicts with the current state of the resource. |
| 429 | rate_limited | Too many requests. Wait for the time given in Retry-After, then try again. |
| 500 | internal_error | Something went wrong on SlimWiki's side. |
Two codes share the status 403. insufficient_scope is about the key: it is read-only and the request writes. forbidden is about the person: the key's owner is not allowed to make the change. See Authentication.
404 also means “not visible to this key”
404 not_found is returned when a resource does not exist, and also when it exists but the key cannot see it. The response does not tell the two cases apart.
If a request for something you know exists returns 404, check that the key's owner has access to it in SlimWiki.
Handling errors
- Decide what to do from
code, together with the HTTP status. Codes are stable. - Show or log
message, but do not match on it. Its wording may change. - Log
request_idand quote it when you contact support. - On
429 rate_limited, wait before retrying. See Rate limits.