Chat & widget
Public Chatbot API
The browser-safe API that powers the embeddable chat widget. Authenticate with a publishable key (pk_live_…) in the x-voxa-public-key header — never put a secret API key in the browser.
Authentication
Send x-voxa-public-key: pk_live_… on every request. The key is locked to one assistant, an allow-list of domains (checked against the request Origin), and a per-key rate limit. Create keys via the Publishable keys API.
message.created → content.delta → message.completed → data: [DONE]). Send Accept: text/event-stream to stream./public/chatbot/config Publishable keyGet widget config
The widget's branding, greeting, starter questions, and lead-capture settings (assistant resolved from the key).
curl https://api.bolchoai.in/v1/public/chatbot/config \
-H "x-voxa-public-key: $BOLCHO_PUBLIC_KEY"Response
{ "botName": "Acme Assistant", "color": "#10B981", "welcome": "Hi! How can I help?", "placeholder": "Type your message…", "suggestions": ["Book an appointment"], "leadCapture": true, "leadFields": ["name", "email"], "branding": "Powered by Bolcho AI" }/public/chatbot/conversations Publishable keyStart a conversation
Open a widget conversation (channel = widget). Location/UTM context is captured server-side.
Body
| clientRef | string | Your own thread id (max 200). |
| context | object | { referrer?, landingUrl?, utm?, userAgent? }. |
curl -X POST https://api.bolchoai.in/v1/public/chatbot/conversations \
-H "x-voxa-public-key: $BOLCHO_PUBLIC_KEY" \
-H "Content-Type: application/json" \
-d '{
"clientRef": "string",
"context": {}
}'Response
{ "id": "…", "agentId": "…", "status": "open" }/public/chatbot/conversations/{id}/messages Publishable keySend a message
Send the visitor's message and get the assistant's reply (JSON or SSE).
Path parameters
| id* | uuid | Conversation id. |
Body
| content* | string | The visitor's message (max 8000). |
| clientMessageId | string | Your unique id for this message — makes retries idempotent. |
| stream | boolean | Stream the reply as SSE. |
curl -X POST https://api.bolchoai.in/v1/public/chatbot/conversations/$ID/messages \
-H "x-voxa-public-key: $BOLCHO_PUBLIC_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "string",
"clientMessageId": "string",
"stream": true
}'Response
{ "conversationId": "…", "message": { "role": "assistant", "content": "…", "citations": [], "buttons": [] }, "usage": { "inputTokens": 812, "outputTokens": 96, "costUsd": 0.00021 }, "status": "open" }/public/chatbot/lead Publishable keyCapture a lead
Save the visitor's contact details against the conversation.
Body
| conversationId* | uuid | The conversation to attach the lead to. |
| name | string | Visitor name. |
| string | Visitor email. | |
| phone | string | Visitor phone. |
| answers | object | Answers to any custom lead questions. |
curl -X POST https://api.bolchoai.in/v1/public/chatbot/lead \
-H "x-voxa-public-key: $BOLCHO_PUBLIC_KEY" \
-H "Content-Type: application/json" \
-d '{
"conversationId": "00000000-0000-0000-0000-000000000000",
"name": "string",
"email": "string",
"phone": "string",
"answers": {}
}'Response
{ "ok": true, "conversationId": "…" }