概览

Ask the documentation a question

POST/api/v1/chat

Ask this workspace's documentation a question and get one grounded answer back, with the pages it was drawn from. This is the same retrieval and the same model call the Ask AI widget on the published docs site makes — not a second engine — so an answer here and an answer there agree, and a fix to one is a fix to both.

The call spends from the workspace's own AI budget, the same wallet the widget spends from. There is no separate API quota.

Authorization
Authorizationstringrequired

Your API key, sent as Authorization: Bearer dbk_YOUR_API_KEY.Sent as the Authorization header. Your key is used only by your browser for this request — it is never sent to Docsbook or stored.

Body
questionstringrequired

What to ask the documentation.

currentPathstring

The page the reader is on, so the answer can prefer nearby context.

langstring

Answer in this language. Defaults to the workspace's default language.

sessionIdstring

Groups several calls as one conversation, the way a multi-turn chat is.

mentionedPagesstring[]

Page paths to put in front of the model regardless of what retrieval finds.

Request
curl -X POST 'https://docsbook.io/api/v1/chat' \
  -H 'Authorization: Bearer dbk_YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"question":"How do I connect a custom domain?","currentPath":"guides/advanced/custom-domain"}'

Responses#

Status Meaning
200 The grounded answer, its sources, and suggested follow-up questions.
400 question was missing or empty.
401 Missing or invalid API key.
403 AI chat is switched off for this workspace.
429 The workspace's AI spend budget is exhausted.

此页面对您有帮助吗?