Skip to main content

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? See the CourtListener MCP and its documentation.

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__date_filed__gte="2020-01-01")

# 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

Lookups

A field's lookups are the comparisons you can filter it by, beyond an exact match. The endpoint pages list them after each field, as in date_filed: string (date) (lookups: gt, gte, lt, lte, range, …). Add one to a field name with a double underscore, or pass a dict of lookups:

client.clusters.list(date_filed__gte="2020-01-01")
client.clusters.list(date_filed={"gte": "2020-01-01", "lt": "2021-01-01"})

Fields that point at another endpoint take filters on that endpoint the same way, such as client.opinions.list(cluster__date_filed__gte="2020-01-01").

Available Endpoints

For the full list of endpoints and details about their operations, see the documentation.

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-api-client 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for courtlistener-api-client 2.0.1
File Size Uploaded Provenance Actions
courtlistener_api_client-2.0.1.tar.gz 131.4 kB With provenance Details for courtlistener_api_client-2.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for courtlistener-api-client 2.0.1
File Interpreter ABI Platform Actions
courtlistener_api_client-2.0.1-py3-none-any.whl Python 3 none any Details for courtlistener_api_client-2.0.1-py3-none-any.whl

Total release size: 286.1 kB

Release files / courtlistener_api_client-2.0.1.tar.gz

Download URL courtlistener_api_client-2.0.1.tar.gz
Size 131.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e745d5d091723ed5bd16e0303dae28476113c3cce1bb082b1e8c98a5459e0973
BLAKE2b-256 checksum
How to use checksums
1702edff8b4ad0222678017334b670b1437256737c73b095af7afed6fe3ed150
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 17, 2026.

Transparency log

Release files / courtlistener_api_client-2.0.1-py3-none-any.whl

Download URL courtlistener_api_client-2.0.1-py3-none-any.whl
Size 154.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0e2a879f2f7d5aebb3c9fc5392a6c697670548714ad758cd09a38ce7694fd61
BLAKE2b-256 checksum
How to use checksums
c20d0f5ad074df93e415fc2590980d54518293f883217126491f4d0927ae79c9
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 17, 2026.

Transparency log

Security for courtlistener-api-client 2.0.1

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.

Select from 2 files

Attestation for courtlistener_api_client-2.0.1.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 17, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page