ReferenceTools
get_document
Retrieve court opinions and docket entries with smart chunking
get_document
Retrieve legal document content with multiple retrieval modes. Supports full text, summaries, document chunks, and semantic search for relevant sections.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
document_type | string | Yes | - | opinion or docket |
document_id | integer | Yes | - | Document ID (cluster_id for opinions, docket_id for dockets) |
cluster_id | integer | No | - | Alias for document_id (opinions only) |
mode | string | No | full | Retrieval mode (see below) |
query | string | No | - | Search query for relevant mode |
max_chunks | integer | No | 5 | Maximum chunks to return (1-20) |
Retrieval Modes
| Mode | Description | Best For |
|---|---|---|
full | Complete document text | Reading entire opinions |
summary | AI-generated case summary | Quick case overview |
chunks | Document sections (facts, holding, reasoning) | Structured analysis |
relevant | Chunks most relevant to your query | Targeted research |
Example: Full Document
{
"document_type": "opinion",
"document_id": 85987
}Response:
{
"document_type": "opinion",
"cluster_id": 85987,
"case_name": "Marbury v. Madison",
"court": "scotus",
"date_filed": "1803-02-24",
"mode": "full",
"text": "It is emphatically the province and duty of the judicial department to say what the law is...",
"source": "R2 Storage"
}Example: Summary Only
{
"document_type": "opinion",
"document_id": 106286,
"mode": "summary"
}Response:
{
"mode": "summary",
"case_name": "New York Times Co. v. Sullivan",
"summary": "The Supreme Court held that the First Amendment requires public officials to prove \"actual malice\" to recover damages for defamation, establishing a high bar for libel claims against the press...",
"source": "R2 Storage"
}Example: Relevant Chunks
Find sections most relevant to a specific query:
{
"document_type": "opinion",
"document_id": 106770,
"mode": "relevant",
"query": "right to counsel in criminal cases",
"max_chunks": 3
}Response:
{
"mode": "relevant",
"query": "right to counsel in criminal cases",
"chunk_count": 3,
"chunks": [
{
"type": "holding",
"content": "The right of an indigent defendant in a criminal trial to have the assistance of counsel is a fundamental right...",
"index": 5,
"relevance_score": 0.847
},
{
"type": "reasoning",
"content": "The Sixth Amendment's guarantee of counsel is made obligatory upon the States by the Fourteenth Amendment...",
"index": 7,
"relevance_score": 0.812
},
{
"type": "summary",
"content": "**Key Facts:** Clarence Earl Gideon was charged with breaking and entering...",
"index": 0,
"relevance_score": 0.756
}
],
"source": "D1 chunks (ranked by relevance)"
}Chunk Types
When using chunks or relevant mode, sections are categorized:
| Type | Description |
|---|---|
summary | AI-generated case summary |
facts | Factual background |
procedural | Procedural history |
issues | Legal issues presented |
holding | Court's decision |
reasoning | Legal analysis |
dissent | Dissenting opinions |
concurrence | Concurring opinions |
full | Uncategorized text sections |
Response Fields
| Field | Type | Description |
|---|---|---|
document_type | string | opinion or docket |
cluster_id | integer | Document identifier |
case_name | string | Case name (parties) |
court | string | Court identifier |
date_filed | string | Filing date |
mode | string | Retrieval mode used |
text | string | Full document text (full mode) |
summary | string | Case summary (summary mode) |
chunks | array | Document sections (chunks/relevant modes) |
chunk_count | integer | Number of chunks returned |
source | string | Data source used |
How Chunking Works
Documents are automatically chunked on first request:
- Section extraction - Identifies legal document sections (facts, holding, etc.)
- AI summarization - Generates a concise case summary
- Embedding creation - Creates vector embeddings for semantic search
- Caching - Chunks are stored for fast subsequent retrieval
The relevant mode uses semantic similarity to rank chunks by relevance to your query.
See Also
- Document Chunking - How smart chunking works
- Search for Cases - Find cases to retrieve
- Semantic Search - Search by concept