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.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_api_client-2.0.0.tar.gz | 128.8 kB | With provenance | Details for courtlistener_api_client-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| courtlistener_api_client-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for courtlistener_api_client-2.0.0-py3-none-any.whl |
Total release size: 279.3 kB
Release files / courtlistener_api_client-2.0.0.tar.gz
| Download URL | courtlistener_api_client-2.0.0.tar.gz |
|---|---|
| Size | 128.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4df41b67b8ef41a6ee67286bc00ec7fa0c54826e881e8ed23a354af69d94b2a6
|
|
BLAKE2b-256 checksum How to use checksums |
1b943adae96224467bd1eb5210cc1cd5e66e44e38460ec24d0b87570847389c8
|
| 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 16, 2026.
Transparency logRelease files / courtlistener_api_client-2.0.0-py3-none-any.whl
| Download URL | courtlistener_api_client-2.0.0-py3-none-any.whl |
|---|---|
| Size | 150.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ac045e04707a33d67e7dfff7787c4060adfd9925f21cb238b168746a85c1e8b5
|
|
BLAKE2b-256 checksum How to use checksums |
d1ed4a87e64544689002404c5c8cc2520ca3074bacb8304521b812ea2d392a1f
|
| 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 16, 2026.
Transparency logSecurity for courtlistener-api-client 2.0.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_api_client-2.0.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 16, 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.