
How to Show Sources in Your Chatbot's Answers (and Check They Are Right)
Quick answer: Store a stable ID, title and URL for every piece of content the bot can use. Pass those with each passage when you ask the model, tell it to answer only from them and to name the IDs it used, then build the visible links yourself from those IDs. Finally, sample cited answers every week and check that the source really says what the answer says. A link that looks right but is not is worse than no link.
Step 1: Decide what deserves a source
Not every reply needs one. A greeting, a handoff offer or a clarifying question has nothing to cite. Cite answers that state a fact a customer might act on: prices, policies, deadlines, eligibility, steps for a product.
Write the rule down in one line, for example: "Any answer that states a policy, price, time limit or product fact shows at least one source; replies with no source are limited to greetings, questions and handoffs." Where the bot cannot find a source, it should say so and offer a person, as in the confidence policy, instead of answering without one.
Step 2: Give every piece of content a source record
Citations depend on your content being identifiable. For each article or document in your knowledge base, keep a record with:
- a stable source ID that never changes, even if the page moves;
- a title a customer would recognize;
- the public URL, or a note that it is internal;
- a last-reviewed date.
Attach the source ID to every chunk made from the page. A chunk with no ID cannot be cited, and one with the wrong ID cites the wrong page. If your chunking splits long articles, store the heading too, so you can link to the right section.
Step 3: Make the model cite from what you supplied
There are two common routes.
Native citation features. Some model APIs return citations as structured data. Anthropic's documentation describes enabling citations on each document, after which the response points back to supporting passages with a location, and states that cited_text does not count toward output tokens. OpenAI's file search returns file citations in an annotations array, and Google's Search grounding returns url_citation annotations with start and end positions. Read the limits: Anthropic's page says citations must be enabled on all or none of the documents in a request, are text-only, and return an error if combined with structured-output format settings.
Prompt-based citing. If you call a model without such a feature, pass each passage with its source ID and instruct it. A starting wording, to adapt and test: "Answer using only the passages below. After each factual statement, give the ID of the passage it came from in square brackets. If the passages do not contain the answer, say you do not have that information. Never write a web address."
The last sentence matters. Models asked to write links from memory can produce addresses that look right and are not. Letting the model return IDs only, and having your own code look up the URL, means every link points to a page you control. Test the prompt on your own questions; wording that works on one model may not work on another, so retest after any model change (see versioning prompts).
Step 4: Display sources so customers can use them
Keep the display simple.
- Show the title, not a bare URL, as a link that opens in a new tab so the chat is not lost.
- Put the source close to the answer, as a short "Source:" line under the reply, or a numbered mark that matches a list below. Cite at the level the model can support; if you only know the document, do not imply it is a particular line.
- Limit the count. One to three sources is usually enough; a long list hides the useful one.
- Show a date when the content has a last-reviewed date, especially for policies and prices.
- Do not invent a confidence number. A percentage shown to customers can suggest precision the system does not have. If you want to signal uncertainty, a plain sentence such as "I am not certain; here is the closest article" is easier to interpret. This is our judgment, not a research finding.
Make the links readable with a screen reader and keyboard; see the accessibility audit guide.
Step 5: Audit whether the source supports the answer
A citation proves where the model pointed. It does not prove the passage says what the answer says. Check this on a schedule.
- Sample. Each week, pull 30 to 50 answers that showed a source. Include a few from every topic area, not only the easy ones.
- Open each source and find the passage. Score the answer: supported (the passage says it), partly supported (right page, one detail missing or changed) or not supported (the passage does not say it, or says the opposite).
- Check the link itself. Does it open, to the right page, and is the page current?
- Record the cause of each failure: wrong passage retrieved, model overreach, stale page, or broken link. The cause tells you what to fix; see improving retrieval with reranking and the RAG evaluation guide.
- Set a bar in advance, for example no unsupported answers on pricing or policy topics, and review any that appear.
An LLM-as-a-judge can pre-sort the sample to save time, but a person should read the failures, since judges make mistakes too.
Step 6: Keep sources fresh and handle gaps
Sources age. When a policy page changes, the bot may keep citing an old chunk until your index is rebuilt. Re-index on a schedule, and re-index straight away after any change to pricing or policy. Remove or redirect retired pages so a cited link does not lead to an error.
Decide what the bot does when retrieval finds nothing relevant: say that it cannot find the answer, offer related articles if there are any, and hand off to a person using your escalation playbook. A bot that answers confidently with no source in hand is the failure the whole setup exists to prevent; see reducing chatbot hallucinations.
Check the arithmetic
An invented audit, not a measurement. A team samples 50 answers that showed a source.
- 41 are supported, 5 are partly supported, 4 are not supported. Check: 41 + 5 + 4 = 50.
- Supported rate: 41 ÷ 50 = 82%. Unsupported rate: 4 ÷ 50 = 8%.
- At 600 sourced answers a month, 8% means about 600 × 0.08 = 48 answers where the visible source does not back the claim.
- Reading 50 sources at about 2 minutes each takes 50 × 2 = 100 minutes, a bit under two hours a week.
If the four failures trace to one stale pricing page, fixing that page and re-indexing could remove most of them. Your own numbers will differ; the method is to sample, score, find the cause and fix it.
Common mistakes
- Letting the model write URLs. Build links from stored IDs.
- Citing the whole document for a single fact. It makes checking hard and overstates precision.
- Treating a valid link as proof. Audit the content.
- Never re-indexing. The bot keeps citing old policy.
- Showing a made-up confidence percentage.
- No fallback when nothing is found. The bot answers anyway.
FAQ
How do I make my chatbot show sources?
Keep an ID, title and URL for each piece of content, pass them with the retrieved passages, instruct the model to name the passages it used, and build the visible links from those IDs.
Should the chatbot or my code write the links?
Your code. Have the model return source IDs and look up the URLs yourself, so every link is real.
Does showing sources stop wrong answers?
No. It makes them easier to spot. The cited passage can still fail to support the answer, which is why you audit a sample.
Do hosted chatbot platforms show sources?
Some do, often as a setting. Check the vendor's documentation and test it on your own content rather than assuming.
Should I show a confidence score instead of sources?
We would not show a numeric score to customers, since it can suggest more precision than exists. A source link plus a plain statement of uncertainty is simpler. This is a judgment, not a research result.
How often should I audit citations?
Weekly while you launch, then at least monthly, and after any change to content, prompts or models.
Related guides
- Reduce chatbot hallucinations — the wider set of fixes.
- Build a RAG chatbot — the pipeline that supplies the passages.
- RAG evaluation guide — measuring retrieval and answer quality.
- Chatbot confidence policy — what the bot does when it is unsure.
- Grounding, retrieval-augmented generation and AI hallucination — the glossary entries behind the terms used here.
Sources
- Anthropic, Citations — platform.claude.com/docs/en/build-with-claude/citations, read 23 October 2026: enabling citations per document, citation fields,
cited_textnot counted as output tokens, all-or-none and text-only limits, the structured-output conflict. - OpenAI, File search — developers.openai.com/api/docs/guides/tools-file-search, read 23 October 2026:
annotationswith file citations and thefile_search_call.resultsinclude option. - Google, Grounding with Google Search — ai.google.dev/gemini-api/docs/google-search, read 23 October 2026:
url_citationannotations with start and end indexes. - Chatbotscape evaluation methodology. /methodology (continuously updated).
About this guide
Chatbotscape launched in 2026 as an independent review site for chatbot platforms. This guide is editorial guidance built from the sources above; the steps, the audit method and the worked example are our own practice with invented numbers, and we have not benchmarked any vendor, model or platform.
Last updated
24 October 2026 — first published.