Help centre · Developers
Ask your front desk from your own server. Every answer comes from your documents, with the sources it came from.
Keep keys on your server. A key in a web page or an app can be read by anyone who opens it; the API does not accept requests from browsers for that reason. If a key leaks, revoke it in the same panel and make another.
POST https://getknowbot.com/api/v1/agents/{agentId}/messagesSend your key in the Authorization header as Bearer kb_…, and a JSON body:
message string, required
What your user asked, up to 4,000 characters.
conversationId string, optional
Your own name for the conversation — a user id, a ticket number. Messages with the same id are one conversation, so a follow-up like “and on Saturday?” is understood. Up to 200 letters, digits and . _ - : @. Leave it out to start a new conversation; the response tells you its id. A conversation forgets what came before after a day of quiet.
curl https://getknowbot.com/api/v1/agents/YOUR_AGENT_ID/messages \
-H "Authorization: Bearer $KNOWBOT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"message": "Are you open on Sunday?", "conversationId": "customer-42"}'const response = await fetch('https://getknowbot.com/api/v1/agents/YOUR_AGENT_ID/messages', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.KNOWBOT_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ message: 'Are you open on Sunday?', conversationId: 'customer-42' }),
})
const { reply, citations, conversationId } = await response.json(){
"conversationId": "customer-42",
"reply": "Yes — on Sundays we're open from 10am to 4pm.",
"citations": [
{ "file": "Opening hours.pdf", "page": 1, "section": null },
{ "file": "FAQ.docx", "page": null, "section": "Weekends" }
],
"lookups": []
}reply string
The agent’s answer, in Markdown. It may name its sources inline, as it does in the chat.
citations array
The documents the answer drew on, each once: file, and the page or section where known (otherwise null). Empty when the agent answered without looking anything up, such as a greeting.
lookups array
The connections the answer looked things up in, each once, as { "name": "Stock check" }. Empty unless the agent has connections (Business plan) and used one for this answer.
conversationId string
The conversation this message joined. Send it with the next message to continue.
Each answered message counts toward your plan’s monthly messages, the same as a message on your website, WhatsApp or Telegram. A user who asks for a person is handed over, and shows in your handovers, as on any other channel.
Anything other than 200 comes with an error code. Where your user would have been shown something, reply carries it.
{
"error": {
"code": "message_limit_reached",
"message": "This agent has used its messages for the month. …",
"reply": "Sorry, we can't answer more questions right now."
}
}| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request | The body is not JSON, or a field is missing, empty or too long. |
| 401 | unauthorized | No key, a revoked key, or a key made for a different agent. |
| 402 | plan_required | The agent’s owner is not on Pro or Business. |
| 429 | rate_limited | Too many messages in one conversation (10 a minute) or to one agent (120 a minute). |
| 429 | message_limit_reached | The plan’s monthly messages are used up. |
| 502 | agent_unavailable | The agent could not answer. Safe to retry. |
On the Business plan, your agent can look things up in your own system while it answers: stock, prices, opening times, delivery areas. In the dashboard, open your front desk, go to Setup, then Lookups, and describe an address and the inputs it takes. Your agent decides when to call it, and fills in only those inputs.
GET https://api.example.com/stock?sku=A7-200
Accept: application/json, text/plain;q=0.9
User-Agent: Knowbot-Connection/1 (+https://knowbot.bearcodelab.com/docs/api)
X-Api-Key: <the secret you saved>Method GET
Always a GET. Inputs are added to the query string, encoded. The address and its path are exactly what you saved.
Headers optional
The one header you named, with its secret, if you set one. Check it on your side. Knowbot also sends Accept and a User-Agent starting Knowbot-Connection/1.
Your answer JSON or text
A 200 with JSON or plain text, under 64 KB, within 5 seconds. Redirects are not followed. Return only what the agent needs to answer.
Your visitors are anonymous, so a connection must not return anything about one particular person, such as an order by its number or a customer by their email. Knowbot treats what you return as data, never as instructions, and does not keep it after the answer. Addresses must be public HTTPS, and the agent makes at most three lookups per answer.
Write to hello@bearcodelab.com. The API lives at https://getknowbot.com/api/v1; a change that would break an integration gets a new version, not a change to this one.