Chatbot Operations

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.

post/chat

Request

  • Base URL: https://api.chat-data.com/api/v2
  • URL: https://api.chat-data.com/api/v2/chat
  • Auth: HTTP bearer

Request body

chatbotIdstring required

The ID of the chatbot.

includeReasoningboolean

Whether to include reasoning in the response. This parameter overrides the chatbot's reasoning settings. If true, the reasoning is included at the beginning of the response within a <think> tag, for example <think>{reasoning}</think>{response}.

baseModel'gpt-4o-mini' | 'gpt-4o' | 'gpt-4' | 'gpt-4.1-nano' | 'gpt-4.1-mini' | 'gpt-4.1' | 'gpt-5-nano' | 'gpt-5-mini' | 'gpt-5' | 'gpt-5.1' | 'gpt-5.2' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | 'gpt-5.6-luna' | 'gpt-6-astra' | 'gpt-6.1-sol' | 'gpt-6-luna' | 'gpt-5.5' | 'gpt-5.4' | 'gpt-5.4-nano' | 'gpt-5.4-mini' | 'gpt-o1' | 'gpt-o3-mini' | 'gpt-o3' | 'gpt-o4-mini' | 'claude-4-5-sonnet' | 'claude-4-6-sonnet' | 'claude-4-5-haiku' | 'claude-4-opus' | 'claude-4.1-opus' | 'claude-4.5-opus' | 'claude-4.6-opus' | 'claude-5-opus' | 'claude-5-sonnet' | 'claude-5-5-opus' | 'claude-5-5-sonnet' | 'claude-5-5-haiku' | 'gemini-3.0-flash' | 'gemini-3.1-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.7-flash' | 'gemini-2.5-pro' | 'gemini-3.0-pro' | 'gemini-3.1-pro' | 'deepseek-r1' | 'deepseek-v3.2' | 'mancer-deepseek-v4-flash'

Overrides the chatbot's baseModel setting when processing the RAG context for this request.

basePromptstring

Overrides the chatbot's basePrompt when processing the RAG context for this request.

streamboolean

Whether to stream back partial progress or wait for the full response.

openAIFormatboolean

When set to true, the response is formatted to be compatible with OpenAI's /chat/completions API format. Non-streaming responses return a JSON object matching OpenAI's completion format; streaming responses return Server-Sent Events in OpenAI's chunk format.

appendMessagesboolean

If true, messages must contain exactly one user message, which is appended to the stored messages of the conversation with the same conversationId. If false, it is assumed that the messages parameter contains the entire message history.

conversationIdstring

ID of the current conversation. If omitted, the chatbot generates one, which is not returned in the response.

skipCacheboolean

When true, bypasses the response cache lookup for this request and runs the LLM pipeline normally. On success, the new response overwrites the prior cached entry under the same cache key. This is useful for regenerating answers when the cached response is no longer wanted.

Only the literal boolean true enables this behavior — loose-truthy values ("true", 1) are treated as false to prevent accidental cache bypass.

Side effects are unchanged from a normal send: credits are charged, rate limits apply, AI actions fire, and the chat webhook emits (the only webhook this endpoint sends). Its payload carries an additional regenerate: true field so receivers can dedupe.

Persisted conversation history: when skipCache: true and the persisted conversation's last message is an assistant message, that trailing assistant message is replaced (not appended after) by the newly generated response. If the last persisted message is a user message, the new response is appended normally. Callers managing their own conversation state typically send the trimmed history along with skipCache: true (or use a fresh conversationId for a branching alternative).

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.