Back to blog
·5 min readAPI Workflows

AI citation monitoring: measure the answers you actually sampled

Explore API use cases

All Them APIs

Independent API research

A brand appearing once in an AI answer is an observation, not a ranking. The next run may search differently, choose different sources or answer without searching at all. A dashboard that hides those differences can turn normal variation into a dramatic growth story.

You can build a useful AI citation monitor from model APIs and a small source-checking pipeline. Define it as a controlled sample of API answers. Do not label it a measurement of what every ChatGPT or Claude user sees.

Use answer APIs for citations, extraction for source checks

ComponentCatalog optionWhat it measures
Answer with web searchOpenAI Web SearchCited sources in the configured API response
Independent answer sampleAnthropic Web SearchCited sources under a separately recorded model/tool configuration
Check selected source pagesFirecrawlWhat an approved cited page says when you retrieve it

OpenAI's web-search guide describes structured URL citation annotations. Anthropic's web-search reference describes citation objects attached to response content. Write a small adapter for each shape rather than extracting links from generated prose with a regular expression.

A general search result is not the same as a citation in the generated answer. A page can be retrieved without being cited, and a brand can be mentioned without its domain being linked. Keep those as separate measurements.

Freeze a prompt panel before the first run

Choose questions that represent the work a prospective user is doing: finding a category, comparing an option or solving a specific implementation problem. Keep branded and unbranded questions separate. Asking a model to cite your brand measures compliance with that instruction, not spontaneous discovery.

Record prompt version, model identifier, provider, tool version/settings, locale when supported, run time and completion state. Start each independent sample without earlier conversation history. Do not attach your own brand documents if the experiment is intended to measure unaided web discovery.

Repeat the same panel on a schedule and save the raw response in appropriately controlled storage if the provider terms allow it. Track model changes as a new configuration, not a quiet improvement to the old series. Set request and token budgets in the application, not only in the prompt.

Normalize citations without inflating the count

Produce a run record with status, searchUsed, citationUrls, prompt/configuration IDs and timestamps. A completed answer that searched and returned an empty citation list is an eligible zero. An API error or a missing citation field from a broken adapter is not.

This local example counts at most one domain hit per eligible answer. Run it separately for each fixed prompt/provider/model configuration. It includes subdomains on a hostname boundary, so notexample.com cannot count as example.com.

function citationRate(samples, targetHost) {
  if (typeof targetHost !== "string") return null;
  let target;
  try { target = new URL(`https://${targetHost}`); } catch { return null; }
  if (target.username || target.password || target.port || target.pathname !== "/" ||
    target.search || target.hash) return null;
  const host = target.hostname.replace(/^www\./, "");
  if (!host.includes(".") || host.endsWith(".")) return null;
  let eligible = 0;
  let cited = 0;
  for (const sample of samples) {
    if (sample.status !== "completed" || sample.searchUsed !== true ||
      !Array.isArray(sample.citationUrls)) continue;
    eligible += 1;
    const hit = sample.citationUrls.some(value => {
      try {
        const url = new URL(value);
        if (!["http:", "https:"].includes(url.protocol) || url.username || url.password) return false;
        return url.hostname === host || url.hostname.endsWith(`.${host}`);
      } catch { return false; }
    });
    if (hit) cited += 1;
  }
  return { eligible, cited, rate: eligible ? cited / eligible : null };
}

Validate the provider citation objects before producing citationUrls; malformed structured data is an adapter error, not an empty successful answer. Define whether a target includes all subdomains before running the experiment. A multi-tenant hosting domain is usually too broad to identify one brand.

Inspect a citation before explaining why it appeared

For an approved sample, use Firecrawl's document endpoint to inspect the cited page and retain a permitted excerpt with its retrieval time. The later page copy may differ from the version available to the model. Do not claim that a sentence caused the citation simply because it is present now.

Treat fetched text as untrusted source material. It cannot authorize new tool calls or disclose credentials. Use allowlists, redirect validation and network controls when fetching supplied URLs; an HTTPS check alone does not prevent requests into private infrastructure.

Report coverage and variation beside the rate

Show attempted runs, complete searched answers, no-search answers, refusals and errors. Report both numerator and denominator for each configuration. Do not combine provider rates into one score without a stated weighting rule, or report movement as significant on a handful of samples.

Run the fixed approved prompt panel with recorded model and search settings.
Start independent runs without brand documents or earlier conversation history.
Save structured citations and explicit complete/error/no-search outcomes.
Count each target domain once per answer and keep configurations separate.
Inspect only approved cited pages; do not infer consumer AI rankings or causation.
Stop at the request/token budget and report the denominator with every rate.

Test duplicate citations, a subdomain, a lookalike hostname, an empty citation list, a failed run and a successful answer that never searched. For answer correctness rather than visibility, use the web RAG evidence workflow. The model-search cluster and search directory help distinguish answer tools from bare retrieval APIs.