Errors
What the API returns when a request cannot be fulfilled.
The API uses standard HTTP status codes. Anything other than 200 means you did not
get a record, and the body describes why.
Status codes
| Code | Meaning |
|---|---|
200 | Success. |
400 | The request was malformed — for example a detail route with an empty identifier. |
404 | No record matched, or the collection does not exist. |
500 | Something broke on our end. Please open an issue. |
Error body
statusMessage has a bit of personality. The precise, boring explanation is always
in data.reason — that is the field to read when you are debugging or logging.
The messages
| Code | statusMessage |
|---|---|
400 | That incantation was mispronounced. Check your wand movement and try again. |
401 | The Fat Lady demands the password. |
403 | Underage Wizardry detected! The Ministry of Magic has been notified. |
404 | Peeves has hidden this page. Try checking the trophy room. |
418 | I am currently a transfigured teapot (McGonagall's class went wrong). |
429 | Too many owls! Our owlery is currently flooded with mail. |
500 | A rogue Bludger has hit the server. Our house-elves are working on it. |
The API is public, read-only and unthrottled, so in practice you will only ever
meet 400, 404 and — if we have broken something — 500. The rest are
implemented and waiting.
Except one. 418 has a home:
It is the only endpoint that never succeeds.
Handling errors
Check the status before reading data — on an error response there is no data key,
so destructuring it gives you undefined rather than a thrown error.
A common mistake is treating a 404 as an empty result. const { data } = await res.json()
on an error response leaves data as undefined, and undefined.name throws further
down your code with a confusing message. Check res.ok first.
Things that are not errors
- A search with no matches returns
200with"data": []and"total_records": 0. That is a successful request that found nothing. - A
pagepast the end is clamped to the last page and returns200. - A
page_sizeabove 100 is clamped to 100 and returns200.

