The Free Law Project CourtListener REST API v4 (https://www.courtlistener.com/api/rest/v4): search across case law and RECAP (PACER) records, dockets, docket entries, opinions and clusters by id, and the court list.

Auth: Authorization: Token <token>, from a free CourtListener account. Set courtlistener.api-token or pass {api-token: ...} per call. Every call here needs a token except courts and court.

Rate limits: by default 5 requests per minute, 50 per hour and 125 per day per account, on rolling windows that all apply at once. A Free Law Project membership raises them. A 429 carries retry-after in the HttpError.

Paging: responses carry count, next and previous, where next holds a cursor or page parameter. next-params reads it and collect follows it, always against the configured base-url.

Context Vars

Optional
  • courtlistener.api-token
  • courtlistener.base-url

Functions

auth-header

fn (token: Str): Str

Token <token>, the Authorization value CourtListener expects (pure).

Example

token ::hot::ctx/get("courtlistener.api-token")
headers {Authorization: ::courtlistener/auth-header(token)}

cluster

fn (id: Any): Map?
fn (id: Any, opts: Map): Map?

One opinion cluster by id, or null when there is none. The id in a CourtListener opinion URL is a cluster id. sub_opinions links the cluster's opinions and docket its parent.

Example

::cl ::courtlistener
c ::cl/cluster(2812209)
if(is-null(c), null, ::cl/resource-id(c.docket))

collect

fn (fetch: Fn, opts: Map, limit: Int): Any

Follow pages until limit items or the last page. fetch takes opts (with cursor or page set) and returns one page. An Err on any page, such as a 429, is returned in place of the items.

The default limit of 5 requests a minute applies to every page, so keep limit small or raise the account's limits.

Example

entries ::courtlistener/collect((o) { ::courtlistener/docket-entries(4214664, o) }, {order-by: "id"}, 40)

court

fn (id: Str): Map?
fn (id: Str, opts: Map): Map?

One court by id ("scotus", "ca9"), or null when there is none. Works without a token, and sends one when set.

Example

ninth ::courtlistener/court("ca9")
if(is-null(ninth), null, ninth.full_name)

courts

fn (): Map
fn (opts: Map): Map

One page of courts and jurisdictions, with their ids. Works without a token, and sends one when set.

Example

page ::courtlistener/courts({filters: {jurisdiction: "F"}})
map(page.results, %.id)

docket

fn (id: Any): Map?
fn (id: Any, opts: Map): Map?

One docket by id, or null when there is none. opts.fields and opts.omit trim the record.

Example

d ::courtlistener/docket(4214664, {fields: ["id", "case_name", "court"]})
if(is-null(d), "no such docket", d.case_name)

docket-entries

fn (docket-id: Any): Map
fn (docket-id: Any, opts: Map): Map

One page of the entries on a docket (/docket-entries/?docket=). opts.filters adds API filters, such as {date_filed__gte: "2026-01-01"}. The Free Law Project lists some APIs as available to select users only; a 403 here means this account lacks access.

Example

page ::courtlistener/docket-entries(4214664, {filters: {date_filed__gte: "2026-01-01"}, order-by: "date_filed"})
map(page.results, %.description)

dockets

fn (filters: Map): Map
fn (filters: Map, opts: Map): Map

One page of dockets matching filters, a Map of API filters. Docket numbers are not unique, so pair docket_number with court.

Example

page ::courtlistener/dockets({court: "dcd", docket_number: "1:16-cv-00745"})
first(page.results).case_name

next-params

fn (page: Any): Map?

The opts that fetch the page after page, from its next URL (pure): {cursor: ...}, {page: n}, or null on the last page. Only the parameter is read, so a next call goes to the configured base-url and the token never follows a URL from a response.

Example

::courtlistener/next-params({next: "https://www.courtlistener.com/api/rest/v4/search/?cursor=abc&type=o"})  // {cursor: "abc"}
::courtlistener/next-params({next: "https://www.courtlistener.com/api/rest/v4/dockets/?page=3"})  // {page: 3}
::courtlistener/next-params({next: null})  // null

opinion

fn (id: Any): Map?
fn (id: Any, opts: Map): Map?

One opinion by id, or null when there is none. Opinion ids do not match cluster ids. Prefer html_with_citations for the text.

Example

o ::courtlistener/opinion(3197342, {fields: ["id", "html_with_citations"]})
if(is-null(o), null, o.html_with_citations)

refine-params

fn (opts: Map): Map

The query refinement parameters from opts (pure): fields and omit (a Vec or a comma-separated Str, __ for nested fields), order-by, cursor and page. Unset values stay null and drop out of the query string.

Example

::courtlistener/refine-params({fields: ["id", "case_name"]}).fields  // "id,case_name"
::courtlistener/refine-params({order-by: "id"}).order_by  // "id"

resource-id

fn (url: Any): Int?

The numeric id at the end of a v4 resource URL, as an Int, or null (pure). Clusters, opinions and docket entries link their parents by URL.

Example

::courtlistener/resource-id("https://www.courtlistener.com/api/rest/v4/dockets/4214664/")  // 4214664
fn (q: Str): Map
fn (q: Str, opts: Map): Map

Search CourtListener (/search/). opts.type picks the index: o case law (the default), r federal cases with up to three nested documents, rd federal filing documents, d federal cases only, p judges, oa oral arguments. Returns the page: count, next, previous and results. Filter with fielded terms in q, such as court_id:scotus and dateFiled:[2026-01-01 TO 2026-06-30].

Example

page ::courtlistener/search("\"data breach\" court_id:ca9", {order-by: "dateFiled desc"})
first(page.results).caseName

search-dockets

fn (q: Str): Map
fn (q: Str, opts: Map): Map

Search federal cases only (type=d), without filing metadata. Above 2,000 results count is an estimate, within about 6%.

Example

page ::courtlistener/search-dockets("Google court_id:cand")
page.count

search-documents

fn (q: Str): Map
fn (q: Str, opts: Map): Map

Search federal filing documents from PACER (type=rd), without docket metadata.

Example

page ::courtlistener/search-documents("motion to dismiss court_id:nysd")
map(page.results, %.description)

search-opinions

fn (q: Str): Map
fn (q: Str, opts: Map): Map

Search case law (type=o): opinion clusters with their nested opinions.

Example

page ::courtlistener/search-opinions("\"fair use\" court_id:scotus", {order-by: "dateFiled desc"})
map(page.results, %.caseName)

search-params

fn (q: Str, opts: Map): Map

Query parameters for the Search API (pure): q, type (opts.type, default "o"), order_by, filed_after, filed_before, highlight (opts.highlight true gives on) and cursor. opts.params adds any other parameter the search front end sends.

Example

::courtlistener/search-params("privacy", {}).type  // "o"
::courtlistener/search-params("privacy", {highlight: true}).highlight  // "on"
::courtlistener/search-params("privacy", {params: {court: "ca9"}}).court  // "ca9"

search-recap

fn (q: Str): Map
fn (q: Str, opts: Map): Map

Search RECAP (type=r): federal cases with up to three nested documents. more_docs is true on a result with more matches than that.

Example

page ::courtlistener/search-recap("antitrust court_id:dcd", {filed-after: "2026-01-01"})
map(page.results, %.caseName)