Anthropic Citations API: Source Attribution

Anthropic Citations API returns exact passages Claude referenced. Learn how it works, its limitations, and how to combine it with Webcite for full verification.

Pipeline diagram showing Claude Citations API output flowing into Webcite verification for complete source attribution
T
Teja Thota

Building Webcite, the fact-checking and citation API for AI applications.

Anthropic processed over 1 billion API calls in 2024 according to The Verge, 2025, and in January 2025 they shipped a feature that changes how developers handle source attribution: the Citations API. It returns the exact passages Claude referenced when generating a response. This article explains how the Anthropic Citations API works, where it falls short, and how to combine it with Webcite verification for a complete citation pipeline.

Key Takeaways
  • Anthropic Citations API returns structured references to exact passages Claude used, with character-level precision.
  • Citations increased recall accuracy by up to 15% compared to prompt-based citation approaches in Anthropic's internal evaluations.
  • The API only cites documents you provide; it does not verify claims against external sources.
  • Webcite adds independent verification by checking Claude's claims against real-world web sources.
  • A combined pipeline takes fewer than 50 lines of code and catches errors neither tool catches alone.
Anthropic Citations API: A feature of the Claude Messages API that enables Claude to return structured citation objects pointing to exact passages in user-provided documents, including character indices for plain text, page numbers for PDFs, and block indices for custom content.

What the Anthropic Citations API Does

The Anthropic Citations API lets developers send documents alongside a query and receive a response where every factual statement maps back to the specific passage that informed it. Anthropic launched this feature in January 2025, describing it as a way to “ground answers in source documents” and provide “detailed references to the exact sentences and passages” Claude uses, according to Anthropic, 2025.

Here is the core concept. You include one or more documents in your API request. You enable citations on each document by setting the citations.enabled flag. Claude generates a response, and instead of returning a single text block, it returns multiple text blocks. Some blocks contain claims. Others contain the same claims annotated with citation objects that point back to specific locations in your documents.

The API supports three document types:

Plain text documents are chunked into sentences automatically. Citations include character-level indices (0-indexed start, exclusive end) so you can map each citation back to the exact substring in the original document.

PDF documents are processed by extracting text and chunking it into sentences. Citations include page numbers (1-indexed start, exclusive end). PDFs without extractable text, such as scanned images, cannot be cited.

Custom content documents let you define your own chunks. You provide an array of text blocks, and Claude cites them by block index without additional chunking. This is useful for bullet points, transcripts, or pre-chunked RAG results.

All active Claude models support citations, with the exception of Haiku 3, according to the Anthropic documentation. The feature works with Claude 3.5 Sonnet, Claude 3.5 Haiku, and Claude Opus 4.

How the Citations API Works in Practice

Here is a working example using the REST API directly. No SDK required.

const response = await fetch("https://api.anthropic.com/v1/messages", {
  method: "POST",
  headers: {
    "content-type": "application/json",
    "x-api-key": process.env.ANTHROPIC_API_KEY,
    "anthropic-version": "2023-06-01"
  },
  body: JSON.stringify({
    model: "claude-sonnet-4-20250514",
    max_tokens: 1024,
    messages: [{
      role: "user",
      content: [
        {
          type: "document",
          source: {
            type: "text",
            media_type: "text/plain",
            data: "Global AI spending reached $184 billion in 2024. The healthcare AI segment grew 47% year-over-year."
          },
          title: "AI Market Report",
          citations: { enabled: true }
        },
        {
          type: "text",
          text: "What was total AI spending and which segment grew fastest?"
        }
      ]
    }]
  })
})

const result = await response.json()

The response structure is the key differentiator. Instead of returning a single text content block, the API returns an array of content blocks. Each block either contains plain text or text with a citations array:

{
  "content": [
    { "type": "text", "text": "Based on the provided document, " },
    {
      "type": "text",
      "text": "global AI spending reached $184 billion in 2024",
      "citations": [{
        "type": "char_location",
        "cited_text": "Global AI spending reached $184 billion in 2024.",
        "document_index": 0,
        "document_title": "AI Market Report",
        "start_char_index": 0,
        "end_char_index": 49
      }]
    },
    { "type": "text", "text": ". The fastest-growing segment was healthcare AI, which " },
    {
      "type": "text",
      "text": "grew 47% year-over-year",
      "citations": [{
        "type": "char_location",
        "cited_text": "The healthcare AI segment grew 47% year-over-year.",
        "document_index": 0,
        "document_title": "AI Market Report",
        "start_char_index": 50,
        "end_char_index": 101
      }]
    }
  ]
}

Each citation includes a cited_text field showing the exact passage from the source document. Anthropic does not charge output tokens for cited text, which keeps costs manageable. The document_index field tells you which document (0-indexed) the citation came from when you provide multiple documents.

Anthropic’s internal evaluations found that the Citations feature increased recall accuracy by up to 15% compared to prompt-based citation approaches, according to Anthropic, 2025. The improvement comes from the API parsing citations into a standardized format rather than relying on the model to generate citation syntax in its output.

What the Citations API Cannot Do

The Anthropic Citations API has three structural limitations that developers need to understand before building production systems around it.

It only cites documents you provide. The API does not search the web, query databases, or access any information beyond what you include in the request. If you send a single internal report, Claude can only cite passages from that report. It cannot tell you whether the facts in that report are accurate, current, or consistent with external sources. This is document attribution, not fact verification.

It cannot verify accuracy. The Citations API tells you what Claude referenced. It does not tell you whether the referenced content is correct. If your source document contains an outdated statistic, a misquoted study, or a fabricated claim, Claude will faithfully cite it with the same structured precision it uses for accurate content. Stanford HAI researchers found that even RAG-based AI tools hallucinate in 17 to 33 percent of queries, according to Magesh et al., Stanford Law School, 2024. Document attribution does not solve that problem.

It requires documents in specific formats. The API accepts plain text, PDFs with extractable text, and custom content blocks. It does not accept CSV, XLSX, DOCX, or Markdown files natively. You must convert these formats before sending them. Image-only PDFs (scans without OCR) cannot be cited.

These limitations are not bugs. They reflect a deliberate design scope. The Citations API answers “what did the model reference?” Verification answers “is what the model said actually true?” These are complementary functions, and production systems need both. Among the current generation of frontier models, GPT-4o achieves a hallucination rate of just 0.7 percent on factual benchmarks, according to Visual Capitalist, 2025, but even that low rate compounds across millions of daily API calls.

Citation vs Verification: Two Different Problems

Understanding the distinction between citation and verification is critical for developers building trustworthy AI applications. They look similar from the outside but solve fundamentally different problems, as covered in our guide to source attribution in AI.

Citation traces an AI response back to its input. The Anthropic Citations API does this. When Claude says “revenue grew 12%,” the citation shows you the exact passage in the source document that says “revenue grew 12%.” The chain of provenance is complete: you know where the model got the information.

Verification checks whether the claim is true independently. A verification API like Webcite takes the claim “revenue grew 12%,” searches real-world sources, evaluates source credibility, and returns a verdict: supported, contradicted, or insufficient evidence. Verification does not care where the model got the claim. It cares whether the claim is accurate.

Here is the practical difference in a table:

Capability Citations API Verification API
Shows which passage was referenced Yes No
Checks if the claim is true No Yes
Searches external sources No Yes
Scores source credibility No Yes
Works with any LLM output No (Claude only) Yes (any text)
Returns confidence scores No Yes
Detects outdated sources No Yes

A McKinsey report found that 63 percent of enterprises consider AI accuracy their top concern for deployment, according to McKinsey, 2024. Citation alone does not address that concern because it confirms provenance, not accuracy. Verification addresses it directly.

Combining Claude Citations with Webcite Verification

The most robust approach uses both tools in sequence. Claude generates a response with document citations. Webcite independently verifies each claim against external sources. The combined pipeline gives users both provenance (where it came from) and verification (whether it is true).

Here is the complete pipeline in JavaScript using REST APIs only:

// Step 1: Get Claude's response with citations
async function getCitedResponse(documents, query) {
  const response = await fetch("https://api.anthropic.com/v1/messages", {
    method: "POST",
    headers: {
      "content-type": "application/json",
      "x-api-key": process.env.ANTHROPIC_API_KEY,
      "anthropic-version": "2023-06-01"
    },
    body: JSON.stringify({
      model: "claude-sonnet-4-20250514",
      max_tokens: 2048,
      messages: [{
        role: "user",
        content: [
          ...documents.map(doc => ({
            type: "document",
            source: { type: "text", media_type: "text/plain", data: doc.text },
            title: doc.title,
            citations: { enabled: true }
          })),
          { type: "text", text: query }
        ]
      }]
    })
  })
  return response.json()
}

// Step 2: Extract claims from cited response
function extractClaims(claudeResponse) {
  return claudeResponse.content
    .filter(block => block.citations && block.citations.length > 0)
    .map(block => ({
      claim: block.text,
      cited_text: block.citations[0].cited_text,
      document_title: block.citations[0].document_title
    }))
}

// Step 3: Verify each claim with Webcite
async function verifyClaims(claims) {
  const verified = []
  for (const item of claims) {
    const response = await fetch("https://api.webcite.co/api/v1/verify", {
      method: "POST",
      headers: {
        "x-api-key": process.env.WEBCITE_API_KEY,
        "Content-Type": "application/json"
      },
      body: JSON.stringify({
        claim: item.claim,
        include_stance: true,
        include_verdict: true
      })
    })
    const result = await response.json()
    verified.push({
      claim: item.claim,
      source_document: item.document_title,
      cited_passage: item.cited_text,
      verification: {
        verdict: result.verdict?.result,
        confidence: result.verdict?.confidence,
        external_sources: result.citations
      }
    })
  }
  return verified
}

// Full pipeline
async function citeThenVerify(documents, query) {
  const cited = await getCitedResponse(documents, query)
  const claims = extractClaims(cited)
  const results = await verifyClaims(claims)
  return { response: cited, verifications: results }
}

This pipeline produces a response where every claim has two layers of evidence: the internal document passage Claude referenced (from the Citations API) and the external source verification (from Webcite). Users can see both where the information came from and whether independent sources confirm it.

Citations Alone vs Citations Plus Verification

The difference between using the Citations API alone and combining it with verification is the difference between traceability and trustworthiness.

Citations API alone gives you document provenance. You know that Claude’s statement about revenue growth came from page 3 of the quarterly report. If the report says 12%, Claude’s citation confirms it referenced the 12% figure. But if that report was published in error, if the actual figure was later corrected to 8%, or if the report itself was fabricated, the citation still looks valid. There is no external check.

Citations plus verification adds an independent truth layer. After Claude generates a cited response, Webcite checks whether the claims hold up against real-world sources. If three independent financial databases confirm the 12% figure, confidence is high. If they all report 8%, you know the source document is wrong, and you can flag it before the user sees it.

Consider a concrete scenario. A legal research tool uses Claude to analyze contracts. The Citations API shows which contract clauses Claude referenced in its analysis. But if Claude misinterprets a clause, the citation still points to the correct passage; it is the interpretation that is wrong. Verification catches this by checking Claude’s interpretation against legal databases and case law.

Gartner predicts that by 2026, more than 80 percent of enterprises will have used generative AI APIs or deployed AI-enabled applications, up from fewer than 5 percent in 2023, according to Gartner, 2024. At that scale, the cost of unverified AI outputs is measured in regulatory fines, user churn, and liability claims. EU AI Act Article 50 mandates AI output transparency by August 2, 2026, according to the official EU AI Act text. A combined citation and verification pipeline satisfies both the technical and regulatory requirements.

Token Costs and Pricing Considerations

Understanding the cost structure helps you plan a production implementation.

Anthropic Citations API costs follow standard token-based pricing. Enabling citations adds a small number of input tokens for system prompt additions and document chunking overhead. The cited_text field in citation objects does not count toward output tokens, which makes the feature cost-efficient. When cited responses are passed back in subsequent conversation turns, cited_text is also excluded from input token counts.

Webcite verification costs use a credit-based model. Each full verification consumes 4 credits: 2 for citation retrieval, 1 for stance detection, and 1 for the final verdict. Pricing tiers:

Plan Monthly Cost Credits Verifications
Free $0 50 12
Builder $20 500 125
Enterprise Custom 10,000+ 2,500+

For a typical document analysis workflow that generates 5 cited claims per query and processes 100 queries per day, you would need approximately 2,000 Webcite credits per day (500 claims x 4 credits). That fits within an Enterprise plan and costs a fraction of the AI inference costs for the Claude calls themselves.

The efficiency argument is straightforward. According to research by Accenture, enterprises lost an estimated $67.4 billion to AI hallucinations in 2024, according to AllAboutAI, 2026. Even a modest improvement in accuracy from verification yields returns that dwarf the API costs.

Best Practices for Production Deployment

Building a citation and verification pipeline for production requires attention to several engineering concerns.

Parallelize verification calls. The Webcite API processes claims independently. Send all claims simultaneously using Promise.all instead of sequentially. This reduces total verification latency from N times the single-call latency to roughly one single-call latency for N claims.

Cache verification results. Claims that appear frequently (company facts, regulatory dates, product specifications) do not need re-verification on every request. Cache Webcite results by claim text with a time-to-live based on how frequently the underlying facts change.

Use custom content documents for RAG chunks. If your system retrieves documents from a vector store, pass them as custom content blocks rather than plain text. This gives you control over citation granularity and avoids double-chunking. Each RAG chunk becomes a citable unit.

Handle unsupported claims gracefully. Not every Claude claim will have a citation (the model may generate connecting phrases or opinions), and not every claim will have external verification (Webcite may return “insufficient evidence”). Display uncited or unverified claims with appropriate visual indicators rather than hiding them.

Log everything for compliance. Both the Anthropic Citations response and the Webcite verification response should be stored. The Citations response proves what sources the model used. The Webcite response proves those claims were independently checked. Together, they create the audit trail that EU AI Act Article 50 and similar regulations require. The Colorado AI Act and California transparency requirements also take effect in 2026, creating overlapping mandates that require provable AI accuracy, according to Wilson Sonsini, 2026.

What Webcite Adds to the Pipeline

Webcite is the verification layer that the Anthropic Citations API does not provide. Where Claude tells you which document passage it referenced, Webcite tells you whether the claim that passage supports is actually true by checking it against independent sources.

The integration pattern works with any LLM, not just Claude. If you switch from Claude to GPT-4, Gemini, or an open-source model like Llama 3, the Webcite verification step remains identical. Only the citation extraction changes. This makes Webcite a model-agnostic verification layer that protects your pipeline against vendor lock-in. A survey of enterprise AI teams found that 76 percent now include human-in-the-loop verification to catch hallucinations, according to AllAboutAI, 2026. A combined citation-plus-verification pipeline automates that review step.

For developers who need both citation traceability and factual verification, the combined approach delivers what neither tool provides alone: AI outputs where every claim is both sourced and independently confirmed.

Sign up at webcite.co for a free API key with 50 credits per month. The Builder plan at $20/month provides 500 credits for production workloads. For more on how verification APIs work, see our guide to verification APIs.


Frequently Asked Questions

What is the Anthropic Citations API?

The Anthropic Citations API is a feature of the Claude Messages API that returns structured references to the exact passages Claude used when generating a response. You send documents with citations enabled, and Claude returns text blocks interleaved with citation objects pointing to specific character ranges, page numbers, or content block indices in the source material.

Does the Anthropic Citations API verify claims against external sources?

No. The Citations API only references documents you provide in the request. It tells you which passages Claude drew from, but it does not check whether those passages are accurate, current, or supported by independent sources. External verification requires a separate tool like Webcite.

How much does the Anthropic Citations API cost?

Citations uses Anthropic’s standard token-based pricing. Enabling citations adds a small number of input tokens for document chunking and system prompt additions. However, the cited_text field in responses does not count toward output tokens, which offsets much of the cost increase.

Can I use Claude Citations with PDF documents?

Yes. The Citations API supports plain text documents, PDF files, and custom content documents. PDFs are chunked into sentences automatically, and citations include page numbers. Image-only PDFs without extractable text cannot be cited from.

How do I combine Claude Citations with Webcite verification?

First, send your documents to Claude with citations enabled to get a response with exact source passages. Then extract the claims from Claude’s response and send each claim to the Webcite verify endpoint. Webcite checks those claims against independent web sources, returning verdicts, confidence scores, and external citations that confirm or contradict each claim.