# Court Records API: Case Law, Opinions, PACER Dockets, Judges (`nabeelbaghoor/court-records-case-law-api`) Actor

Search US court records and case law: court opinions with full text, opinion clusters and citations, PACER dockets, docket entries and RECAP documents, federal and state judges, courts and oral argument audio through the CourtListener REST API v4. Bring your own key.

- **URL**: https://apify.com/nabeelbaghoor/court-records-case-law-api.md
- **Developed by:** [Nabeel Hassan](https://apify.com/nabeelbaghoor) (community)
- **Categories:** Developer tools, Business, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 search hit or courts

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Court Records API: Case Law, Opinions, PACER Dockets, Judges

Search and export US court records, court opinions with full text, PACER dockets, docket entries, judges and oral argument recordings from the CourtListener REST API v4, as clean dataset rows. Bring your own API key.

### What it does

- **Legal search** across the CourtListener search engine: case law opinions, PACER cases, PACER filing documents, judges and oral argument audio, with the same query syntax and filters as the courtlistener.com search page.
- **Case law**: opinion clusters (decisions with parallel citations, panel, precedential status and citation count) and individual opinions with their full text (lead opinion, concurrences, dissents).
- **PACER data from the RECAP Archive**: dockets with nature of suit, cause, assigned judge and filing dates; docket entries and RECAP documents for one docket.
- **Judges**: federal and state judges and justices with birth date, birthplace, gender and positions.
- **Courts**: more than 3,000 courts and jurisdictions with IDs, names and citation strings.
- **Oral arguments**: recordings with case name, docket, judges, duration and an MP3 link.
- Filters by court ID, docket number, filing date range, case name, judge, citation, precedential status, minimum citation count, nature of suit and more.
- Record ID lookups: give docket, cluster, opinion or judge IDs and get those exact records.
- Read only. The actor never buys PACER documents, never uploads to RECAP and never creates alerts.
- Pay per result, and only for rows that carry a real record. Empty answers and refused lookups are free.

### Bring your own API key

This actor calls CourtListener with your own token, so your requests count against your own CourtListener limits.

1. Create a free account at courtlistener.com and sign in.
2. Open your profile page at courtlistener.com/profile/api-token/ and copy the token.
3. Paste it into the **CourtListener API token** field (just the token, without the word Token), or set it as the `DATA_API_KEY` secret.

Free tokens allow 5 requests a minute, 50 an hour and 125 a day on a rolling window. A Free Law Project membership raises those limits, and Free Law Project offers commercial agreements for product use. If the token's allowance is used up, the run ends cleanly with a status message and charges nothing more. Without a token the run ends at once with instructions and makes no request.

### Input

| Field | Used by | What it does |
| --- | --- | --- |
| What to read | all | Legal search, dockets, clusters, opinions, docket entries, RECAP documents, courts, judges or oral arguments. |
| CourtListener API token | all | Your own token. Stored as a secret. |
| Search query | search | Keywords or advanced operators such as `caseName:(roe AND wade)` or `court_id:ca9`, sent as `q`. |
| Search type | search | `o` case law, `r` PACER cases with filings, `rd` PACER filings, `d` PACER cases, `p` judges, `oa` oral arguments. |
| Search order | search | Relevance, filing date, citation count, argument date, name or birth date, depending on the type. |
| Case name, Judge, Citation | search | Fielded search filters. |
| Precedential statuses | search, clusters | Published, Unpublished, Errata, Separate, In chambers, Relating to, Unknown. Case law search returns only published opinions unless you pick statuses. |
| Semantic search | search | Plain language case law search ranked by meaning. |
| Court IDs | search and most database modes | Such as `scotus`, `ca9`, `nysd`, `cal`. |
| Docket number | search, dockets, clusters, opinions | Such as `1:16-cv-00745`. Add a court too, since docket numbers repeat across courts. |
| Filed on or after, Filed on or before | search, dockets, clusters, docket entries | YYYY-MM-DD. For oral argument search these are argument dates. |
| Record IDs | database modes | Exact records by ID, one request each. |
| Docket ID | clusters, docket entries, RECAP documents, oral arguments | Required for docket entries and RECAP documents. |
| Cluster ID, Author judge ID | opinions | Every opinion in one decision, or every opinion by one judge. |
| Minimum citation count | clusters | Only decisions cited at least this often. |
| Nature of suit, PACER case ID | dockets | PACER case filters. |
| Include full text | opinions, RECAP documents | Turn off for smaller, cheaper rows without text. |
| Court jurisdictions, Only courts in use | courts | Federal Appellate, Federal District, State Supreme and the other jurisdiction types. |
| Judge name prefixes, birth state | judges | Find judges by name. |
| Database order | database modes | Such as `-date_filed` or `-citation_count`. |
| Maximum rows, Requests per minute | all | Run size and pacing. Defaults of 20 rows and 5 requests a minute fit a free token. |

Example input:

```json
{
    "mode": "search",
    "query": "qualified immunity",
    "searchType": "o",
    "courts": ["scotus", "ca9"],
    "filedAfter": "2020-01-01",
    "searchOrderBy": "citeCount desc",
    "maxResults": 20
}
```

### Output

Every row has `mode`, `recordType`, `query`, `found`, `id`, flat columns for the record type, a `url` on courtlistener.com and the full CourtListener record in `record`. A legal search hit looks like this (shortened, values from the CourtListener documentation example):

```json
{
    "mode": "search",
    "recordType": "searchResult",
    "searchType": "o",
    "query": "foo",
    "found": true,
    "id": "6613686",
    "caseName": "Foo v. Foo",
    "court": "Hawaii Intermediate Court of Appeals",
    "courtId": "hawapp",
    "dateFiled": "2003-01-10",
    "docketNumber": "24158",
    "citation": "101 Haw. 235; 65 P.3d 182",
    "status": "Published",
    "citeCount": 0,
    "snippet": "Affirmed in part, reversed in part, vacated and remanded",
    "url": "https://www.courtlistener.com/opinion/6613686/foo-v-foo/",
    "note": null,
    "record": { "cluster_id": 6613686, "opinions": [] }
}
```

A docket row:

```json
{
    "mode": "dockets",
    "recordType": "docket",
    "found": true,
    "id": "4214664",
    "caseName": "NATIONAL VETERANS LEGAL SERVICES PROGRAM v. United States",
    "courtId": "dcd",
    "dateFiled": "2016-04-21",
    "dateLastFiling": "2024-05-15",
    "docketNumber": "1:16-cv-00745",
    "pacerCaseId": "178502",
    "natureOfSuit": "Other Statutory Actions",
    "cause": "28:1346 Tort Claim",
    "judge": "Paul L. Friedman",
    "url": "https://www.courtlistener.com/docket/4214664/national-veterans-legal-services-program-v-united-states/"
}
```

Opinion rows add `opinionType`, `clusterId`, `judge` (author), `text` (plain text, or the cited HTML stripped to text) and `textLength`. Judge rows add `name`, `born`, `died`, `birthPlace` and `gender`. Oral argument rows add `durationSeconds` and `audioUrl`.

### Pricing

| Event | Price | When |
| --- | --- | --- |
| Search hit or court | 0.005 USD | Each legal search hit and each court row. |
| Court record | 0.01 USD | Each docket, cluster, docket entry, judge or oral argument record, and each opinion or RECAP document read without text. |
| Opinion or document with full text | 0.02 USD | Each opinion or RECAP document that carries its text. |

Rows with `found` set to false (no match, or a lookup CourtListener refused) are never charged.

### FAQ

#### What is CourtListener?

CourtListener is a free legal research website and REST API run by Free Law Project, a 501(c)(3) non-profit. It holds millions of US court opinions, the RECAP Archive of PACER dockets and filings, a database of federal and state judges, and the largest collection of oral argument recordings online.

#### Do I need a CourtListener account?

Yes. A free CourtListener account gives you an API token on your profile page. This actor uses only your token and never creates accounts or shares tokens. CourtListener's terms ask that you keep your token to yourself and respect the rate limits of your access level.

#### How many records can I read with a free token?

A free token allows 5 requests a minute, 50 an hour and 125 a day. One request returns about 20 search hits or list rows, and a record ID lookup is one request per record. A Free Law Project membership or a commercial agreement raises the limits.

#### Can this actor download PACER documents or buy them from PACER?

No. It reads only what is already in the RECAP Archive and the CourtListener database. It never calls the RECAP fetch, upload or Pray and Pay endpoints, so it never spends PACER fees.

#### Why does the docket entries or RECAP documents mode say access was refused?

CourtListener opens some PACER endpoints only to select users. If your token gets HTTP 403 there, the run ends cleanly with that message; ask Free Law Project for access, or use legal search with type `r` or `rd`, which returns PACER cases and filings to every token.

#### How do I get every opinion in a Supreme Court case?

Search case law with the court ID `scotus` and your query, take the cluster `id` of the decision, then run the opinions mode with that cluster ID. You get the lead opinion, concurrences and dissents, each with full text.

#### Can I use this data to screen people for jobs, credit or housing?

No. Free Law Project is not a consumer reporting agency, and its terms forbid using CourtListener data for any purpose covered by the Fair Credit Reporting Act, such as employment, credit, insurance or housing eligibility.

#### Is court opinion text public domain?

Judicial opinions are generally in the public domain in the United States, which is why CourtListener can publish them. Some filings in the RECAP Archive may quote copyrighted works, so check before you republish a document.

### Routes and verification

The actor calls only GET routes documented on courtlistener.com/help/api/rest/ (v4.7): `/api/rest/v4/search/`, `/dockets/`, `/clusters/`, `/opinions/`, `/docket-entries/`, `/recap-documents/`, `/courts/`, `/people/` and `/audio/`, plus `/<endpoint>/<id>/` for record IDs. Filter names come from the query refinement guide and the endpoints' published filter sets. Every route answered HTTP 401 "Invalid token" to a probe with a fake token, while invented routes answered 404. The actor is not live tested with a real token; the request building, paging, row shaping and error handling are covered by offline tests.

Powered by the CourtListener API from Free Law Project. This actor is independent and is not produced or endorsed by Free Law Project. Data is provided as is; verify anything you rely on against the primary court record.

### Keyword map

court records API, case law API, court opinions API, legal data API, PACER API, PACER docket search, RECAP Archive, federal court dockets, state court opinions, Supreme Court opinions, judge database, judicial data, oral argument audio, legal research automation, citation search, CourtListener API, Free Law Project.

# Actor input Schema

## `mode` (type: `string`):

Legal search runs the CourtListener search engine across case law, PACER cases and filings, judges or oral arguments. The other modes read one database endpoint by filters or by record IDs.

## `apiKey` (type: `string`):

Your own free CourtListener API token, from courtlistener.com/profile/api-token/ after signing in. Paste the token alone, without the word Token. You can also set the DATA_API_KEY secret instead.

## `query` (type: `string`):

Legal search. Keywords or CourtListener advanced operators, such as "qualified immunity" or caseName:(roe AND wade) or court_id:ca9. Sent as q.

## `searchType` (type: `string`):

Legal search. Which collection to search, sent as type.

## `searchOrderBy` (type: `string`):

Legal search. Sent as order_by. Relevance works for every type; filing dates fit case law and PACER, citation counts fit case law, argument dates fit oral arguments, and name or birth order fits judges.

## `caseName` (type: `string`):

Optional. Legal search. Words in the case name, such as Miranda v. Arizona. Sent as case_name.

## `judgeName` (type: `string`):

Optional. Legal search. A judge name, such as Ginsburg. Sent as judge.

## `citation` (type: `string`):

Optional. Case law search. A reporter citation, such as 410 U.S. 113. Sent as citation.

## `precedentialStatuses` (type: `array`):

Optional. Case law search includes only published opinions unless you pick statuses here (sent as stat_Published=on and so on). The clusters mode takes one status, sent as precedential_status.

## `semantic` (type: `boolean`):

Optional. Case law search only. Ranks opinions by meaning instead of keywords, for plain language queries. Sent as semantic=true.

## `highlight` (type: `boolean`):

Optional. Legal search. Marks query matches in the snippet with mark tags. Sent as highlight=on.

## `courts` (type: `array`):

Optional. CourtListener court IDs from the jurisdictions page, such as scotus, ca9, nysd or cal. Legal search takes several at once; dockets, clusters, opinions, judges and oral arguments read each court in turn.

## `docketNumber` (type: `string`):

Optional. A docket number, such as 1:16-cv-00745 or 23A994. Legal search, dockets, clusters and opinions. Docket numbers are not unique, so add a court too.

## `filedAfter` (type: `string`):

Optional. YYYY-MM-DD. Legal search (argued date for oral arguments), dockets, clusters and docket entries.

## `filedBefore` (type: `string`):

Optional. YYYY-MM-DD. Legal search (argued date for oral arguments), dockets, clusters and docket entries.

## `recordIds` (type: `array`):

Optional. Read these exact records by ID, one request each, instead of filtering: docket, cluster, opinion, docket entry, RECAP document, judge or audio IDs (the number in a CourtListener URL), or court IDs such as scotus in the courts mode.

## `docketId` (type: `string`):

Clusters, docket entries, RECAP documents and oral arguments. The numeric docket ID from a CourtListener docket URL, such as 4214664. Required for docket entries and RECAP documents.

## `clusterId` (type: `string`):

Optional. Opinions. The numeric cluster ID from a CourtListener opinion URL, which returns every opinion (lead, concurrence, dissent) in that decision.

## `authorId` (type: `string`):

Optional. Opinions. The numeric judge ID of the opinion author, from the judges mode.

## `minCitations` (type: `integer`):

Optional. Clusters. Only decisions cited at least this many times. Sent as citation_count__gte.

## `natureOfSuit` (type: `string`):

Optional. Dockets. The start of the PACER nature of suit, such as Patent or Civil Rights.

## `pacerCaseId` (type: `string`):

Optional. Dockets. The numeric PACER case ID, best combined with a court ID.

## `availableOnly` (type: `boolean`):

Optional. RECAP documents. Only documents already in the RECAP Archive (is_available=true).

## `includeText` (type: `boolean`):

Opinions and RECAP documents. Keep the opinion or document text. Turn off to leave the text fields out with the omit parameter, for smaller and cheaper rows.

## `jurisdictions` (type: `array`):

Optional. Courts mode. Only courts of these jurisdiction types.

## `inUseOnly` (type: `boolean`):

Optional. Courts mode. Only courts CourtListener actively uses (in_use=true).

## `lastNamePrefix` (type: `string`):

Optional. Judges mode. The start of the last name, case insensitive, such as Ginsb.

## `firstNamePrefix` (type: `string`):

Optional. Judges mode. The start of the first name, case insensitive.

## `birthState` (type: `string`):

Optional. Judges mode. Two letter US state code, such as NY.

## `restOrderBy` (type: `string`):

Optional. Database modes. Sent as order_by; each mode accepts only its own fields (for example citation count for clusters, entry number for docket entries). Newest ID first by default.

## `maxResults` (type: `integer`):

Stop after this many rows. One page holds about 20 rows, and a free token allows about 125 requests a day.

## `requestsPerMinute` (type: `integer`):

Pacing ceiling. Free CourtListener tokens allow 5 requests a minute; raise it only if your membership or agreement allows more.

## Actor input object example

```json
{
  "mode": "search",
  "query": "qualified immunity",
  "searchType": "o",
  "searchOrderBy": "",
  "semantic": false,
  "highlight": false,
  "availableOnly": false,
  "includeText": true,
  "inUseOnly": false,
  "restOrderBy": "",
  "maxResults": 20,
  "requestsPerMinute": 5
}
```

# Actor output Schema

## `records` (type: `string`):

One row per search hit, docket, cluster, opinion, docket entry, RECAP document, court, judge or oral argument the chosen mode read.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "query": "qualified immunity"
};

// Run the Actor and wait for it to finish
const run = await client.actor("nabeelbaghoor/court-records-case-law-api").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "query": "qualified immunity" }

# Run the Actor and wait for it to finish
run = client.actor("nabeelbaghoor/court-records-case-law-api").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "query": "qualified immunity"
}' |
apify call nabeelbaghoor/court-records-case-law-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,nabeelbaghoor/court-records-case-law-api"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/uOq3Nlffk6LfJb7xx/builds/DRZvcpk5MJutqMuRN/openapi.json
