Skip to main content
POST
Use this endpoint to build a ready-to-use context payload for a retrieval-augmented generation (RAG) pipeline. It runs a ranked universal search behind the scenes, deduplicates and truncates snippets so each page contributes a fair share, and returns a token-budgeted result you can hand directly to an LLM. Choose the shape of the payload with format:
  • txt: A single plain-text string with source URLs interleaved. Best for passing straight into a prompt.
  • json: A JSON-encoded string of the form {"results":[...]} with one entry per snippet. Best when your application needs to render or attribute individual sources.
Set product to bias retrieval toward a specific product or subject when the same query could match multiple domains. The response caps outputTokens at 10,000 and reports resultsCount so you can see how many snippets were included after the budget was applied.

Authorizations

Authorization
string
header
required

The Authorization header expects a Bearer token. Use a universal search API key. Generate one on the API keys page in your dashboard.

Body

application/json
query
string
required

The user question or intent to build context for.

format
enum<string>
required

Shape of the response field. txt returns a single plain-text payload with source URLs; json returns a JSON-encoded string of the form {"results":[...]} with one entry per snippet.

Available options:
txt,
json
product
string

Optional product or subject to bias retrieval toward. When set, it is prepended to the retrieval query.

Response

The assembled context.

requestId
string
required

A unique identifier for this request. Include when contacting support.

query
string
required

Echo of the original query (without any product prefix that was applied during retrieval).

response
string
required

The assembled context. When format is txt, this is a plain-text payload with source URLs. When format is json, this is a JSON-encoded string of the form {"results":[...]} where each result contains the snippet's URL, title, and Markdown.

resultsCount
integer
required

The number of snippets included in response after the token budget was applied.

Required range: x >= 0
outputTokens
integer
required

The approximate token count of response. The endpoint caps this at 10,000 tokens.

Required range: x >= 0