curl --request POST \
--url 'https://api.example.com/api/chat' \
--header 'x-widget-token: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"subject": "Replacement tent pole set",
"message": "Two-person tent, green — replacement for damaged pole set.",
"attachments": [
{
"name": "Two-Person Tent",
"type": "standard",
"size": 1.5
}
],
"meta": {
"department": "string",
"customFields": {},
"agent": {
"orgId": "string",
"agentId": "string"
}
},
"sessionId": "string",
"channel": "string",
"threadId": "string",
"stream": true,
"provider": "string",
"orgId": "string",
"agentId": "string",
"kbCollection": "string",
"kbApiKey": "YOUR_API_KEY",
"kbTopK": 1.5,
"kbScoreThreshold": 7.5
}'
{
"ok": true,
"reply": "string",
"threadId": "string",
"suggestions": [
"string"
],
"provider": "string",
"model": "string",
"toolCalls": [
{}
],
"sources": [
{
"title": "Replacement tent pole set",
"url": "https://example.com/webhooks/stateset"
}
],
"outcomes": [
{
"name": "Two-Person Tent",
"resourceType": "string",
"resourceId": "string",
"quantity": 2,
"amount": 49,
"revenue": 49,
"currency": "USD"
}
],
"type": "standard",
"content": {
"headline": "Replacement tent pole set",
"products": [
{
"id": null,
"title": null,
"price": null
}
],
"orders": [
{}
]
}
}
Send a message and get a reply
The one endpoint the widget requires. With stream: true, respond with Content-Type: text/event-stream, one JSON object per data: line (see the SseEvent shape…
POST
/
api
/
chat
curl --request POST \
--url 'https://api.example.com/api/chat' \
--header 'x-widget-token: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"subject": "Replacement tent pole set",
"message": "Two-person tent, green — replacement for damaged pole set.",
"attachments": [
{
"name": "Two-Person Tent",
"type": "standard",
"size": 1.5
}
],
"meta": {
"department": "string",
"customFields": {},
"agent": {
"orgId": "string",
"agentId": "string"
}
},
"sessionId": "string",
"channel": "string",
"threadId": "string",
"stream": true,
"provider": "string",
"orgId": "string",
"agentId": "string",
"kbCollection": "string",
"kbApiKey": "YOUR_API_KEY",
"kbTopK": 1.5,
"kbScoreThreshold": 7.5
}'
{
"ok": true,
"reply": "string",
"threadId": "string",
"suggestions": [
"string"
],
"provider": "string",
"model": "string",
"toolCalls": [
{}
],
"sources": [
{
"title": "Replacement tent pole set",
"url": "https://example.com/webhooks/stateset"
}
],
"outcomes": [
{
"name": "Two-Person Tent",
"resourceType": "string",
"resourceId": "string",
"quantity": 2,
"amount": 49,
"revenue": 49,
"currency": "USD"
}
],
"type": "standard",
"content": {
"headline": "Replacement tent pole set",
"products": [
{
"id": null,
"title": null,
"price": null
}
],
"orders": [
{}
]
}
}
The one endpoint the widget requires. With
stream: true, respond with Content-Type: text/event-stream, one JSON object per data: line (see the SseEvent shape in the overview), and finish with data: [DONE]. Without it, respond with the JSON body below.
Request body
ChatRequest
string
Optional conversation title
string
required
User input text
object[]
object
{ department, customFields } from widget propsstring
Widget session identifier
string
Defaults to
chatstring
Existing thread id, if any
boolean
When true the server should stream SSE events and end with
[DONE]string
Optional override:
openai, anthropic or geministring
Optional org id, used to fetch rules and knowledge base
string
Optional agent id, used to fetch rules
string
Optional knowledge-base collection override
string
Optional KB API key override — avoid sending client-side in production
number
KB retrieval limit (default 3)
number
KB similarity threshold (default 0.5)
Response
ChatResponse
boolean
required
string
required
The assistant reply, rendered as markdown
string
string[]
string
string
object[]
Outcome[]
string
Rich message type:
product_cards or order_cardsobject
Status codes
| Code | Meaning |
|---|---|
200 | OK |
400 | Error |
401 | Error |
curl --request POST \
--url 'https://api.example.com/api/chat' \
--header 'x-widget-token: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"subject": "Replacement tent pole set",
"message": "Two-person tent, green — replacement for damaged pole set.",
"attachments": [
{
"name": "Two-Person Tent",
"type": "standard",
"size": 1.5
}
],
"meta": {
"department": "string",
"customFields": {},
"agent": {
"orgId": "string",
"agentId": "string"
}
},
"sessionId": "string",
"channel": "string",
"threadId": "string",
"stream": true,
"provider": "string",
"orgId": "string",
"agentId": "string",
"kbCollection": "string",
"kbApiKey": "YOUR_API_KEY",
"kbTopK": 1.5,
"kbScoreThreshold": 7.5
}'
{
"ok": true,
"reply": "string",
"threadId": "string",
"suggestions": [
"string"
],
"provider": "string",
"model": "string",
"toolCalls": [
{}
],
"sources": [
{
"title": "Replacement tent pole set",
"url": "https://example.com/webhooks/stateset"
}
],
"outcomes": [
{
"name": "Two-Person Tent",
"resourceType": "string",
"resourceId": "string",
"quantity": 2,
"amount": 49,
"revenue": 49,
"currency": "USD"
}
],
"type": "standard",
"content": {
"headline": "Replacement tent pole set",
"products": [
{
"id": null,
"title": null,
"price": null
}
],
"orders": [
{}
]
}
}
Last modified on August 31, 2026