Ask a question about your saved items
Ask questions about the caller's own saved items. By default each request is stateless: send the conversation so far (at most 20 messages of up to 4000 characters, ending with a user message) and get the next answer.
Chat memory (only when the server runs with CHAT_MEMORY=true; the answer then carries conversation_id).
The first turn starts a saved conversation. Send its conversation_id with later turns and only the new
user message: the server uses the stored messages as the history and ignores any earlier ones sent. A
conversation lasts one day from its first message, then it can no longer be read or continued (404
chat.conversation_not_found) and is deleted. It holds at most 100 messages (409 chat.conversation_full).
Each turn turns the latest message into a search query, searches the caller's items (never other people's,
not even items shared with them), and answers only from the best matches, citing them as [n]. The answer
comes back with the sources it cites.
A turn uses two model calls from the daily AI allowance (one when nothing matches). Errors: 503 when the server has no AI model, 429 when today's allowance (it resets at midnight UTC) or the hourly chat limit is used up, and 502 when the model fails or returns something unusable. Saved pages are untrusted text, and the model gets them as data only.
Streaming. Send Accept: text/event-stream to get the turn as server-sent events instead of one JSON body:
queryonce,{"query": "..."}: the search being run, as soon as it is known.deltaany number of times,{"text": "..."}: the next piece of the answer. Citations to items that do not exist are already removed, and a half-written[12is held back until it is checked.donelast, with the sameChatAnswerbody as the JSON response. Replace the streamed text with itsanswer: it is trimmed and length-capped, so it can differ slightly from the joined pieces.errorinstead ofdoneif the turn fails after events began:{"error": {"status": 502, "type": "upstream_error", "message": "..."}}. Pieces already shown were real answer text, but the answer is incomplete.
Anything refused before the first event (validation, plan, allowance, rate limit, AI off) is the usual JSON error with its status code. The cost and limits are the same as a plain turn.
bearerAuthorizationBearer <token>A personal API key (ga_…), sent as Authorization: Bearer ga_…. A key gets 403 on a resource it has no access to, and on anything that changes data without write access.
application/json- body
conversation_id?stringContinue this saved conversation (chat memory only). Omit to start one.
messages*array<>1 <= items <= 20The answer and the items it cites
- response
answer*stringPlain text, with citations like [1]
query*stringThe search that was run for this turn
sources*array<>Only the items the answer cites, in order
conversation_id?stringThe saved conversation this turn belongs to. Only with chat memory on.
curl -X POST 'https://example.com/v1/chat' \ -H 'Content-Type: application/json' \ -d '{ "messages": [ { "role": "user", "content": "string" } ]}'{ "answer": "string", "query": "string", "sources": [ { "n": 0, "id": "string", "kind": "link", "title": "string", "url": "string", "domain": "string" } ], "conversation_id": "string"}