API Reference

Call Docsbook from your own backend. Get your key from Integrations in your workspace settings.

Authentication

Every request is authenticated with a Bearer token — your workspace's API key. Find, copy, or reset it from Integrations (click your avatar in the chat input, or your profile dropdown in the admin panel).

Authorization: Bearer dbk_<your_api_key>

Keep your key secret — it grants full access to your workspace's AI chat on your token budget. Resetting a key immediately revokes the old one.

POST /api/v1/chat

Ask a question against your workspace's documentation and get back an answer grounded in your own pages — the same engine that powers the AI chat widget on your docs site, exported as a plain REST endpoint. Useful for building your own support bot, Slack integration, or CLI on top of your docs.

Request body

  • question (string, required) — the question to ask
  • currentPath (string, optional) — the doc page slug the question is asked from, to exclude it from its own citations
  • lang (string, optional) — answer language code; defaults to the workspace's default language
  • sessionId (string, optional) — groups related questions for analytics and webhooks
  • mentionedPages (string[], optional) — page slugs to force into context

Example

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 set a custom domain?"}'

Response

{
  "answer": "You can set a custom domain from the Branding tab...",
  "refs": [{ "pagePath": "design/domains", "title": "Custom Domains", "heading": "Setup" }],
  "follow_up_questions": ["What SSL certificate is used?", "Can I use a subdomain?"]
}

Errors return a JSON body with an error field and an appropriate status code: 401 for a missing/invalid key, 403 if AI chat is disabled for the workspace, and 429if the workspace's AI token budget is exhausted.

Rate limits & usage

API calls spend from the same AI token budget as your workspace's docs chat widget — see Limits in your workspace settings for remaining balance and reset date.