Asks the assistant one question and returns the answer, with the documents it came from. This is the endpoint the website widget uses, and the one to use for your own integration.
Accepts a secret key, a website key or a preview key. See Keys.
Request
Section titled “Request”| Field | Type | Required | Description |
|---|---|---|---|
question | string | Yes | The customer’s question. Leading and trailing spaces are trimmed. 1 to 2,000 characters. |
history | array | No | The conversation so far, oldest first, as { "role": "user" | "assistant", "content": "…" } objects. Only the last six are used. Other roles are ignored. |
session_id | string | No | Your ID for this conversation. Shown in Conversations to group its answers. Up to 80 characters are kept. |
Send history for follow-up questions. Without it, a question such as “and on the yearly plan?” can’t be understood. Include the assistant’s earlier answers as assistant turns, and leave out the question you’re asking now. Long turns are shortened: the assistant reads up to 1,000 characters of each.
Any other fields are ignored. In particular, the model and tone always come from Assistant settings.
Example
Section titled “Example”A follow-up question, with the conversation so far:
Response
Section titled “Response”A 200 with the answer:
| Field | Type | Description |
|---|---|---|
answer | string | The answer, or your decline message. May contain light Markdown: **bold**, `code`, - bullets and 1. steps. |
status | string | answered, or declined when your documents don’t cover the question. |
citations | array | The documents the answer used, one entry per document, in the order used. Empty when declined. |
citations[].doc | string | The document’s name: the file name, the page title, or the name you gave pasted text. |
citations[].url | string or null | The page’s address, for documents added as a web page or from a sitemap. null for files and pasted text. |
citations[].quote | string | The passage the answer used, up to 280 characters, with … when shortened. |
latency_ms | integer | How long the answer took on Snoowl’s side, in milliseconds. |
answer_id | string | This answer’s ID. Send it to POST /feedback with a thumbs up or down. |
A declined answer looks like this:
Use status, not the text, to tell the two apart. For example, offer a “Contact support” button when status is declined.
Errors
Section titled “Errors”Errors use the error format every endpoint uses. The ones to expect here:
| Status | Why |
|---|---|
400 | question is empty or over 2,000 characters |
401 | The key is missing, unknown or revoked |
402 | The workspace’s prepaid balance is used up |
403 | A website key used from a site that isn’t on its list |
429 | The key’s per-minute limit or monthly cap is reached |
503 | The answer couldn’t be written just now. Retry after a short wait. Not charged. |
Each answer is charged and logged in Conversations. See Billing.