In the hosted chat and the
playground, citations are automatic.
Agentset always applies its citation rules on top of your system prompt, so
customize the prompt freely — don’t add citation-format instructions to it.
This page is for building citations into your own app with the search API.
Return chunk IDs with your context
Include each chunk’sid in the context you pass to the model. IDs stay stable no matter how many searches produced the context, which makes them more reliable than position-based numbering.
Instruct the model to cite sources
Use a system prompt that tells the model to cite by chunk ID.Render citations in your UI
Parse the bracket notation, look each ID up in your search results, and render citations as clickable elements. Leave unknown IDs as plain text.Next steps
- API Reference — Search endpoint parameters and options
- Agentic Search — Let the model search on its own for complex questions
- Ranking — Improve citation relevance with reranking