API
REST API
API endpoints used by the Tolki Chat widget.
The <tolki-chat> widget communicates with the Tolki backend API. Below are the main endpoints.
Base URL
https://api.tolki.ai/chat/v1/embed/
Bot Settings
Retrieves the bot configuration and properties.
curl https://api.tolki.ai/chat/v1/embed/{bot_uuid}/settings/{lang}
Returns the bot's name, styles, welcome message, suggestions, and all configured properties.
Send Message
Sends a user message and receives the bot's response.
curl -X POST https://api.tolki.ai/chat/v1/embed/{bot_uuid}/chat/{chat_uuid}/message \
-H "Content-Type: application/json" \
-d '{"message": "Hello!"}'
Each response item must include an id field. This is required for the reaction and feedback endpoints.
[
{
"type": "markdown",
"id": "123",
"content": "Hello! How can I help you?"
}
]
Message Reaction
Submits a like or dislike reaction for a specific message.
curl -X POST https://api.tolki.ai/chat/v1/embed/{bot_uuid}/chat/{chat_uuid}/message/{id}/reaction \
-H "Content-Type: application/json" \
-d '{"type": "like"}'
| Field | Type | Description |
|---|---|---|
type | "like" | "dislike" | Reaction type |
Message Feedback
Submits text feedback for a specific message.
curl -X POST https://api.tolki.ai/chat/v1/embed/{bot_uuid}/chat/{chat_uuid}/message/{id}/feedback \
-H "Content-Type: application/json" \
-d '{"message": "This response was very helpful, thanks!"}'
| Field | Type | Description |
|---|---|---|
message | string | Text feedback message (max 300 chars) |
Conversation Rating
Submits an overall satisfaction rating for the chat session.
curl -X POST https://api.tolki.ai/chat/v1/embed/{bot_uuid}/chat/{chat_uuid}/rating \
-H "Content-Type: application/json" \
-d '{"rating": 5}'
| Field | Type | Description |
|---|---|---|
rating | 1 | 2 | 3 | 4 | 5 | Star rating |
The widget handles all API communication automatically. These endpoints are documented for reference only.