Server and browser API reference
Endpoints for creating and revoking Management Agent sessions and for the in-app chat, with request and response formats.
Management Agents expose two small APIs. They use different credentials and must not be mixed.
| API | Called from | Auth header |
|---|---|---|
Server API /management/v1/... | Your backend | Authorization: Bearer bbx_mgmt_... (server key) |
Browser API /public/management/... | The staff member's browser (the widget does this for you) | Authorization: Bearer bbxs_... (session token) |
Use the API host shown in your dashboard, for example https://api-v2.botbasex.com.
#Create a session
POST /management/v1/sessions
{
"user": {
"id": "T-17",
"name": "Neema Mushi",
"roles": ["teacher"],
"attributes": { "school_id": "S-1", "class_ids": ["F2A", "F2B"] }
},
"ttl_minutes": 15
}| Field | Rules |
|---|---|
user.id | Required. Your own user id, 1–128 characters |
user.name | Optional, up to 120 characters. Shown to the AI so it can address the user |
user.roles | List of up to 20 role keys from your Roles and permissions. Unknown keys are ignored |
user.attributes | Optional object, up to 20 keys (lowercase letters, digits, _). Values: text, number, true/false or a list of up to 50 of those. Max 4 KB |
ttl_minutes | Optional, 5–60. Defaults to the agent's session length |
201 Created
{
"session_token": "bbxs_…",
"session_id": "3f0c…",
"expires_at": "2026-12-03T09:15:00+00:00",
"roles": ["teacher"],
"ignored_roles": []
}Return only session_token to the browser.
| Status | Meaning |
|---|---|
401 invalid_server_key | Wrong or rotated key |
| 403 | The account's plan does not include Management Agents (or the account is suspended) |
409 app_not_live | Click Go live in the dashboard first |
| 422 | Invalid user block (message says which field) |
#Revoke sessions
DELETE /management/v1/sessions/{session_id} ends one session: {"revoked": true}.
POST /management/v1/users/{user_id}/revoke ends every active session of one of your users (use it on logout, role change or account removal): {"revoked": 2}.
#Browser: who am I
GET /public/management/session
Returns what the chat window needs and nothing secret:
{
"name": "Msaidizi wa Shule",
"language": "Swahili",
"welcome_message": "Habari! Nikusaidie nini leo?",
"primary_color": "#0f766e",
"launcher_icon": "bot",
"widget": { "launcher_shape": "pill" },
"user": { "id": "T-17", "name": "Neema Mushi", "roles": ["Teacher"] },
"expires_at": "2026-12-03T09:15:00+00:00",
"test_mode": false
}#Browser: send a message
POST /public/management/chat
{ "message": "Ni wanafunzi gani hawakuja leo Form 2?", "conversation_id": null }200 OK
{
"conversation_id": "c1b2…",
"answer": "Leo Form 2: Baraka hakuhudhuria. Wanafunzi wengine wote walikuwepo.",
"actions": [{ "type": "integration_call", "label": "Class attendance — live data", "simulated": false, "real": true }],
"sources": []
}Send the returned conversation_id with the next message to continue the conversation (follow-up questions use the earlier results).
| Status | Meaning | What to do |
|---|---|---|
401 session_expired / session_revoked / invalid_session | Token no longer valid | Get a new token from your backend (the widget does this automatically, once) |
401 app_unavailable | Agent paused or deactivated | Show "assistant unavailable" |
403 origin_not_allowed | The page's site is not in Allowed websites | Add your origin in the dashboard |
| 403 | Plan no longer includes Management Agents | Upgrade |
| 404 | The conversation belongs to another user | Start a new conversation (omit conversation_id) |
| 429 | More than 30 messages per minute in one session | Wait a moment |
#Calls BotBaseX makes to your API
For each operation the agent runs, BotBaseX sends the request you configured, with:
| Header | Value |
|---|---|
| Your auth header | From the connection's encrypted credentials |
X-BotBaseX-Actor | Signed token with the user, roles and attributes (2-minute expiry). See Security model |
Idempotency-Key | On writes: the pending action id. Use it to ignore duplicates |
Responses must be JSON. Only the fields you mapped are passed to the AI.
#The widget does this for you
With data-session-url, the BotBaseX widget calls your session route, the session endpoint and the chat endpoint, renews expired tokens and starts a new conversation if the saved one belongs to another user. Use the raw browser API only if you build your own chat interface.