# CourtListener Case Law Scraper (`xtracto/courtlistener-opinions`) Actor

Search US court opinions, RECAP dockets and oral arguments from CourtListener: case name, court, docket number, judges, citations, filing dates and opinion snippets. Free public API.

- **URL**: https://apify.com/xtracto/courtlistener-opinions.md
- **Developed by:** [Farhan Febrian Nauval](https://apify.com/xtracto) (community)
- **Categories:** Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.34 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## CourtListener Case Law Scraper — US Opinions, Dockets & Oral Arguments

Search CourtListener's corpus of US case law: case name, court, docket number, judges, citations
and cite counts, filing dates, and the opening text of each opinion. Also covers RECAP dockets,
oral arguments and judges.

### Please use a free API token

CourtListener is run by the [Free Law Project](https://free.law/), a non-profit, and its API is
rate-limited on purpose. Measured: **5 requests a minute anonymously**, then a `429` with an honest
`Retry-After`. That is about 100 results a minute at best.

A token is free from courtlistener.com and lifts the limit substantially. Without one this actor
**deliberately paces itself to one request every 13 seconds** and says so in the log. It is not
trying to be slow; it is trying not to hammer a charity's servers, and no proxy setting changes
that — the limit is a published rate limit, not an anti-bot measure.

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `searchQueries` | array | *required* | Same syntax as CourtListener's own search box |
| `searchType` | string | `opinions` | `opinions`, `recap`, `oral-arguments`, `people` |
| `courts` | array | — | Court IDs, e.g. `scotus`, `ca9`, `dcd` |
| `filedAfter` / `filedBefore` | string | — | `YYYY-MM-DD` |
| `maxItemsPerQuery` | integer | `100` | 20 results per request |
| `apiToken` | string (secret) | — | Free from courtlistener.com — see above |

### Output

```jsonc
{
  "_input": "copyright fair use",
  "_source": "S1-courtlistener-api",
  "_scrapedAt": "2026-09-09T13:22:07Z",

  "clusterId": 9231237, "docketId": 65678901,
  "url": "https://www.courtlistener.com/opinion/9231237/fort-bend-cnty-v-davis/",

  "caseName": "Fort Bend Cnty. v. Davis",
  "caseNameFull": "Fort Bend County, Texas v. Lois M. Davis",
  "docketNumber": "No. 18-525",
  "status": "Published",

  "court": "Supreme Court of the United States",
  "courtId": "scotus",
  "courtCitationString": "SCOTUS",

  "dateFiled": "2019-06-03", "dateArgued": "2019-04-22",
  "judge": "Ginsburg",
  "attorney": "Benjamin J. Horwich, San Francisco, CA, argued the cause for…",

  "citations": ["587 U.S. 541", "139 S. Ct. 1843"],
  "citeCount": 398,
  "lexisCite": "…", "scdbId": "…",

  "opinionCount": 1,
  "opinions": [{
    "opinionId": 9231238, "type": "combined-opinion",
    "authorId": 8589, "perCuriam": false,
    "downloadUrl": "…", "localPath": "pdf/…", "citesCount": 41,
    "snippet": "Justice GINSBURG delivered the opinion of the Court…"
  }],
  "snippet": "Justice GINSBURG delivered the opinion of the Court…",

  "searchType": "opinions"
}
```

### Two things worth knowing

**Cursor pages overlap slightly.** Paging by the `next` cursor, page 2 repeated one of page 1's
twenty results in testing. The actor tracks cluster IDs and emits each case once, so a run of N
requests can return slightly fewer than 20 × N rows — that is correct, not a shortfall.

**Several fields are real but sparse.** `posture`, `proceduralHistory`, `syllabus`, `panelNames`,
`panelIds`, `neutralCite`, `dateReargued` and `dateReargumentDenied` are genuine CourtListener
fields that are empty for most cases; `suitNature` and `courtJurisdiction` populate for a minority
(4 and 1 of 20 in a mixed-court sample, and none at all in a Supreme Court sample). They are shipped
rather than hidden, because when they *are* present they matter — but an empty value here means the
corpus has none, not that the scrape failed.

**Full opinion text is not fetched.** Each opinion carries a `snippet` — the opening of the text —
plus `downloadUrl` and `localPath` pointing at the source document. Retrieving complete opinions
would mean one request per case against the same rate limit, so it is deliberately out of scope.

### Errors

| `_error` | Meaning |
|---|---|
| `invalid_input` | Empty search query |
| `no_results` | The search ran and matched nothing |
| `unexpected_shape` | A 200 without a `results` list |
| `blocked` | Every TLS profile was refused |
| `network_error` | The ladder never reached the server |

A rejected API token fails the whole run immediately rather than repeating the mistake for every
remaining query — nothing downstream can succeed with bad credentials.

# Actor input Schema

## `searchQueries` (type: `array`):

One search per entry. Supports the same syntax as CourtListener's own search box.

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

Which CourtListener index to query.

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

Filter by court, e.g. scotus, ca9, dcd. Leave empty for all courts.

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

Earliest filing date, YYYY-MM-DD.

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

Latest filing date, YYYY-MM-DD.

## `maxItemsPerQuery` (type: `integer`):

20 results per request.

## `apiToken` (type: `string`):

Strongly recommended. CourtListener is run by the Free Law Project, a non-profit, and throttles anonymous callers to 5 requests a minute — about 100 results a minute at best. A token is free from courtlistener.com and lifts that limit. Without one this actor deliberately paces itself rather than hammering their servers.

## `proxyConfiguration` (type: `object`):

Optional. There is no anti-bot layer here; the limit is a published rate limit, which a proxy would only be evading.

## Actor input object example

```json
{
  "searchQueries": [
    "copyright fair use"
  ],
  "searchType": "opinions",
  "maxItemsPerQuery": 100
}
```

# Actor output Schema

## `overview` (type: `string`):

Dataset items shown in the 'Cases' view.

## `items` (type: `string`):

Every record this run produced, with all fields, as JSON.

# 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 = {
    "searchQueries": [
        "copyright fair use"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("xtracto/courtlistener-opinions").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 = { "searchQueries": ["copyright fair use"] }

# Run the Actor and wait for it to finish
run = client.actor("xtracto/courtlistener-opinions").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 '{
  "searchQueries": [
    "copyright fair use"
  ]
}' |
apify call xtracto/courtlistener-opinions --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,xtracto/courtlistener-opinions"
        }
    }
}
```

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/RCib7qteAewiAZfz2/builds/LJAVCmz73cr6V44F5/openapi.json
