Guide Jul 15, 2026 · 4 min read

How to Extract Citation Data from Claude's New Structured Metadata API

A practical developer guide to programmatically tracking brand citations in Claude API responses using Anthropic's structured metadata features.

Key takeaways
  • Claude's API now returns structured citation metadata, enabling programmatic GEO tracking
  • The citations feature extracts source URLs, titles, and quoted passages when Claude references documents
  • Developers can build automated pipelines to monitor whether their brand appears in AI-generated answers
  • Citation data includes character-level positioning for precise source attribution
  • This approach forms the foundation of scalable visibility intelligence systems

Why Citation Metadata Matters for GEO

When a potential customer asks Claude "What's the best project management tool for remote teams?", the answer may include specific brand recommendations. Whether your product appears—and whether it's properly attributed—directly impacts your visibility in AI-assisted discovery.

Anthropic introduced structured citation support in their Messages API, allowing developers to retrieve not just the generated text, but the underlying sources Claude used to construct its response. For GEO practitioners, this creates an opportunity: programmatic access to the same data that previously required manual prompt-and-check workflows.

Understanding the Citations Feature

Claude's citation system works when you provide source documents alongside your query. The API returns citation objects that link specific response passages back to their source material.

Input
Document content + User query
Claude API
citations: enabled
Output
Response + Citation metadata

The response includes content blocks that contain both the generated text and citation objects pointing to specific document ranges.

API Request Structure

To enable citations, you must provide documents in a structured format and set the appropriate parameters. Here's the essential request shape:

Field Type Description
model string Claude model identifier (e.g., claude-sonnet-4-20250514)
max_tokens integer Maximum response length
messages[].content[].type string Set to "document" for source material
messages[].content[].source.type string "text", "url", or "base64"
messages[].content[].source.data string The actual document content
messages[].content[].citations.enabled boolean Must be true to receive citation metadata

The key requirement: documents must be passed as content blocks with type: "document", and each document block needs citations.enabled: true (Anthropic API Documentation, 2025).

Parsing the Citation Response

When Claude cites a source, the response content array includes objects with type: "cite". Each citation contains:

Property What It Contains
type Always "cite"
cited_text The exact quoted passage from the source
document_index Which input document was cited (zero-indexed)
start_char_index Character position where the citation begins
end_char_index Character position where the citation ends

This granularity lets you reconstruct exactly which parts of your content Claude found relevant—and whether your brand name appeared in the cited material.

Building a GEO Tracking Pipeline

For systematic brand monitoring, you need to move beyond single queries. A practical implementation involves:

1. Define your tracking queries. Create a list of questions your potential customers might ask AI assistants. "Best CRM for startups," "top analytics platforms," "alternatives to [competitor]."

2. Structure your API calls. For each query, you can optionally include competitor content as documents to see what gets cited. Alternatively, use web search-enabled tools when available.

3. Parse citation objects. Extract all cite blocks from responses. Check whether your brand URL or name appears in cited_text fields.

4. Store and aggregate. Log results over time. Track citation frequency, which queries mention you, and which competitors appear alongside.

5. Calculate share of voice. Compare your citation count against competitors across your query set.

Limitations to Understand

Citation metadata only appears when you provide documents for Claude to reference. For monitoring real-world AI search behavior—where users ask questions without supplying sources—you need a different approach: sending queries to AI engines and analyzing their organic responses.

Anthropic's documentation notes that citations are designed for RAG (retrieval-augmented generation) use cases, not for tracking what Claude "knows" from training data (Anthropic, 2025). This distinction matters for GEO: the citations API shows what Claude can cite when given sources, not what it recommends unprompted.

From API Data to Visibility Intelligence

Extracting citation metadata is the first step. The harder problem is doing this at scale: hundreds of queries, multiple AI engines, tracked daily. You need infrastructure for scheduling, parsing, storing, and visualizing the data.

This is where dedicated GEO tracking tools become practical. Mentio handles the orchestration layer—sending prompts to ChatGPT, Claude, and Perplexity, parsing responses for brand mentions and citations, and surfacing share-of-voice metrics over time. Self-hostable, API-first, built for teams who want to own their data.

The citation metadata API is a building block. What you build on top determines whether you have a script or a system.

Frequently asked questions

Does the citations feature work with Claude's web search capabilities?

When Claude uses web search through the API, the citations structure differs. Web search results return as tool use responses with their own URL and title fields. The document-based citation format described here applies specifically to documents you provide in the request. Both approaches can be parsed programmatically, but require different extraction logic.

Can I track citations without providing my own documents?

Not directly with the citations feature. To monitor what Claude recommends organically—without pre-supplied context—you need to query the API as a regular user would and parse the response text for brand mentions. This is the approach GEO tracking platforms use for measuring real-world visibility.

How does this compare to ChatGPT's citation handling?

OpenAI's API handles citations differently, often embedding URLs inline when web browsing is enabled rather than returning structured metadata. Each AI engine requires its own parsing approach, which is one reason cross-platform GEO monitoring involves non-trivial engineering beyond single API integrations.

See how AI engines answer for your brand.

Mentio tracks whether ChatGPT, Claude and Perplexity mention and cite you — own your data, self-host anytime.

Start tracking