# CourtListener Legal Search Scraper (`crawlerbros/courtlistener-legal-search-scraper`) Actor

Search US court opinions, federal dockets, and court listings from CourtListener.com - the Free Law Project's open database of 4M+ court opinions. No API key required. Filter by court, date range, and keyword.

- **URL**: https://apify.com/crawlerbros/courtlistener-legal-search-scraper.md
- **Developed by:** [Crawler Bros](https://apify.com/crawlerbros) (community)
- **Categories:** Automation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## CourtListener Legal Search Scraper

Search US court opinions, court dockets, and browse available courts from **CourtListener.com** — the Free Law Project's open database of 4M+ court opinions from SCOTUS down to federal district courts. No API key or account required.

### What You Can Scrape

- **Court Opinions** — case names, courts, filing dates, docket numbers, opinion types, citation counts, and status (Published/Unpublished)
- **Court Dockets** — case filings, assigned judges, causes of action, and docket numbers
- **Courts List** — all available courts with jurisdiction types, short names, and official website URLs

### Modes

| Mode | Description |
|------|-------------|
| `searchOpinions` | Search US court opinions / case law via REST API (default) |
| `searchDockets` | Search federal court dockets via REST API |
| `listCourts` | List all available courts with metadata |

### Input Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `mode` | Select | One of `searchOpinions`, `searchDockets`, `listCourts` |
| `query` | String | Search keyword or phrase (e.g. `privacy rights`, `contract breach`) |
| `court` | String | Filter to a court by its ID slug (e.g. `scotus`, `ca9`, `nysd`) |
| `dateAfter` | String | Only return cases filed after this date (YYYY-MM-DD) |
| `dateBefore` | String | Only return cases filed before this date (YYYY-MM-DD) |
| `maxItems` | Integer | Max records to return (1–200, default 25) |

### Output Fields

#### Opinion Records (`mode: searchOpinions`)

| Field | Type | Description |
|-------|------|-------------|
| `clusterId` | Integer | CourtListener cluster/opinion ID |
| `caseName` | String | Case name (e.g. "Roe v. Wade") |
| `court` | String | Court ID slug (e.g. `scotus`, `ca9`) |
| `courtName` | String | Court full name |
| `dateFiled` | String | Date filed (YYYY-MM-DD) |
| `docketNumber` | String | Docket/case number |
| `absoluteUrl` | String | Full URL to the CourtListener opinion page |
| `opinionType` | String | Opinion type code (e.g. `010combined`) |
| `citeCount` | Integer | Number of times cited by other opinions |
| `status` | String | Precedential status (Published, Unpublished, etc.) |
| `scrapedAt` | String | ISO 8601 UTC timestamp of scrape |

#### Docket Records (`mode: searchDockets`)

| Field | Type | Description |
|-------|------|-------------|
| `docketId` | Integer | CourtListener docket ID |
| `caseName` | String | Case name |
| `court` | String | Court ID slug |
| `courtName` | String | Court full name |
| `dateFiled` | String | Date case was filed (YYYY-MM-DD) |
| `docketNumber` | String | Docket/case number |
| `absoluteUrl` | String | Full URL to the CourtListener docket page |
| `assignedTo` | String | Assigned judge name |
| `causeOfAction` | String | Cause of action (e.g. "42:1983 Civil Rights") |
| `scrapedAt` | String | ISO 8601 UTC timestamp of scrape |

#### Court Records (`mode: listCourts`)

| Field | Type | Description |
|-------|------|-------------|
| `courtId` | String | CourtListener court ID slug (e.g. `scotus`) |
| `shortName` | String | Abbreviated court name |
| `fullName` | String | Full official court name |
| `jurisdiction` | String | Jurisdiction type code (F=Federal, S=State, etc.) |
| `url` | String | Court's official website URL |
| `position` | Number | Ordering position in CourtListener's court list |
| `scrapedAt` | String | ISO 8601 UTC timestamp of scrape |

### Example Inputs

Search SCOTUS opinions about privacy rights:
```json
{
  "mode": "searchOpinions",
  "query": "privacy rights Fourth Amendment",
  "court": "scotus",
  "maxItems": 25
}
````

Search circuit court opinions in a date range:

```json
{
  "mode": "searchOpinions",
  "query": "contract breach damages",
  "court": "ca9",
  "dateAfter": "2020-01-01",
  "dateBefore": "2024-12-31",
  "maxItems": 50
}
```

Search federal dockets by cause:

```json
{
  "mode": "searchDockets",
  "query": "patent infringement Apple",
  "court": "cafc",
  "maxItems": 30
}
```

List all available courts:

```json
{
  "mode": "listCourts",
  "maxItems": 200
}
```

### Jurisdiction Codes

The `jurisdiction` field in court records uses the following codes:

| Code | Description |
|------|-------------|
| `F` | Federal Appellate |
| `FD` | Federal District |
| `FB` | Federal Bankruptcy |
| `FBP` | Federal Bankruptcy Panel |
| `FS` | Federal Special |
| `FT` | Federal Tax |
| `FL` | Federal Local Rules |
| `FC` | Federal Claims |
| `S` | State Supreme |
| `ST` | State Trial |
| `SA` | State Appellate |
| `MA` | Military Appellate |
| `T` | Tribal |
| `AG` | Attorney General |
| `I` | International |
| `BAP` | Bankruptcy Appellate Panel |

### Supported Court IDs (Examples)

| Court ID | Court |
|----------|-------|
| `scotus` | Supreme Court of the United States |
| `ca1`–`ca11` | U.S. Courts of Appeals (1st–11th Circuits) |
| `cadc` | Court of Appeals for the D.C. Circuit |
| `cafc` | Court of Appeals for the Federal Circuit |
| `nysd` | U.S. District Court, Southern District of New York |
| `caed` | U.S. District Court, Eastern District of California |
| `cit` | Court of International Trade |

Use `mode: listCourts` to get the complete list of all supported court IDs.

### FAQs

**Does this require a CourtListener account or API key?**\
No. The scraper uses the CourtListener public REST API v4 which is free and requires no authentication.

**How many records can I fetch?**\
Up to 200 per run. For larger datasets, run multiple times with different date ranges. CourtListener has 4M+ opinions and thousands of dockets indexed.

**What courts are covered?**\
All US federal courts (SCOTUS, 13 circuit courts, 94 district courts, bankruptcy courts, specialty courts) plus many state appellate courts. Use `mode: listCourts` to see all options.

**Is this data current?**\
CourtListener indexes new opinions within days of publication via partnerships with PACER and direct court feeds.

**Are there rate limits?**\
CourtListener allows 5,000 API requests per day per IP address. The scraper automatically handles retries on rate limit responses (429).

**What is the difference between opinions and dockets?**\
An opinion is the court's written decision on a case. A docket is the procedural record of a case including all filings, motions, and orders. One docket can have multiple opinions.

### Technical Notes

- Data source: CourtListener.com public REST API v4 (Free Law Project)
- No browser automation — pure HTTP via `httpx`
- No proxy, cookies, or authentication required
- Link-based pagination (`next` URL field) for large result sets
- Automatic retries on 429/5xx with exponential backoff + Retry-After header support
- All output fields are non-null (empty fields are omitted)

# Actor input Schema

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

What to scrape: court opinions, dockets, or a listing of all available courts.

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

Full-text keyword search for opinions or dockets (e.g. 'privacy rights', 'contract breach'). Not required for listCourts mode.

## `court` (type: `string`):

Filter results to a specific court by its CourtListener ID slug (e.g. 'scotus', 'ca9', 'nysd'). Leave blank for all courts.

## `dateAfter` (type: `string`):

Only return cases filed on or after this date (format: YYYY-MM-DD, e.g. '2020-01-01').

## `dateBefore` (type: `string`):

Only return cases filed on or before this date (format: YYYY-MM-DD, e.g. '2023-12-31').

## `maxItems` (type: `integer`):

Maximum number of records to return (1–200). Default is 25.

## Actor input object example

```json
{
  "mode": "searchOpinions",
  "query": "privacy",
  "maxItems": 25
}
```

# Actor output Schema

## `legalRecords` (type: `string`):

Dataset containing scraped court opinions, dockets, or court listings from CourtListener.

# 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 = {
    "mode": "searchOpinions",
    "query": "privacy",
    "maxItems": 25
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlerbros/courtlistener-legal-search-scraper").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 = {
    "mode": "searchOpinions",
    "query": "privacy",
    "maxItems": 25,
}

# Run the Actor and wait for it to finish
run = client.actor("crawlerbros/courtlistener-legal-search-scraper").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "mode": "searchOpinions",
  "query": "privacy",
  "maxItems": 25
}' |
apify call crawlerbros/courtlistener-legal-search-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=crawlerbros/courtlistener-legal-search-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "CourtListener Legal Search Scraper",
        "description": "Search US court opinions, federal dockets, and court listings from CourtListener.com - the Free Law Project's open database of 4M+ court opinions. No API key required. Filter by court, date range, and keyword.",
        "version": "1.0",
        "x-build-id": "CEJcft19crCP7WPlP"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/crawlerbros~courtlistener-legal-search-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-crawlerbros-courtlistener-legal-search-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/crawlerbros~courtlistener-legal-search-scraper/runs": {
            "post": {
                "operationId": "runs-sync-crawlerbros-courtlistener-legal-search-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/crawlerbros~courtlistener-legal-search-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-crawlerbros-courtlistener-legal-search-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "mode"
                ],
                "properties": {
                    "mode": {
                        "title": "Mode",
                        "enum": [
                            "searchOpinions",
                            "searchDockets",
                            "listCourts"
                        ],
                        "type": "string",
                        "description": "What to scrape: court opinions, dockets, or a listing of all available courts.",
                        "default": "searchOpinions"
                    },
                    "query": {
                        "title": "Search Query",
                        "type": "string",
                        "description": "Full-text keyword search for opinions or dockets (e.g. 'privacy rights', 'contract breach'). Not required for listCourts mode."
                    },
                    "court": {
                        "title": "Court Filter",
                        "type": "string",
                        "description": "Filter results to a specific court by its CourtListener ID slug (e.g. 'scotus', 'ca9', 'nysd'). Leave blank for all courts."
                    },
                    "dateAfter": {
                        "title": "Date Filed After",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                        "type": "string",
                        "description": "Only return cases filed on or after this date (format: YYYY-MM-DD, e.g. '2020-01-01')."
                    },
                    "dateBefore": {
                        "title": "Date Filed Before",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                        "type": "string",
                        "description": "Only return cases filed on or before this date (format: YYYY-MM-DD, e.g. '2023-12-31')."
                    },
                    "maxItems": {
                        "title": "Max Items",
                        "minimum": 1,
                        "maximum": 200,
                        "type": "integer",
                        "description": "Maximum number of records to return (1–200). Default is 25.",
                        "default": 25
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
