Skip to content

Chatbot API

Integrate WAYSCloud chatbots into your applications.

Build AI-powered chatbots with your own knowledge sources, then access them programmatically from any backend, mobile app, or integration.

Quick start:

bash
# List your chatbots
curl https://api.wayscloud.services/v1/chatbot/api/bots \
  -H "X-API-Key: wayscloud_api_xxx"

# Send a message
curl -X POST https://api.wayscloud.services/v1/chatbot/api/chat \
  -H "X-API-Key: wayscloud_api_xxx" \
  -H "Content-Type: application/json" \
  -d '{"bot_id": "my-bot", "message": "What are your prices?"}'

Streaming: Use /v1/chatbot/api/chat/stream for real-time token-by-token responses via Server-Sent Events.

Sessions: Omit session_id to start a new conversation. Include it to continue an existing one.

Authentication: API key with chatbot permission, sent via X-API-Key header.

Manage chatbots: Create and configure chatbots, add knowledge sources, and customize behavior in the WAYSCloud Dashboard.

Endpoints

MethodPathDescription
GET/v1/chatbot/api/botsList chatbots
POST/v1/chatbot/api/chatSend a message
POST/v1/chatbot/api/chat/streamSend a message (streaming)

GET /v1/chatbot/api/bots

List chatbots

Returns all active chatbots owned by the authenticated customer. Use the id or slug from this response as the bot_id parameter when calling the chat endpoints.

Response:

FieldTypeDescription
botsarrayActive chatbots for this customer.

Example:

bash
curl https://api.wayscloud.services/v1/chatbot/api/bots \
  -H "X-API-Key: YOUR_API_KEY"

POST /v1/chatbot/api/chat

Send a message

Send a message to a chatbot and receive a generated response based on the configured knowledge sources. The response includes the answer, relevant source citations, and usage metadata.

Request Body:

FieldTypeDescription
bot_idstringRequired. Chatbot identifier. Accepts either the UUID or the slug (e.g. support-bot).
messagestringRequired. The message to send to the chatbot.
session_idstringOptional session identifier to continue an existing conversation. If omitted, a new session is created automatically. Reuse the returned session_id in subsequent requests to maintain conversation context.

Example:

json
{
  "bot_id": "support-bot",
  "message": "What are your prices?"
}

Response:

FieldTypeDescription
session_idstringRequired. Session identifier. Reuse this in subsequent requests to continue the same conversation.
message_idstringRequired. Unique identifier for this response.
responsestringRequired. Generated reply from the chatbot based on its knowledge sources.
citationsarraySources referenced in the response, when available. May be empty if the answer was generated without specific source matches.
tokens_inputintegerNumber of input tokens consumed.
tokens_outputintegerNumber of output tokens generated.
response_time_msintegerTotal processing time in milliseconds.

Example:

bash
curl -X POST https://api.wayscloud.services/v1/chatbot/api/chat \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{...}'

POST /v1/chatbot/api/chat/stream

Send a message (streaming)

Send a message and receive a real-time streaming response via Server-Sent Events (SSE). Tokens are delivered incrementally as they are generated.

The first event is always meta, followed by zero or more token events, and finally done. If an error occurs during generation, an error event is sent instead of done.

Event types:

TypeDescription
metaSent once at the start. Contains session ID and source citations.
tokenSent for each generated token.
doneSent when generation is complete.
errorSent if an error occurs. Contains a human-readable message.

Example stream:

data: {"type":"meta","data":{"session_id":"a1b2...","citations":[{"title":"Pricing","url":"https://example.com/pricing"}]}}
data: {"type":"token","content":"Our"}
data: {"type":"token","content":" prices"}
data: {"type":"token","content":" start"}
data: {"type":"token","content":" from"}
data: {"type":"done"}

Error example:

data: {"type":"error","content":"Service temporarily unavailable"}

Request Body:

FieldTypeDescription
bot_idstringRequired. Chatbot identifier. Accepts either the UUID or the slug.
messagestringRequired. The message to send to the chatbot.
session_idstringOptional session identifier to continue an existing conversation. Reuse the session_id from a previous response to maintain context.

Example:

json
{
  "bot_id": "support-bot",
  "message": "Tell me about your services"
}

Example:

bash
curl -X POST https://api.wayscloud.services/v1/chatbot/api/chat/stream \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{...}'

WAYSCloud AS