Skip to main content

Official Python SDK for the CourtListener API

Project description

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.results:
    print(opinion)

# Check the total count of matching results
print(response.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.results)   # current page results

if results.has_next():
    results.next()
    print(results.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
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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

courtlistener_api_client-1.1.0.tar.gz (156.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

courtlistener_api_client-1.1.0-py3-none-any.whl (185.0 kB view details)

Uploaded Python 3

File details

Details for the file courtlistener_api_client-1.1.0.tar.gz.

File metadata

  • Download URL: courtlistener_api_client-1.1.0.tar.gz
  • Upload date:
  • Size: 156.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for courtlistener_api_client-1.1.0.tar.gz
Algorithm Hash digest
SHA256 920b8543f77627feb1f3b761aea598fd542c5f0996cb730c658865b2f3c08994
MD5 2b8d212eab9e35fae026e396f613cc5f
BLAKE2b-256 ae8d60101ae5eaa695e11280017437bbe8e4ba7f6ad9c5f839d8e855a9d49954

See more details on using hashes here.

File details

Details for the file courtlistener_api_client-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for courtlistener_api_client-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 96ea3e989f2e0e0d64476071c6040b06e292573aa87c7392250920bac72bbbba
MD5 7d45c42594cf8393c0e7132629f7744c
BLAKE2b-256 88cfe8bbcf92a713c0f1c7c75e5e1776e3974c4a4511139687f13fdd8c9eb560

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page