AI Visibility Tracking ToolFree checker

Logging Retrieved vs Cited Sources via API

99Visibility Research · Updated October 21, 2026 · 8 min read

Short answer

Retrieved sources are every URL a model consulted while answering. Cited sources are the subset it attached to the answer. As of October 2026, the OpenAI, Anthropic and Perplexity APIs return both, so you can log them side by side for each prompt. Record the model, the retrieval state and both lists on every run. Treat citation counts as a noisy proxy for influence, and remember that API answers are not the consumer apps.

Key takeaways

  • OpenAI, Anthropic and Perplexity APIs expose the retrieved set separately from the cited set, and the retrieved set is usually larger.
  • Log both lists per run, with model ID, retrieval state and timestamp, or the data cannot be compared over time.
  • Citations undercount influence: a model can use a source without citing it, and citation units differ by platform.
  • An empty retrieved list usually means search did not fire or was not enabled, not that your brand is invisible.
  • API logs are a controlled proxy for the consumer apps, which pick models and decide on search differently.

What the APIs return, and why two lists matter

Every AI answer built on live search has two source sets. The retrieved set is what the model pulled into its context. The cited set is what it chose to show the reader. Most tracking tools count only the second. The APIs give you both.

As of October 2026, here is what each one exposes:

API Retrieved set Citation unit Watch for
OpenAI Responses API, web_search A sources list of every URL consulted URLs attached to the answer Sources usually outnumber citations
Anthropic web search tool Results with url, title, page_age Text spans, cited_text up to 150 characters Billed at $10 per 1,000 searches plus tokens
Perplexity Agent API search_results with id, url, title, snippet, date, last_updated Whole sources, by integer index Web search is opt-in
Gemini API, Grounding with Google Search Grounding results Inline citations The model writes and runs its own queries

OpenAI's own documentation says the number of sources is often greater than the number of citations. That gap is the point of logging both.

The two lists answer different questions. Being retrieved means your page reached the candidate pool for that query. Being cited means the model also surfaced it to the reader. A page can pass the first gate and fail the second. For the full distinction, see what retrieved sources are and cited vs retrieved: what AI citations really mean.

How to log retrieved and cited sources, step by step

This works for any API that returns both lists. Each step makes the log comparable between runs.

  1. Write a fixed prompt set. Use the buyer questions you actually care about. Keep the wording identical between runs.
  2. Pin and record the model ID. Use an explicit model name, not a floating alias, and store it with every row. If you use an alias, log what it resolved to.
  3. Turn web search on explicitly. On Perplexity's Agent API, web search is opt-in. Code still pointed at the retired Sonar Chat Completions endpoint (retired 2026-09-27 per Perplexity's announcement) can silently return ungrounded answers. Read Perplexity prompt tracking with the Agent API before you trust old scripts.
  4. Store the raw response first. Save the full JSON untouched. You'll want to re-parse it when a field changes.
  5. Extract the retrieved URLs. Normalize them: lowercase the host, strip tracking parameters, and keep the final URL after redirects.
  6. Extract the cited URLs. On Perplexity, map each integer citation back to its entry in search_results. On Claude, map each cited span to its result URL and keep the cited_text. See how Claude picks sources for the span format.
  7. Label every URL. Mark each one as retrieved and cited, or retrieved only. Flag your own domain, competitors and third-party pages that mention you.
  8. Log the search queries if the response exposes them. OpenAI rewrites prompts into targeted queries, and Gemini generates its own. Those queries are often not your prompt.
  9. Run each prompt more than once. Answers vary between runs. Record how many runs you did, so a single odd answer does not read as a trend.

Budget before you scale. Anthropic bills searches separately from tokens, and Gemini 3 bills per search query rather than per prompt.

Checklist: what every log row needs

If a row is missing one of these, you can't compare it to next month's row.

  • Timestamp in UTC
  • Platform and API endpoint
  • Exact model ID returned in the response
  • Retrieval state: search enabled, and whether it actually fired
  • Prompt text and prompt ID
  • Search queries the model ran, where exposed
  • Full retrieved URL list, normalized
  • Cited URL list, normalized
  • Citation unit: span, URL or source index
  • Cited text for span-level citations
  • Date fields per result (page_age, date, last_updated)
  • Answer text
  • Run number for repeated prompts
  • Raw response reference, so you can re-parse later
  • Your own label per URL: own site, competitor, third party

Keep date fields as observations. They are publisher-declared, and no vendor says they drive source selection.

Why citation counts undercount influence

A citation is a display decision. It is not a full record of what shaped the answer.

Three reasons to treat counts as a noisy proxy:

  • The retrieved set is larger than the cited set. Pages the model read but did not cite can still shape the wording. You only see them if you log retrieval.
  • Citation is mechanically separable from use. Researchers studying attribution in RAG found that amplifying specific attention heads repaired more than 90% of missed citations without changing the sources. The model had the source either way. Only the citation changed.
  • Units do not match across platforms. Claude cites text spans. Perplexity cites whole sources. Adding them into one number mixes different things.

The undercount is probably not random. It may favour well-known sources over smaller ones, so a small brand's real footprint can be larger than its citation count suggests. Report retrieved and cited counts separately, per platform, and never as one blended figure.

API answers are not the consumer apps

Your API log is a controlled experiment. The apps people use are not controlled, and they behave differently.

As of a September 2026 snapshot:

  • ChatGPT decides at the model's discretion whether to search. Your API call searches because you told it to.
  • Claude.ai search is a user toggle with no published default.
  • Perplexity's free tier uses an auto-router, and paid tiers offer a menu of models. No single API model is the app.

Logged-in ChatGPT can also use saved memories when rewriting a search query, according to OpenAI's help documentation. Two users asking the same question can trigger different searches.

So read API logs as a proxy. They show what a given model retrieves and cites under fixed conditions. They do not show what a specific user saw. If you are deciding how to configure tests, read whether to test with web search on or off.

Reading the results: good and bad patterns

Each pattern points to a different next move.

Good: retrieved and cited

Your pages show up in both lists for your core prompts. Keep the facts on those pages current and stated plainly.

Mixed: retrieved but not cited

You reached the candidate pool and lost at generation. Don't rush to rewrite for AI. Benchmarks such as C-SEO Bench found most citation-oriented rewrites ineffective or harmful. What has a positive signal is stating specific facts (a price, a number, a one-line definition) on a fetchable page, which gives the engine a sentence it can quote.

Bad: never retrieved, competitors are

Check access first. Confirm robots.txt allows the search bots (OAI-SearchBot, PerplexityBot, Claude-SearchBot), confirm your firewall or CDN does not return 403 to them, and confirm key content is in the HTML before JavaScript runs. The AI Crawler Checker requests a page as each AI crawler and shows which ones get turned away.

Bad: third-party pages retrieved, yours never

When engines lean on other sites, being named accurately on those sites is associated with getting into the answer. No outcome is guaranteed.

Not a finding: empty retrieved list

Search did not fire or was not enabled. Fix the request before drawing conclusions.

Urgent: a retrieved source carries a wrong fact

That source may explain an error in the answer. Trace it with how to find which source caused a wrong AI fact.

How often to repeat it

Pick a fixed cadence and hold it. Monthly works for most brands. Weekly makes sense during a launch or a pricing change.

Also re-run outside the schedule when:

  • The model ID in the response changes. Start a new baseline. Don't trend across models.
  • You ship an access fix, such as a robots.txt change, a firewall rule or server-side rendering.
  • A vendor changes an endpoint or a default, as Perplexity did with Sonar.

Compare only like with like: same prompts, same model, same retrieval state, same number of runs.

Frequently asked questions

Can I see which sources ChatGPT looked at but didn't cite in the app?

Not in the consumer app, as of October 2026. The retrieved list is exposed in the OpenAI Responses API through its web search tool, which returns consulted sources separately from citations. The app shows only what it cites. Running the same prompt through the API gives you a controlled view of the retrieved set, with the caveat that the app may choose differently. More detail is in [can I see sources ChatGPT retrieved but didn't cite](/questions/see-sources-chatgpt-retrieved-not-cited).

Should I combine retrieved and cited counts into one visibility score?

No. Platforms cite in different units: Claude cites text spans, Perplexity cites whole sources by index, OpenAI attaches URLs. A sum across them has no shared denominator. Keep retrieved and cited counts separate, per platform and per model. If you must summarize, report each platform on its own line with the retrieval state stated, so a reader can see what was actually measured.

Does a large gap between retrieved and cited mean my content is weak?

Not by itself. OpenAI's documentation says sources usually outnumber citations, so a gap is normal. Citation also depends on the model's internal attribution, which research shows can miss sources it used. Look for patterns across prompts and runs instead. If your pages are retrieved often but almost never cited, check that key facts are stated plainly on the page rather than rewriting for an assumed AI style.

Does Google AI Overviews expose a retrieved source list?

No official API exposes AI Overviews answers or their retrieval set, as of October 2026. Search Console's generative AI report shows impressions only, with no clicks or position data. The Gemini API's Grounding with Google Search returns citations, but it is a separate retrieval path and not the same thing as AI Overviews or AI Mode. Treat any Gemini API log as a Gemini log, not an AI Overviews log.

How many runs per prompt do I need?

No published study sets a number. Answers vary between runs, so one run per prompt cannot separate a real pattern from noise. Run each prompt several times under identical settings, record the run count in every row, and compare months only when the run counts match. More runs cost more, especially on APIs that bill per search, so set the number once and hold it.

Sources

  1. Web search tool - Claude Platform Docs
  2. Migrate from Sonar to the Agent API - Perplexity
  3. Grounding with Google Search | Gemini API | Google AI for Developers
  4. [2606.28358] How Do LLMs Cite? A Mechanistic Interpretation of Attribution in Retrieval-Augmented Generation
  5. Searching the web with ChatGPT
  6. [2506.11097] C-SEO Bench: Does Conversational SEO Work?

This page is AI-assisted. It was written from a verified evidence base and checked against our editorial policy. Engine behaviour changes often; facts are as of October 21, 2026.

Keep reading