Complete API Reference and Integration Guide
{
"email": "admin@askbob.cool",
"password": "your_password"
}
{
"email": "customer@business.com",
"password": "customer_password"
}
Three paths: (1) Public same-origin anonymous → POST /api/chat (e.g. marketing site widget; no login). (2) Cross-origin embed → POST /api/widget/chat with X-Widget-Key and allowed Origin. (3) Authenticated app / Mission Control → POST /api/chat/session and POST /api/chat/message (requires chat.manage and session/CSRF for cookie auth) — not for anonymous fetch from public pages.
message, session_id, optional business_id.
X-Widget-Key, Content-Type: application/json. Origin must be allowed for the key. See REQUEST_FLOWS (repo) for CORS details.
chat.manage). Returns 401 if called anonymously from a public page — use POST /api/chat for that case instead.
{
"session_id": "session_123",
"message": "Hello, I need help with my order"
}
Use the block that matches your scenario. Do not copy the admin example into anonymous marketing HTML.
const response = await fetch('/api/chat', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
session_id: sessionId,
message: userMessage,
business_id: 'your-tenant-business-id'
})
});
const data = await response.json();
const response = await fetch('https://office16852.com/api/widget/chat', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Widget-Key': 'pk_live_...',
'Origin': 'https://your-customer-site.com'
},
body: JSON.stringify({ session_id: sessionId, message: userMessage })
});
// JavaScript — requires logged-in admin / Mission Control (Bearer)
const response = await fetch('/api/chat/message', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + token
},
body: JSON.stringify({
session_id: sessionId,
message: userMessage
})
});
const data = await response.json();
// Python — authenticated only
import requests
response = requests.post(
'https://your-api-host/api/chat/message',
headers={
'Content-Type': 'application/json',
'Authorization': f'Bearer {token}'
},
json={ 'session_id': session_id, 'message': user_message }
)