Send a message
Send messages to a chatbot and receive a response. The API supports both streaming and non-streaming modes, as well as OpenAI-compatible response formats.
When stream is set to true, the response is a stream of text chunks that should be consumed with a ReadableStream reader and TextDecoder.
When openAIFormat is set to true, responses match OpenAI's /chat/completions API format. For streaming responses, this means Server-Sent Events (SSE) in OpenAI's chunk format. If the request fails after the stream has started, it ends with HTTP 200 and no data: [DONE].
When skipCache is set to true, the response cache is bypassed and the LLM is invoked even if a cached response exists for the same messages array. This is useful for regenerating answers. Credits, rate limits, AI actions, and the chat webhook all behave identically to a normal send — its payload for a skipCache: true request includes regenerate: true. The persisted conversation's trailing assistant message (if any) is replaced by the new response.
Request
- Base URL: https://api.chat-data.com/api/v2
- URL: https://api.chat-data.com/api/v2/chat
- Auth: HTTP bearer
Request body
Example request
{
"messages": [
{
"role": "assistant",
"content": "Hi! How can I help you today?"
},
{
"role": "user",
"content": "What are your opening hours?"
}
],
"chatbotId": "6650f1c2a9e4b83d2c7a1f05",
"basePrompt": "You are a friendly support assistant for Example Inc. Answer only from the provided knowledge base and keep replies under 120 words.",
"conversationId": "3f2b8c1e-9a4d-4e7b-8c2a-5d1e6f7a8b9c"
}Response
The chatbot's answer as plain text, streamed in chunks when stream is true. With openAIFormat set, an OpenAI-compatible JSON object instead, or text/event-stream chunks when streaming.
Changes
No recorded changes to this operation across all 1 revision of this API.