POST /v1/query: send one question, get back one JSON
response, done. The endpoint is stateless — no session, no setup, no history
to manage.
Run this from a server or your terminal, never from browser code — see
Authentication for why the key is server-side only.
1. Ask a question
2. Read the response
What comes back (SyncResponse, abbreviated):
3. Handle all three outcomes
A response is not always a grounded answer. Your integration must handle the deferral and crisis short-circuits too:- Deferral —
answeris an empty string,citationsan empty array, anddeferral.originalQueryis set. The corpus lacks strong evidence for the query. Present theoriginalQueryback to the user and do not synthesize an answer from training data. - Crisis —
answeris an empty string,citationsan empty array, andcrisiscarries acategory(self-harm,acute-symptom, oripv), alocale, theoriginalQuery, and aresourcesarray. Show the resources verbatim and route the user away from research framing. Never omit or reorder resources.
citations array — never fabricate or
paraphrase a citation that is not in it.
Already building /v1/chat request bodies?
/v1/query also accepts a single-element messages array in place of
question, for continuity with callers already building /v1/chat bodies:
/v1/chat, this array must contain exactly one message with role
user — /v1/query has no multi-turn concept. Sending more than one
message, or a different role, returns 400 invalid_request. Exactly one of
question or messages is required — not both.
Next steps
- Machine-readable output: Structured answers (beta)
- What can go wrong: Errors and rate limits
- Conversations and streaming: see the API Reference tab for
/v1/chat