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

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.2
File Size Uploaded Provenance Actions
courtlistener_api_client-2.0.2.tar.gz 131.7 kB With provenance Details for courtlistener_api_client-2.0.2.tar.gz

Built distribution (wheel)

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

Total release size: 286.5 kB

Release files / courtlistener_api_client-2.0.2.tar.gz

Download URL courtlistener_api_client-2.0.2.tar.gz
Size 131.7 kB
Tags Source
SHA-256 checksum
How to use checksums
aabb3a74574a46174fcaf190ff10a88b998e7525ea53c7e8359f98635448c5f9
BLAKE2b-256 checksum
How to use checksums
f29aec00069b85d3e43f137a362a3509e247e2aa9458b110f9ae6f900fc4d5c7
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 30, 2026.

Transparency log

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

Download URL courtlistener_api_client-2.0.2-py3-none-any.whl
Size 154.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae38780de7df956d75063950954456a4b75ee05d1694ac1af067ddd5aef763fc
BLAKE2b-256 checksum
How to use checksums
c8e90b60419e01efcf6f12b973e29d45ba6c026a86169a1b25bfbd93e97013a4
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 30, 2026.

Transparency log

Security for courtlistener-api-client 2.0.2

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.2.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 30, 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