Use the REST API
Connect a live chatbot to your own chat interface. Open Integration → REST API for your chatbot's Bot ID and API base URL. The examples below use placeholder values.
Endpoints
| Method and path | Use |
|---|---|
GET /api/bots/{bot_id}/config | Read public widget settings such as the title, welcome message, and suggested questions. |
POST /api/chat | Send a visitor message and receive the assistant's reply. |
POST /api/feedback | Rate a reply in the same session or clear a previous rating. |
Append ?view=launcher to the config URL to read the color, avatar, font, launcher radius, and greeting card radius before opening the chat. The launcher request uses the same domain checks as the full config.
Send a message
Generate a unique session_id for each conversation and reuse it for follow-ups so the chatbot can use the conversation history. The ID must contain 8–100 characters. Messages can contain up to 2,000 characters.
curl https://bodha.sutracore.com/api/chat \
-H 'Content-Type: application/json' \
-d '{
"bot_id": "YOUR_BOT_ID",
"session_id": "visitor-session-id",
"message": "What are your opening hours?"
}'
Display reply in your interface, show the returned sources and suggestions, and keep the response id for feedback.
Record feedback
Send the same bot_id and session_id, along with the reply's id as message_id. Use "up" or "down" to rate it, or null to clear the rating.
curl https://bodha.sutracore.com/api/feedback \
-H 'Content-Type: application/json' \
-d '{
"bot_id": "YOUR_BOT_ID",
"session_id": "visitor-session-id",
"message_id": "REPLY_ID",
"rating": "up"
}'
Handle errors
400means the request body is invalid. Check the JSON and field lengths.403can mean the chatbot is offline or the browser's domain is outside Settings → Allowed domains. Check the chatbot status, workspace plan, and calling domain.404means the requested chatbot or message could not be found. Check the IDs and session.429means a rate or usage limit was reached. Read the error'sdetailfield and wait for theRetry-Afterinterval when the response includes it.
For requests made from a browser, use the workspace domain, one of its subdomains, or a hostname listed in Allowed domains.
