CourtListener API Client
A Python client for the CourtListener API, providing access to millions of legal opinions, dockets, judges, and more from Free Law Project.
Using an LLM? This repo also ships the CourtListener MCP server, which exposes the API to any Model Context Protocol client (Claude Desktop, Cursor, etc.). See MCP_README.md for connection details and for running it locally. Free Law Project hosts it at
mcp.courtlistener.com. See the MCP documentation on the wiki for setup instructions.
Installation
pip install courtlistener-api-client
Authentication
You'll need a CourtListener API token. You can get one by creating an account and generating a token in your profile settings.
Set it as an environment variable:
export COURTLISTENER_API_TOKEN="your-token-here"
Or pass it directly to the client:
from courtlistener import CourtListener
client = CourtListener(api_token="your-token-here")
Quickstart
from courtlistener import CourtListener
client = CourtListener()
# Get a specific opinion by ID
opinion = client.opinions.get(1)
# Search for opinions
response = client.opinions.list(cluster__case_name="Miranda")
# Access results from the current page
for opinion in response.get_results():
print(opinion)
# Check the total count of matching results
print(response.get_count())
# Iterate through all results across pages
response = client.dockets.list(court="scotus")
for docket in response:
print(docket)
Pagination
List queries return a ResourceIterator that handles pagination automatically:
results = client.dockets.list(court="scotus")
# Iterate through all results across all pages
for docket in results:
print(docket)
# Or navigate pages manually
results = client.dockets.list(court="scotus")
print(results.get_results()) # current page results
if results.has_next():
results.next()
print(results.get_results()) # next page results
Available Endpoints
Access any endpoint as an attribute on the client. Each endpoint supports .get(id) and .list(**filters).
| Endpoint | Description |
|---|---|
search |
Search opinions, RECAP, judges, and oral arguments |
dockets |
Court dockets |
docket_entries |
Docket entries |
recap_documents |
RECAP documents |
opinions |
Court opinions |
opinions_cited |
Citation relationships |
clusters |
Opinion clusters |
courts |
Court information |
audio |
Oral argument audio |
people |
Judges and other persons |
positions |
Judge positions |
parties |
Case parties |
attorneys |
Attorneys |
financial_disclosures |
Financial disclosures |
alerts |
User alerts |
docket_alerts |
Docket alerts |
prayers |
Pray and Pay requests |
tags |
User-created tags |
visualizations |
Visualization data |
schools |
Schools |
educations |
Judge education records |
political_affiliations |
Political affiliations |
aba_ratings |
ABA ratings |
fjc_integrated_database |
FJC integrated database |
See the CourtListener API docs for the full list and available filters.
API usage and rate limits
client.api_usage.get() returns your live throttle usage per scope and rate,
daily request counts for the last 14 days, and membership status. The endpoint
has its own throttle scope, so checking usage never spends the quota being
checked and it stays reachable when you are rate limited.
usage = client.api_usage.get()
for row in usage["current_usage"]:
print(row["scope"], row["rate"], row["remaining"], row["reset_at"])
print(usage["historical_usage"]["total"])
Async
AsyncCourtListener mirrors CourtListener method for method. Anything that
makes a request is awaited, iteration uses async for, and the client is an
async context manager.
from courtlistener import AsyncCourtListener
async with AsyncCourtListener() as client:
opinion = await client.opinions.get(1)
results = client.dockets.list(court="scotus")
async for docket in results:
print(docket)
Metadata
Release files for courtlistener-mcp 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| courtlistener_mcp-1.3.0.tar.gz | 240.4 kB | With provenance | Details for courtlistener_mcp-1.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| courtlistener_mcp-1.3.0-py3-none-any.whl | Python 3 | none | any | Details for courtlistener_mcp-1.3.0-py3-none-any.whl |
Total release size: 472.3 kB
Release files / courtlistener_mcp-1.3.0.tar.gz
| Download URL | courtlistener_mcp-1.3.0.tar.gz |
|---|---|
| Size | 240.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ba8fabbfdb4e8be6b5f81626e62a773f356520f144605fcf04ef019c276c92ca
|
|
BLAKE2b-256 checksum How to use checksums |
b2de40cdddae4b964d806bca6d4c55349b04778dc2026e6e2ff294db21da7c57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.
Transparency logRelease files / courtlistener_mcp-1.3.0-py3-none-any.whl
| Download URL | courtlistener_mcp-1.3.0-py3-none-any.whl |
|---|---|
| Size | 231.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
838eebc2046c5511107b61b142d443ec438f8d57f8dd94f674f527fcda54c545
|
|
BLAKE2b-256 checksum How to use checksums |
6639c49ed85d870ca7ab7dc4ff73f03020af09c15bd9cf02e7a7dd4f30c24e14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.
Transparency logSecurity for courtlistener-mcp 1.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for courtlistener_mcp-1.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.