Guide · Updated 2026-08-07
Answer API
The same RAG pipeline that powers the widget is available over HTTP. Use it to add a “Generate answer from docs” button in your ticketing tool, a Slack slash command, or an MCP-style agent.
Authentication
- botId — your bot UUID from the dashboard.
- botKey — public bot key (Settings → Embed).
- Origin — browser requests must come from an allowed origin. Server-to-server calls without an
Originheader are allowed when the bot key is valid (same rules as the widget API).
POST /chat
JSON request body:
{
"botId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"botKey": "pk_…",
"question": "How do I reset two-factor authentication?",
"conversationId": "optional-existing-id",
"visitor": "zendesk-ticket-4821",
"pageUrl": "https://docs.example.com/security/2fa"
}
Response (shape):
{
"conversationId": "…",
"answer": "…",
"citations": [{ "url": "…", "title": "…" }],
"confidence": 0.72,
"escalate": false,
"actions": []
}
- confidence — retrieval score 0–1. Low values often mean the docs don’t cover the question.
- escalate — true when the honesty gate declines to invent an answer.
- citations — sources used; show these to agents and customers.
POST /chat/stream
Same body as /chat. Response is Server-Sent Events:
start → token* → result (or error).
cURL example
curl -sS -X POST 'https://usedocs.app/chat' \
-H 'content-type: application/json' \
-d '{
"botId": "YOUR_BOT_ID",
"botKey": "YOUR_PUBLIC_BOT_KEY",
"question": "How do I get started?",
"visitor": "ticket-system"
}'
Human handoff
When the bot escalates, configured Slack, Discord, Teams, or webhook integrations notify your team. Use Monitor → Inbox to assign, prioritize, add internal notes, and review the conversation on your own schedule.
Rate limits & quotas
Chat requests count toward your plan’s monthly message quota and per-visitor rate limits.
Handle 429 and quota errors by falling back to a human.