Skip to main content
Lesson 14 of 16 · Collections, RAG & Files

Citations and Sources in Responses

Lesson 14 of 16 Updated July 29, 2026 Developer
On this page
  1. Trace the origin of every piece of information
  2. Two citation formats
  3. Dual citation in the hybrid pattern
  4. Using citations in an application
  5. Two verification habits
  6. Key takeaways

Trace the origin of every piece of information

A model that answers without showing where its response comes from leaves you with an uncomfortable choice: believe it or recheck everything. RAG with Grok eliminates this dilemma. As soon as the model relies on your collections or the web, it attaches a reference to each claim that allows you to trace back to the original document. This traceability changes the nature of the tool: it transforms a text generator into a documentary instrument, suitable for contexts where you must justify your sources.

Two citation formats

Information from your collections is referenced using the collections:// protocol:

According to your internal documentation [1], the processing time is 48 business hours.

[1] collections://col_xyz789/file_abc123

The reference reads in two parts: col_xyz789 identifies the queried collection, file_abc123 the specific file where the passage was found. You have everything you need to reconstruct a link to the document in your own document management system.

Information retrieved from the web takes the form of a standard URL:

Best practices recommend a 30-second timeout [2].

[2] https://exemple.com/api-best-practices

Dual citation in the hybrid pattern

When both sources are used in the same response, the two formats coexist, and this is where the setup becomes truly interesting:

Your current policy [1] allows for a 48-hour timeframe, which aligns
with industry recommendations [2] suggesting a maximum of 72 hours.

[1] collections://col_rh/file_politique_support
[2] https://exemple.com/standards-support-client

This sentence does three things at once. It reports your actual commitment, compares it to an external reference, and lets you verify each point separately. For a quality manager, this is the difference between “we’re pretty good” and a documented compliance finding. The same citations will then serve to justify a decision to a committee, or to answer an auditor who asks what you relied on.

Using citations in an application

Programmatically, citations return in the structured response of the Responses API, allowing you to process them instead of displaying them as is. Sorting by prefix is enough to separate the two worlds:

for citation in response.citations:
    if citation.startswith("collections://"):
        # Link to internal document
        collection_id, file_id = parse_collection_citation(citation)
        print(f"Internal source: {file_id}")
    else:
        # Web link
        print(f"Web source: {citation}")

On this basis, a sources panel under the response becomes simple to build: a document icon and a link to the file for internal sources, a link icon and the clickable URL for web sources, supplemented by the page number when metadata provides it. This visual distinction is not decorative. If your users cannot see at a glance that a claim comes from an external blog and not your official documentation, they will lend one the authority of the other.

The number of sources also indicates the solidity of the response. Several concordant references indicate information well-established in your corpus; a single one deserves a look; no citation signals that the model answered from its general knowledge, without relying on your documents—a situation perfectly legitimate for a general knowledge question, alarming for a question about your internal procedures.

Two verification habits

You can explicitly request detailed sources in your prompt, which makes the response easier to audit:

Answer the following question by citing precisely
the documents and passages used:
[your question]

This does not exempt you from verification, especially for high-stakes uses—legal, medical, financial. A citation proves that the model consulted that document, not that it understood it correctly: paraphrase can slip, a restrictive condition can disappear in transit. Make it a habit to open the original document and read the passage in context before making a decision that costs money.

Key takeaways

  • Grok cites its sources with two formats: collections:// for internal documents and https:// for the web
  • The hybrid pattern generates dual citations allowing cross-referencing of sources
  • Citations can be used programmatically to create links and evaluate reliability
  • Explicitly request sources in your prompts for more detailed responses
  • Always verify critical citations by tracing back to the original document