How to Get Citations in Claude Responses (Both Methods)
To get citations in Claude responses, you have two distinct paths depending on whether you're working in the browser or building with the API. On claude.ai, toggle Web Search on before you submit your prompt and Claude will append numbered inline links — like [1] and [2] — to claims it draws from live web results. On the Anthropic API, supply your own documents (PDFs or plain text) and set a citations flag on each document block; Claude then returns structured JSON that includes the exact quoted text and its character-level location in the source file. Both approaches serve the same core purpose: making Claude's outputs auditable so you can trace every factual claim back to a real source.
What Exactly Are Citations in Claude?
Citations is a feature that allows Claude to ground its responses in specific source documents or web pages by providing verifiable references to the exact text passages it used to generate an answer. When enabled, Claude automatically identifies which claims in its output are drawn from provided sources and attaches precise references — including exact quoted text and its location — so users can verify the information independently.
The primary purpose of citations is to reduce hallucinations and make Claude's outputs auditable. Instead of trusting Claude's answer at face value, users and developers can trace every factual claim back to a specific sentence or paragraph in a real source document or webpage. This matters enormously in legal, compliance, medical, and research contexts where misattribution has real consequences.
For a full technical reference, see the Citations documentation on the Anthropic API Docs.
How Do You Enable Citations on Claude.ai (Web Search)?
The claude.ai interface ties citations to its Web Search tool. When Claude fetches live web results, it appends numbered citation links to relevant sentences in the response. Here's how to turn it on:
- Open a new chat on claude.ai.
- Locate the toggle/slider icon at the bottom left of the chat input box.
- Click the icon to enable Web Search — the button turns blue when active.
- Team and Enterprise users only: A workspace Admin must first globally enable Web Search in workspace settings before individual users can toggle it on.
- Submit your prompt. When Claude fetches live web results, numbered citation links appear inline in the response.
- Click any numbered link to visit the source URL and verify the claim directly.
Web Search citations became available globally on all Claude plans — Free, Pro, Max, Team, and Enterprise — via the claude.ai interface. You can read more in the Enable and use web search help article.
How Do You Enable Citations in the Claude API?
The API approach is more powerful for developers: you supply your own documents and Claude returns structured JSON with character-level source attribution. Here's the workflow:
- Prepare your document content as plain text (base64-encoded or URL) or a PDF.
- Add a document content block to the messages array in your API request.
- Set the citations flag — specifically
"citations": {"enabled": true}— on each document you want cited. - Important: Citations must be enabled on ALL documents in a request or NONE — mixing is not supported.
- Send the request and parse the response; text blocks will include a citations array with the quoted text and its location in the source file.
- Display the cited text and source references to end users alongside the generated response.
A Minimal API Example
The example below uses claude-sonnet-4-5-20250929 and a short plain-text document to demonstrate the basic citation loop:
client.messages.create(
model='claude-sonnet-4-5-20250929',
max_tokens=256,
messages=[{
'role': 'user',
'content': [
{
'type': 'document',
'source': {
'type': 'text',
'media_type': 'text/plain',
'data': 'The boiling point of water at sea level is 100 degrees Celsius.'
},
'citations': {'enabled': True}
},
{'type': 'text', 'text': 'What is the boiling point of water at sea level?'}
]
}]
)
The response will include a citations array on each text block, containing the exact quoted text and its character-level position in the source document. This confirms the basic citation loop works end-to-end, giving developers confidence before they scale to larger or more complex documents.
When Should You Use Web Search Citations vs. the Citations API?
| Scenario | Best Approach | Why |
|---|---|---|
| Fact-checking recent news or current events | Web Search on claude.ai | Pulls live, publicly available information and attributes it to source URLs |
| Grounding answers in private documents (contracts, manuals, internal knowledge bases) | Citations API | Works with your own files; returns character-level attribution in structured JSON |
| Compliance, legal, or audit use cases requiring a precise source trail | Citations API | Document index and character positions make misattribution nearly impossible |
| Individual or team research where users click through to sources themselves | Web Search on claude.ai | Numbered inline links are immediately clickable; no code required |
| Repeated queries over a large, static document corpus | Citations API with prompt caching | Caching reduces latency and cost while citations keep every answer traceable |
| Schema-compliant JSON output for downstream systems | Structured Outputs (not Citations) | Citations and Structured Outputs cannot be used together in the same request |
What Are the Most Useful Real-World Use Cases?
- Legal document review: A paralegal uploads a dense regulatory PDF via the API with citations enabled and asks Claude to identify specific penalty clauses. Claude returns quoted excerpts with exact character positions, letting the legal team verify each finding against the source document without manually searching hundreds of pages.
- Customer support chatbot: A developer builds a support chatbot backed by multiple product manuals. With citations enabled, every answer links back to the exact sentence in the relevant manual, preventing the bot from hallucinating company policy.
- Academic and news research: A student enables Web Search on claude.ai and asks Claude to summarize recent AI governance legislation. Claude fetches live sources and appends numbered citation links to each factual claim.
- Financial analysis: An analyst uploads several quarterly earnings statements via the API. Claude synthesizes trends and cites the specific sentence and document index for each data point, making the audit trail clear for compliance review.
- Medical or scientific literature: A researcher uploads clinical trial papers and asks Claude to compare efficacy results. Citations show exactly which sentence in which paper each comparative claim is drawn from.
What Are the Most Common Pitfalls to Avoid?
Mixing enabled and disabled documents in one request
Citations must be enabled on all documents in a request or on none of them. Enabling citations on only some document blocks in the same request is not supported and will cause an error. Audit every document block in your payload before sending.
Expecting citations to appear automatically
Citations do not activate on their own for factual questions answered from Claude's training data. On claude.ai, you must explicitly toggle Web Search on before submitting the prompt. On the API, you must supply documents and set citations enabled. Without these steps, Claude responds from its parametric memory with no citations at all.
Using Citations and Structured Outputs together
These two features are mutually incompatible. Citations require interleaving citation blocks with text output, which breaks the strict JSON schema constraints of Structured Outputs. Choose one per request.
Supplying unsupported file formats
Document blocks support PDFs and plain text. Formats like CSV, XLSX, DOCX, and MD are not directly supported as document blocks. Convert these files to PDF or plain text before uploading, or use the Files API for supported upload types.
Not rendering cited text to end users
When you display API outputs to end users, citations to the original source must be included. Always parse the citations array from each text block and display both the cited text and source reference alongside the answer.
Trying to cite images or charts in PDFs
The Citations API currently supports text extraction only. Images, charts, and other visual content inside PDFs cannot be cited programmatically. Ensure all critical information in your PDFs is present as parseable text.
Is the Citations Feature Worth Using for Everyday Tasks?
For casual questions where you just want a quick answer, citations add a small amount of friction — you need to toggle Web Search on or structure an API request. But for any task where accuracy matters — research, legal review, compliance, customer-facing chatbots, or scientific summarization — citations transform Claude from a confident-sounding assistant into a verifiable, auditable tool. The ability to trace every claim back to a specific passage in a real document is what separates a useful AI output from a liability.
For developers building production applications, the Citations API is particularly compelling because the cited text field does not count toward output tokens, meaning you get source attribution essentially for free in terms of cost. Combined with prompt caching for large document corpora, it's a practical foundation for enterprise-grade retrieval-augmented generation pipelines.
Frequently asked questions
Do citations work on the free Claude plan?
Yes. Web Search citations on claude.ai are available on Free, Pro, Max, Team, and Enterprise plans. The Citations API is available to any developer with API access.
Can I use citations with PDFs?
Yes. The Citations API supports PDFs and plain text as document types. However, only text content within PDFs can be cited — images, charts, and other visual elements inside PDFs cannot be cited programmatically.
Why aren't citations appearing in my API response?
The most common reasons are: you didn't set citations enabled on your document blocks, you mixed enabled and disabled documents in the same request (which is not supported), or you're asking a question that Claude answers from training data rather than from a supplied document.
Can I use citations and structured outputs at the same time?
No. Citations and Structured Outputs are mutually incompatible in the same API request. Use Citations when source attribution is the priority, and Structured Outputs when you need a strict JSON schema for downstream systems.
What document formats does the Citations API support?
The Citations API supports PDFs and plain text (base64-encoded or URL). Formats like CSV, XLSX, DOCX, and MD are not directly supported as document blocks and should be converted to PDF or plain text first.
Do I need to enable Web Search for citations to appear on claude.ai?
Yes. On claude.ai, citations are tied to the Web Search tool. You must explicitly toggle Web Search on before submitting your prompt. Without it, Claude responds from its training data with no citations.
Citations in responses is one of 85 features in Claude Master — the independent, continuously updated manual with worked examples, the pitfalls, and the workflows that put Claude to work.
Get Claude Master — founding price →Independent product. Not affiliated with or endorsed by Anthropic. "Claude" is a trademark of Anthropic, used here only to describe the subject of this guide.