GET /v1/cases/{id} and GET /v1/cases/{id}/cited-by endpoints accept
three different identifier formats. The API tries each in order, and
returns the matched form in the response so you know which one was used.
The three forms
Case ID
HKCFA_2023_5Casebyte’s canonical, opaque ID. Stable across re-imports. Preferred.Neutral citation
[2023] HKCFA 5Official Hong Kong neutral citation. Stable, but contains reserved chars.Action number
FACV 5/2022Court-assigned docket number. Useful when that’s all you have.Case ID (preferred)
Format:COURT_YEAR_NUM, e.g. HKCFA_2023_5, HKCA_2024_127, HKCFI_2022_1843.
This is the canonical identifier returned in every search result and in the
case_id field of every response. Use it whenever you can — it’s URL-safe,
unambiguous, and the lookup is the cheapest of the three (a single indexed
primary-key match in Postgres).
"matched_by": "case_id".
The canonical form is
COURT_YEAR_NUM — three segments, no more. Search
results always return the canonical form, so the safest pattern is to copy
case_id from a search response and use it verbatim for retrieval.Court codes
The court prefix in a case ID matches the official HK court code:
Use these same codes when filtering search results with
?court=. The API
rejects unknown codes with 400 invalid_court and lists the valid set in the
error message — so a typo like ?court=HKMC (no such code) won’t silently
return zero results.
Neutral citation
Format:[YEAR] COURT NUMBER, e.g. [2023] HKCFA 5.
This is the official Hong Kong neutral citation. It contains square brackets
and a space, which must be URL-encoded before being placed in a path
segment:
"matched_by": "neutral_citation".
Action number
Format varies by court, e.g.FACV 5/2022, CACV 145/2023, HCMP 1234/2024.
Action numbers are the docket number assigned by the court when the case is
filed. They contain a forward slash, which must be URL-encoded as %2F:
action_numbers field is an array containing all of them.
The space between the prefix and the number is optional — both
FACV 3/2020 and FACV3/2020 resolve to the same case. URL-encode the slash
either way (%2F) and the space (%20) when present.
The response includes "matched_by": "action_number".
Resolution order
When you callGET /v1/cases/{id}, the API tries the three forms in this
order and returns the first match:
- Case ID — if the input matches
^[A-Z]+_\d{4}_\d+$(regex) - Neutral citation — if the input matches
^\[\d{4}\]\s+[A-Z]+\s+\d+ - Action number — fallback for everything else
404 with error.code = "case_not_found".
Choosing wisely
- Storing references in your own database? Use the case ID. It’s compact, URL-safe, and stable.
- Importing data from another system that uses neutral citations? Pass the citations directly — the API will resolve them.
- All you have is a docket number from court paperwork? Action number works, but call once and store the case ID for future lookups.