Always switch on
error.code, never on error.message.
Error codes
400 Bad Request
401 Unauthorized
404 Not Found
429 Too Many Requests
500 Internal Server Error
Retry strategy
A simple, well-behaved retry loop:
Common pitfalls
I'm getting case_not_found for a case I know exists
I'm getting case_not_found for a case I know exists
The most common cause is the wrong identifier format. Check:
- Did you URL-encode square brackets in a neutral citation?
[2023] HKCFA 5must be sent as%5B2023%5D%20HKCFA%205. - Did you URL-encode the slash in an action number?
FACV 5/2022must be sent asFACV%205%2F2022. The space is optional —FACV5%2F2022resolves to the same case. - Is the case ID in canonical form? Case IDs are
COURT_YEAR_NUM(e.g.HKCFA_2023_5). Anything with extra trailing segments will not match.
My boolean query is being treated as plain text
My boolean query is being treated as plain text
Boolean operators must be uppercase with whitespace around them.
tort and breach searches for the literal words tort, and, breach. tort AND breach is a boolean query. See Search syntax.I keep getting 429 even though I'm only making a few requests
I keep getting 429 even though I'm only making a few requests
The limit is per API key, not per IP. If you have multiple processes sharing the same key (e.g. a worker pool), they share the budget. Issue separate keys per worker if you need to parallelise.
Search returns 0 results for a query I expect to match
Search returns 0 results for a query I expect to match
Try in this order:
- Drop court / date filters and search the whole corpus.
- Switch from a phrase (
"...") to a plain match query. - If the case name is uncommon, try
scope=case_name(fuzzy match enabled). - Check
start/end— dates outside the corpus return 0.
Daily summary errors
Daily also uses
invalid_date, invalid_int, invalid_range and
invalid_identifier, plus the shared authentication and rate-limit errors.
See Daily summaries for exact date semantics.