# CourtListener Legal Case Scraper (`crawlergang/courtlistener-scraper`) Actor

Scrape US court opinions, RECAP federal dockets, and oral arguments from CourtListener.com with the largest free legal database with 4M+ opinions, SCOTUS to district courts. Search by keyword, court, date range, and more. No API key required.

- **URL**: https://apify.com/crawlergang/courtlistener-scraper.md
- **Developed by:** [Crawler Gang](https://apify.com/crawlergang) (community)
- **Categories:** Automation, Developer tools, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 11 bookmarks
- **User rating**: 5.00 out of 5 stars

## 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 Case Scraper

Extract US court opinions, federal dockets, and oral argument audio records from **CourtListener.com** — the largest free public legal database in the United States with 4M+ court opinions from SCOTUS down to federal district courts.

### What You Can Scrape

- **Court Opinions** — case names, courts, judges, filing dates, citations, cite counts, and opinion text snippets (SCOTUS to district level)
- **RECAP Federal Dockets** — case filings, parties, attorneys, law firms, jurisdiction types, and document counts
- **Oral Arguments** — audio metadata including case name, court, argued date, duration, and download URL

### Modes

| Mode | Description |
|------|-------------|
| `opinions` | Search US court opinions / case law (default) |
| `dockets` | Search RECAP federal court dockets |
| `oralArguments` | Search oral argument audio recordings |

### Input Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `mode` | Select | One of `opinions`, `dockets`, `oralArguments` |
| `searchQuery` | String | Full-text keyword search. Supports AND, OR, NOT, phrases in quotes |
| `court` | Select | Filter to a specific court (e.g. `scotus`, `ca9`) |
| `dateFiledAfter` | String | Filter cases filed after this date (YYYY-MM-DD) |
| `dateFiledBefore` | String | Filter cases filed before this date (YYYY-MM-DD) |
| `orderBy` | Select | `score desc`, `dateFiled desc`, `dateFiled asc`, `citeCount desc` |
| `status` | Select | Opinion status filter: `Published`, `Unpublished`, etc. |
| `maxItems` | Integer | Max records to return (1–500, default 50) |

### Output Fields

#### Opinion Records (`recordType: opinions`)

| Field | Type | Description |
|-------|------|-------------|
| `caseId` | Integer | CourtListener cluster ID |
| `docketId` | Integer | Associated docket ID |
| `caseName` | String | Short case name (e.g. "Roe v. Wade") |
| `caseNameFull` | String | Full formal case name |
| `court` | String | Court full name |
| `courtId` | String | Court slug ID (e.g. `scotus`, `ca9`) |
| `courtCitation` | String | Official citation abbreviation (e.g. "9th Cir.") |
| `docketNumber` | String | Docket/case number |
| `judge` | String | Authoring judge(s) |
| `status` | String | Published / Unpublished / etc. |
| `suitNature` | String | Nature of suit |
| `dateFiled` | String | Date filed (YYYY-MM-DD) |
| `dateArgued` | String | Date argued (YYYY-MM-DD) |
| `citations` | Array | Citation strings (e.g. ["123 U.S. 456"]) |
| `lexisCite` | String | LexisNexis citation |
| `neutralCite` | String | Neutral citation |
| `citeCount` | Integer | Number of times cited by other opinions |
| `snippet` | String | Text excerpt from the opinion |
| `attorney` | String | Attorney information |
| `caseUrl` | String | Full CourtListener.com URL |
| `scrapedAt` | String | ISO 8601 timestamp of scrape |

#### Docket Records (`recordType: dockets`)

| Field | Type | Description |
|-------|------|-------------|
| `docketId` | Integer | CourtListener docket ID |
| `caseName` | String | Case name |
| `court` | String | Court name |
| `courtId` | String | Court slug ID |
| `docketNumber` | String | Docket number |
| `assignedTo` | String | Assigned judge |
| `referredTo` | String | Referred judge |
| `cause` | String | Cause of action |
| `suitNature` | String | Nature of suit |
| `jurisdictionType` | String | Federal question / Diversity / etc. |
| `parties` | Array | Party names |
| `attorneys` | Array | Attorney names |
| `firms` | Array | Law firm names |
| `dateFiled` | String | Date case was filed |
| `dateTerminated` | String | Date case was terminated |
| `documentCount` | Integer | Number of RECAP documents |
| `pacerCaseId` | String | PACER case ID |
| `caseUrl` | String | CourtListener docket URL |
| `scrapedAt` | String | ISO 8601 timestamp |

#### Oral Argument Records (`recordType: oralArguments`)

| Field | Type | Description |
|-------|------|-------------|
| `audioId` | Integer | Audio recording ID |
| `docketId` | Integer | Docket ID |
| `caseName` | String | Case name |
| `court` | String | Court name |
| `courtId` | String | Court slug ID |
| `docketNumber` | String | Docket number |
| `judge` | String | Panel judge(s) |
| `dateArgued` | String | Date argued (YYYY-MM-DD) |
| `durationSeconds` | Integer | Recording duration in seconds |
| `downloadUrl` | String | Direct MP3 audio download URL |
| `snippet` | String | Text excerpt from argument transcript |
| `caseUrl` | String | CourtListener audio page URL |
| `scrapedAt` | String | ISO 8601 timestamp |

### Example Inputs

```json
{
  "mode": "opinions",
  "searchQuery": "criminal defense Fourth Amendment",
  "court": "scotus",
  "orderBy": "citeCount desc",
  "maxItems": 50
}
````

```json
{
  "mode": "opinions",
  "searchQuery": "contract breach",
  "dateFiledAfter": "2020-01-01",
  "dateFiledBefore": "2024-12-31",
  "status": "Published",
  "maxItems": 100
}
```

```json
{
  "mode": "dockets",
  "searchQuery": "patent infringement Apple",
  "court": "cafc",
  "maxItems": 30
}
```

```json
{
  "mode": "oralArguments",
  "searchQuery": "Second Amendment gun rights",
  "court": "scotus",
  "maxItems": 20
}
```

### Supported Courts

| Court ID | Court Name |
|----------|-----------|
| `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 |
| `cit` | Court of International Trade |
| `bap1`, `bap2`, `bap6`, `bap8`, `bap9`, `bap10` | Bankruptcy Appellate Panels |

Many more federal district courts and state courts are available — use any CourtListener court ID slug.

### Search Query Syntax

CourtListener supports full-text search with boolean operators:

- `murder AND self-defense` — both terms
- `"fourth amendment" OR "unreasonable search"` — phrase or term
- `patent NOT copyright` — exclude a term
- `"habeas corpus"` — exact phrase

### FAQs

**Does this require a CourtListener account or API key?**\
No. The scraper uses CourtListener's public REST API (v4) which requires no authentication for search operations.

**How many records can I fetch?**\
Up to 500 per run. CourtListener has 4M+ opinions, 123K+ RECAP dockets, and 9K+ oral arguments. Pagination via cursor is handled automatically.

**Are opinion full texts included?**\
The scraper includes opinion text snippets from search results. Full opinion PDFs/text are available at the `caseUrl` links.

**What courts are covered?**\
All US federal courts: SCOTUS, 13 circuit courts, 94 district courts, bankruptcy courts, and specialty courts. Some state appellate courts are also indexed.

**Are oral argument MP3 files accessible?**\
Yes — the `downloadUrl` field contains direct MP3 links hosted by the court (e.g. `media.ca7.uscourts.gov`).

**Is this data current?**\
CourtListener indexes opinions within days of publication. Oral arguments are typically added within a week of being argued.

### Technical Notes

- Data source: CourtListener.com public REST API v4
- No browser automation required — pure HTTP via `httpx`
- No proxy, no cookies, no authentication required
- Cursor-based pagination for large result sets
- Retries on 429/5xx with exponential backoff
- Memory: 1024 MB recommended

# Actor input Schema

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

What type of legal records to scrape.

## `searchQuery` (type: `string`):

Full-text keyword search. Supports boolean operators (AND, OR, NOT) and phrases in quotes.

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

Filter to a specific court by its CourtListener ID slug.

## `dateFiledAfter` (type: `string`):

Only return cases filed on or after this date (YYYY-MM-DD).

## `dateFiledBefore` (type: `string`):

Only return cases filed on or before this date (YYYY-MM-DD).

## `orderBy` (type: `string`):

Sort results by relevance or date filed.

## `status` (type: `string`):

Filter opinions by publication status (mode=opinions only).

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

Maximum number of records to return.

## Actor input object example

```json
{
  "mode": "opinions",
  "searchQuery": "criminal defense",
  "court": "",
  "orderBy": "score desc",
  "status": "",
  "maxItems": 50
}
```

# Actor output Schema

## `cases` (type: `string`):

Dataset containing all scraped court opinions, dockets, or oral arguments.

# 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": "opinions",
    "searchQuery": "criminal defense",
    "court": "",
    "orderBy": "score desc",
    "status": "",
    "maxItems": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlergang/courtlistener-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": "opinions",
    "searchQuery": "criminal defense",
    "court": "",
    "orderBy": "score desc",
    "status": "",
    "maxItems": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("crawlergang/courtlistener-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": "opinions",
  "searchQuery": "criminal defense",
  "court": "",
  "orderBy": "score desc",
  "status": "",
  "maxItems": 50
}' |
apify call crawlergang/courtlistener-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "CourtListener Legal Case Scraper",
        "description": "Scrape US court opinions, RECAP federal dockets, and oral arguments from CourtListener.com with the largest free legal database with 4M+ opinions, SCOTUS to district courts. Search by keyword, court, date range, and more. No API key required.",
        "version": "1.0",
        "x-build-id": "EBrDElPLNJDsfoVSp"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/crawlergang~courtlistener-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-crawlergang-courtlistener-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/crawlergang~courtlistener-scraper/runs": {
            "post": {
                "operationId": "runs-sync-crawlergang-courtlistener-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/crawlergang~courtlistener-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-crawlergang-courtlistener-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": [
                            "opinions",
                            "dockets",
                            "oralArguments"
                        ],
                        "type": "string",
                        "description": "What type of legal records to scrape.",
                        "default": "opinions"
                    },
                    "searchQuery": {
                        "title": "Search Query",
                        "type": "string",
                        "description": "Full-text keyword search. Supports boolean operators (AND, OR, NOT) and phrases in quotes."
                    },
                    "court": {
                        "title": "Court",
                        "enum": [
                            "",
                            "scotus",
                            "ca1",
                            "ca2",
                            "ca3",
                            "ca4",
                            "ca5",
                            "ca6",
                            "ca7",
                            "ca8",
                            "ca9",
                            "ca10",
                            "ca11",
                            "cadc",
                            "cafc",
                            "cit",
                            "bap1",
                            "bap2",
                            "bap6",
                            "bap8",
                            "bap9",
                            "bap10"
                        ],
                        "type": "string",
                        "description": "Filter to a specific court by its CourtListener ID slug.",
                        "default": ""
                    },
                    "dateFiledAfter": {
                        "title": "Filed After (date)",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                        "type": "string",
                        "description": "Only return cases filed on or after this date (YYYY-MM-DD)."
                    },
                    "dateFiledBefore": {
                        "title": "Filed Before (date)",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                        "type": "string",
                        "description": "Only return cases filed on or before this date (YYYY-MM-DD)."
                    },
                    "orderBy": {
                        "title": "Sort Order",
                        "enum": [
                            "score desc",
                            "dateFiled desc",
                            "dateFiled asc",
                            "citeCount desc"
                        ],
                        "type": "string",
                        "description": "Sort results by relevance or date filed.",
                        "default": "score desc"
                    },
                    "status": {
                        "title": "Opinion Status",
                        "enum": [
                            "",
                            "Published",
                            "Unpublished",
                            "Errata",
                            "Separate",
                            "In-chambers",
                            "Relating-to",
                            "Unknown"
                        ],
                        "type": "string",
                        "description": "Filter opinions by publication status (mode=opinions only).",
                        "default": ""
                    },
                    "maxItems": {
                        "title": "Max Items",
                        "minimum": 1,
                        "maximum": 500,
                        "type": "integer",
                        "description": "Maximum number of records to return.",
                        "default": 50
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
