Anthropic Citations API
Type: full-code · Vendor: Anthropic · Language: N/A (HTTP API) · License: proprietary · Status: active · Status in practice: mature · First released: 2025-01-23
The Citations API has Claude ground its answer in supplied source documents and return, for each claim, the exact source span that supports it as a verifiable pointer.
Description. Citations is a feature of the Anthropic Messages API that lets a caller attach source documents to a request and enable citations on them. Claude chunks the documents, and its response is split into text blocks where each block carries a list of citations pointing at specific locations in the source documents (character ranges for plain text, page numbers for PDFs, content-block indices for custom content). The cited_text in each citation is extracted from the document rather than generated, so it is guaranteed to point at real source text. Citations are also emitted incrementally over the streaming API via citations_delta events.
Agent loop shape. The caller includes one or more documents in a Messages request and sets citations.enabled on each. Claude chunks the documents into citable units, answers the question, and returns multiple text blocks where each block pairs a claim with the citations that support it. Each citation references a specific document location and includes the exact cited_text extracted from the source. When streaming, citations arrive as citations_delta events appended to the current text block.
Primary use cases
- grounded question answering over supplied documents
- attaching verifiable source spans to model claims
- citation rendering in RAG applications
- document-grounded summarisation with provenance
Key concepts
- Document chunking (docs) — Supplied documents are chunked to define the minimum granularity of possible citations; plain text and PDFs are chunked into sentences, while custom-content blocks are used as-is, so Claude can cite a single sentence or chain several into a paragraph.
- cited_text → verify-before-cite-gate (docs) — The exact source span backing a claim, extracted from the document rather than generated, returned in each citation and not counted toward output tokens.
- Citation location types → citation-attribution (docs) — Three location formats keyed to document type: char_location (character range, plain text), page_location (page numbers, PDFs), and content_block_location (block indices, custom content).
Patterns this full-code implements —
- ★Verify-Before-Cite Resolution Gate
Citations are parsed and resolved against the provided source documents so every returned cited_text is a valid pointer into a real source, preventing fabricated references.
- ★★Citation Attribution
The response is split into text blocks where each block carries the claim and the list of citations that support it, and every citation references a specific character range, page, or content-block i…
- ★★Citation Streaming
Over the streaming API, citations are delivered incrementally through citations_delta events, each adding a single citation to the citations list on the current text content block so a UI can render…
Neighbourhood
Click any neighbour to follow the lineage. Scroll to zoom, drag to pan.