SupportBotSupportBotDocs
Updated October 18, 2026

Developer API

Ask a bot questions from your own app, website or backend. The same knowledge base and the same escalation to your team as in the messengers.

Overview

The API is one JSON endpoint per action under https://api.supportbot.info/v1. Every bot has its own key, so a request always talks to exactly one bot and its knowledge base. Conversations through the API appear in that bot's Inbox, where your team can reply. The Developer API is part of the Pro and Business plans.

EndpointUse it for
POST /v1/chatSend the conversation, get the bot's answer.
POST /v1/pollFetch replies your team wrote in the Inbox.
GET /v1/widget-configRead the saved widget style.

Authentication

Send the bot's key as a bearer token. Find it in the dashboard: open the bot, click API, then Reveal or Copy.

Authorization: Bearer sb_5d2c8e1f0a7b4c39e6d1f2a8b7c4e90d
  • Rotate issues a new key and stops the old one immediately, including in every widget snippet that uses it. Put the new key in your code and snippets right after rotating.
  • The website widget puts the same key in your page's HTML, so anyone can copy it and send requests that count toward your monthly answers. Rotate the key if it is misused.
  • Use long random session_id values, for example a UUID, because anyone with the key can read the team replies of a session_id they know.

POST /v1/chat

Send the conversation so far; the last message must be from the user. The bot answers that last message, using the earlier ones as context.

curl https://api.supportbot.info/v1/chat \
  -H "Authorization: Bearer sb_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      {"role": "user", "content": "My X200 shows error E04"}
    ],
    "session_id": "3f9c2a7e-5b1d-4e8a-9c6f-2d7b8e1a4c90",
    "end_user_id": "customer-7421"
  }'

Request fields

FieldTypeDescription
messagesarray, requiredTurns with role (user or assistant) and content (a string or content blocks). The last turn must be user, and its text can be up to 8000 characters.
session_idstringYour ID for this conversation; send the same value on every turn. It keeps one thread in the Inbox, lets your team take over, and is needed for /v1/poll and debounce. Without it every request opens a new Inbox conversation and team replies cannot reach you. Use a long random value.
end_user_idstringYour ID for the person. Shown in the Inbox and in escalations.
langstringTwo-letter default language, for example en or uk. The user's own language still wins when it is clear.
privatebooleantrue keeps the conversation out of the Inbox and notifies nobody. The response can still have escalated: true and a line saying a person will reply, so handle that yourself. It still counts as an answer. Default false.
originstringapi (default) or widget. Labels the conversation in the Inbox.
hoststringThe website the request came from, shown in the Inbox.
last_seen_message_idintegerThe highest team-reply ID you already showed. Newer team replies come back in admin_messages.
fastbooleanDefault true: a quick first step answers greetings and questions covered by the bot's description at once. Product questions go to the full search over cases and documents, and a request for a person is handed off. false always runs the full search, which takes longer. Ignored when the last message has files.
debouncenumberSeconds to wait (up to 30) for more messages in the same session_id. A newer request cancels the older one, which returns debounced: true.

Attachments

To send a photo, voice note or document, make the last message's content an array of blocks. Files go inline as base64 or a data URL; links to remote files are not fetched.

{
  "role": "user",
  "content": [
    {"type": "text", "text": "What does this error mean?"},
    {"type": "image", "data": "data:image/png;base64,iVBORw0KG..."}
  ]
}

Each block has a type (image, audio, video, document or file), the data and an optional file name. The real file type is detected from its content. Up to 4 images (20 MB in total) are looked at. Voice and video are transcribed, documents are read. Attach files to the last message only.

Response

{
  "id": "msg_18f3a9c41d2",
  "session_id": "3f9c2a7e-5b1d-4e8a-9c6f-2d7b8e1a4c90",
  "inbox_session_id": 4182,
  "reply": "E04 means the feed roller is not picking up the sheet...",
  "escalated": false,
  "case_id": "a17b989687474ff2b7f624135d94d784",
  "sources": [
    {"title": "Case", "url": "https://supportbot.info/case/a17b989687474ff2b7f624135d94d784"}
  ],
  "tool_calls": [],
  "attachments": [],
  "usage": {},
  "admin_messages": []
}
FieldMeaning
replyThe answer text. On a handoff it is, or ends with, a short line saying a person will reply. Empty when queued_for_human or debounced is true.
escalatedtrue when the bot handed the conversation to your team. See Human handoff.
sourcesUp to 5 past cases the search found for this question (title is always "Case"); the reply may not use all of them.
case_idThe case linked in the reply text, or null.
attachmentsFiles the bot attached as evidence, if any.
admin_messagesTeam replies newer than your last_seen_message_id, each with id, text and ts.
inbox_session_idThe conversation's ID in the Inbox, when it is recorded there.
limited, debounced, queued_for_humanPresent and true when limits stopped the answer, a newer request replaced this one, or a person currently owns the conversation.
tool_calls, usageAlways empty for now; ignore them.

Human handoff

When the user asks for a person, or the bot should not answer alone, the response has escalated: true. The conversation is marked escalated in the bot's Inbox and your team gets a private message about it.

  • After a handoff, or once your team replies, new messages get queued_for_human: true and an empty reply instead of a bot answer. This ends when someone clicks Done in the Inbox, or 3 hours after the last message from the bot or your team.
  • Team replies reach you in admin_messages: either on the next /v1/chat call or by polling /v1/poll.
  • Show them as written by a person. The widget labels them "Human support".

POST /v1/poll

Check for new team replies without sending a message. Poll every few seconds while a conversation is escalated.

curl https://api.supportbot.info/v1/poll \
  -H "Authorization: Bearer sb_your_key" \
  -H "Content-Type: application/json" \
  -d '{"session_id": "3f9c2a7e-5b1d-4e8a-9c6f-2d7b8e1a4c90", "origin": "api", "last_seen_message_id": 0}'

{"admin_messages": [{"id": 9, "text": "...", "ts": 1760352000000}],
 "status": "escalated", "admin_typing": false}

status is open or escalated. admin_typing is true while someone on your team is typing. An unknown session_id returns an empty list with status open.

Send "origin": "api" for API conversations; without it the poll looks for a widget conversation.

Embed the widget

The widget is a chat bubble that talks to /v1/chat for you. Copy the snippet from the bot's API › Chat widget tab, or write it yourself:

<script
  src="https://supportbot.info/widget.js"
  data-token="sb_your_key"
  data-accent="#2C6BED"
  data-position="bottom-right"
  data-greeting="Hi! Ask anything about Acme."
  defer></script>

It opens in its own frame, so your page's CSS does not affect it. Conversations are kept in the visitor's browser: for the current tab only, or across visits in that browser when you set data-end-user-id.

To style the widget from your website, open the bot's API › Chat widget tab and use Auto-brand from your site.

Widget attributes

AttributeDefaultDescription
data-tokenThe bot's key. Required.
data-accent#2C6BEDColor of the bubble, the user's messages and the send button.
data-positionbottom-rightbottom-right or bottom-left.
data-greetingThe first message shown when the chat opens. A greeting in Cyrillic switches the widget's labels to Ukrainian and makes Ukrainian the default reply language; otherwise the default is English.
data-radius14Corner radius in pixels.
data-fontCSS font-family inside the widget. Empty uses the system font.
data-end-user-idYour logged-in user's ID. Shown in the Inbox and in escalations, and keeps their chats in this browser after the tab is closed. Chats do not move between devices.
data-autobrandonon: if the bot has no saved widget CSS yet, the first page view reads your page's colors, font and logo and saves them as the bot's widget style for every page. off keeps only your attributes and the dashboard style.

A saved style, from the dashboard or from data-autobrand, takes priority over data-accent, data-font, data-radius and data-greeting.

GET /v1/widget-config

Returns the style saved for this bot: configured plus fields such as accent, font, radius, greeting, display_name, logo_url and custom_css. configured: false means nothing is saved yet.

Limits and billing

  • Each /v1/chat reply with an answer from the bot counts as one answer toward your account's monthly answers. A handoff with no answer, a request to rephrase, requests that return queued_for_human or debounced, and errors do not count. Polling and widget-config are free.
  • When limits stop the bot (this month's answers used up, extra-usage balance used up, more bots than your plan allows, or a Free plan, which doesn't include the API), /v1/chat still returns 200 with limited: true, escalated: true and a short reply that the assistant is temporarily unavailable and the team will follow up. The conversation is not handed off. If extra answers are on and the balance allows, the request is answered and charged 5¢.
  • The last message's text is limited to 8000 characters.

Errors

Errors return JSON in this shape (422 uses FastAPI's list format instead):

{"detail": {"error": {"code": "invalid_key", "message": "..."}}}
StatusCodeWhen
400empty_messages, last_must_be_user, missing_session_idNo messages, the last one is not from the user, or /v1/poll without session_id.
401missing_auth, bad_auth_scheme, invalid_keyNo Authorization header, not a Bearer token, or a wrong or rotated key.
413message_too_longThe last message's text is over 8000 characters.
422The body is not valid JSON in the expected shape.
500synthesis_failedThe answer could not be produced and is not counted. You can retry; the retry repeats the message in the Inbox.

Examples

JavaScript

const res = await fetch('https://api.supportbot.info/v1/chat', {
  method: 'POST',
  headers: { 'Authorization': `Bearer ${process.env.SUPPORTBOT_KEY}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    messages: history,           // [{ role, content }, ...]
    session_id: conversationId,  // e.g. crypto.randomUUID(), kept per conversation
    end_user_id: userId,
    last_seen_message_id: lastSeen,
  }),
});
const data = await res.json();
// data.reply, data.escalated, data.admin_messages

Python

import os, uuid, requests

session_id = str(uuid.uuid4())  # keep it for the whole conversation
r = requests.post(
    "https://api.supportbot.info/v1/chat",
    headers={"Authorization": f"Bearer {os.environ['SUPPORTBOT_KEY']}"},
    json={"messages": [{"role": "user", "content": "Does the warranty cover the print head?"}],
          "session_id": session_id},
    timeout=60,
)
r.raise_for_status()
print(r.json()["reply"])
Academia Tech © 2026