NZLII APInzlii.org ↗
Search New Zealand court and tribunal decisions on NZLII by case name or citation, and retrieve full judgment text with PDF and RTF download links.
What is the NZLII API?
The NZLII API gives programmatic access to New Zealand legal decisions across three endpoints: search by case name, search by citation, and retrieve a full judgment. The get_case endpoint returns 12 fields per decision including the full plain-text judgment, neutral citation, decision date, court name, and direct URLs for PDF and RTF downloads from the New Zealand Legal Information Institute.
curl -X GET 'https://api.parse.bot/scraper/2136ce2d-cee6-4ca4-868f-da3bd6c0c69d/search_cases?sort=relevance&query=smith+v+police' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace nzlii-org-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
"""Walkthrough: search NZ case law on NZLII, then fetch the full decision text."""
from parse_apis.nzlii_org_api import Nzlii, SortOrder, CaseNotFound
client = Nzlii()
# Search for cases by name, sorted by most-cited, capped at 5 results.
for case in client.cases.search(query="smith v police", sort=SortOrder.CITED_MOST, limit=5):
print(case.title, "|", case.citation, "| cited:", case.citation_count)
# Take the first hit and retrieve the full decision text.
hit = client.cases.search(query="commerce commission", court="NZHC", sort=SortOrder.DATE_LATEST, limit=1).first()
if hit is not None:
try:
decision = client.decisions.get(citation=hit.citation)
except CaseNotFound:
decision = None
if decision is not None:
print(decision.title)
print(" court:", decision.court, "| year:", decision.year)
print(" text preview:", decision.text[:120])
print(" pdf:", decision.pdf_url)
# Look up cases by citation.
for match in client.cases.search_by_citation(citation="[2019] NZCA 219", limit=3):
print(match.title, "|", match.court, "|", match.date)
print("exercised: cases.search / decisions.get / cases.search_by_citation")
Searches NZLII case-law databases by case name: the query is matched against decision titles (e.g. 'smith v police'), not full text. Returns one page of 10 result rows (the site's fixed page size), each with the decision title, neutral citation, court database code and name, year, decision number, decision date as shown on the site, document size, LawCite citation count, relevance percentage (present only for the relevance sort, null otherwise) and the decision URL. total_documents is the site's reported match count across all pages. Paging is by offset: pass next_offset from the previous response; has_more is false on the last page. The same decision can appear more than once when the site indexes multiple versions of it. An unknown court code or a name with no matches returns an empty results array with total_documents 0.
| Param | Type | Description |
|---|---|---|
| sort | string | Result ordering. |
| court | string | NZLII court/tribunal database code to restrict the search to, as it appears in court_code of results (confirmed: NZCA, also NZHC, NZSC, NZDC, NZFC, NZEmpC, NZEnvC among the site's advanced-search list). Alphanumeric only. Omitted = all case-law databases. |
| queryrequired | string | Case name or words from the decision title, e.g. 'smith v police'. |
| offset | integer | Zero-based index of the first result row to return; use next_offset from the previous page. Pages hold 10 rows. |
{
"type": "object",
"fields": {
"sort": "sort order applied",
"court": "court code filter applied, or null when searching all case databases",
"query": "the case-name query as searched",
"offset": "integer, offset of this page",
"results": "array of decision rows: title, citation (neutral citation), court_code, court (database name), year (integer), decision_number (string), date (as shown, e.g. '13 June 2019'), size, citation_count (integer LawCite count), relevance_percent (integer or null), url",
"has_more": "boolean, whether another page exists",
"page_size": "integer, fixed at 10",
"next_offset": "integer offset for the next page, or null on the last page",
"total_documents": "integer, the site's total match count across all pages"
},
"sample": {
"data": {
"sort": "relevance",
"court": "NZCA",
"query": "smith v police",
"offset": 0,
"results": [
{
"url": "https://www.nzlii.org/cgi-bin/viewdoc/nz/cases/NZCA/2019/219.html",
"date": "13 June 2019",
"size": "6.35 KB",
"year": 2019,
"court": "Court of Appeal of New Zealand - Te Kōti Pīra",
"title": "Smith v Police [2019] NZCA 219 (13 June 2019)",
"citation": "[2019] NZCA 219",
"court_code": "NZCA",
"citation_count": 1,
"decision_number": "219",
"relevance_percent": 100
},
{
"url": "https://www.nzlii.org/cgi-bin/viewdoc/nz/cases/NZCA/1979/95.html",
"date": "21 November 1979",
"size": "5.08 KB",
"year": 1979,
"court": "Court of Appeal of New Zealand - Te Kōti Pīra",
"title": "Smith v Police CA113/79 [1979] NZCA 95 (21 November 1979)",
"citation": "[1979] NZCA 95",
"court_code": "NZCA",
"citation_count": 0,
"decision_number": "95",
"relevance_percent": 100
}
],
"has_more": false,
"page_size": 10,
"next_offset": null,
"total_documents": 3
},
"status": "success"
}
}About the NZLII API
Search and Retrieval
The search_cases endpoint accepts a query string matched against decision titles — for example 'smith v police' — and returns up to 10 results per page. Each result row includes the decision title, citation (neutral citation), court_code, court (database name), year, and decision_number. An optional court parameter restricts results to a single NZLII court or tribunal database code. Pagination is handled via the offset parameter and the next_offset value returned in each response; total_documents gives the full match count across all pages.
Citation Lookup
search_by_citation works the same way but matches against a citation string such as '[2019] NZCA 219'. Brackets are optional and whitespace is normalised before matching. This is useful when you have a citation from another source and need to resolve it to an NZLII record. It returns the same page structure — results, has_more, next_offset, total_documents — and supports the same court filter.
Full Decision Data
get_case accepts either a url (from search results) or a citation string and returns the complete judgment. Response fields include text (full plain-text judgment with line breaks), pdf_url and rtf_url (direct download links, null when the site offers none), pdf_size as labelled on the page, date (decision date from the title string), last_updated (the site's printed last-updated date, or null), court, year, title, and citation.
Coverage and Limitations
All three endpoints cover only case-law databases on NZLII. Search matches against decision titles, not the full text of judgments. The fixed page size is 10 results; there is no way to request a larger page. get_case returns text as it appears on the decision page and does not parse or structure individual judgment sections.
The NZLII API is a managed, monitored endpoint for nzlii.org — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when nzlii.org changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official nzlii.org API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Build a case-law research tool that resolves a neutral citation to the full judgment text via
get_case. - Aggregate New Zealand Court of Appeal decisions by year using
search_caseswith acourtfilter and theyearfield. - Automate citation verification by cross-referencing a list of citations through
search_by_citationand checkingtotal_documents. - Construct a decision archive by paginating
search_caseswithoffsetand storingpdf_urllinks for bulk PDF retrieval. - Power a legal search interface that surfaces
title,citation,court, andyearfrom case-name queries. - Check whether a PDF version of a judgment exists before rendering it, using the
pdf_urlandpdf_sizefields fromget_case.
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 200 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
| Team | $300/mo | 20,000 | 300 req/min |
| Company | $1,000/mo | 100,000 | 500 req/min |
Each endpoint has a fixed posted price per successful call — most fall between 1 and 10 credits — shown on this API's page before you run it. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does NZLII offer an official developer API?+
What does `search_cases` return, and how is it different from `search_by_citation`?+
search_cases matches your query string against decision titles and is intended for case-name lookups like 'smith v police'. search_by_citation matches a citation string such as '[2019] NZCA 219' against titles. Both return the same result shape — title, citation, court_code, court, year, decision_number — but are optimised for different lookup patterns. Neither searches full judgment text.Does the API cover legislation, law reform reports, or other NZLII content beyond case law?+
Can I retrieve more than 10 results at once?+
next_offset value from the current response as the offset parameter in your next request. has_more tells you whether another page exists, and total_documents gives the full match count.Is the decision date always available in `get_case`?+
date field is parsed from the decision title string (for example '13 June 2019'). When the title does not include a date in that position, the field returns null. Similarly, last_updated returns null when the site does not print a last-updated date on the decision page.