Send Chat Message
Available for: Chatflow, New Agent, Chatbot, Agent apps.
Send a request to the chat application. Works with Chatbot, Agent, Chatflow, and New Agent apps; the events in the streaming response vary by app type.
Authorizations
API Key authentication. For all API requests, include your API Key in the Authorization HTTP Header, prefixed with Bearer. Example: Authorization: Bearer {API_KEY}. Strongly recommend storing your API Key on the server-side, not shared or stored on the client-side, to avoid possible API-Key leakage that can lead to serious consequences. Requests with a missing or invalid API key fail with HTTP 401 and error code unauthorized.
Body
Request body to send a chat message.
User input/question content.
Allows the entry of various variable values defined by the App. Contains key/value pairs. Refer to the user_input_form field in the Get App Parameters response to discover the variable names and types expected by your app.
User identifier, unique within the application. This identifier scopes data access — conversations, messages, and files are only visible when queried with the same user value.
Mode of response return. streaming (recommended) uses SSE. blocking returns after completion (may be interrupted for long processes; not supported in Agent Assistant mode). Cloudflare timeout is 100 s. When omitted, defaults to blocking behavior. New Agent apps support streaming only; blocking returns 400 bad_request.
streaming, blocking Conversation ID to continue a conversation. Pass the previous message's conversation_id. To start a new conversation, omit this field or pass an empty string. The response will return a conversation_id — pass it in subsequent messages to continue that conversation.
File list for multimodal understanding, including images, documents, audio, and video. To attach a local file, first upload it via Upload File and use the returned id as upload_file_id with transfer_method: local_file. Not supported for New Agent apps: file references are accepted but their contents are not processed.
Auto-generate conversation title. If false, use the Rename Conversation API with auto_generate: true for async title generation.
Chatflow apps only. Specify a published workflow version ID to execute. If not provided, the latest published version is used.
Response
Successful response. The content type and structure depend on the response_mode parameter in the request.
- If
response_modeisblocking, returnsapplication/jsonwith aChatCompletionResponseobject. - If
response_modeisstreaming, returnstext/event-streamwith a stream of Server-Sent Events.
Event type, fixed as message.
Task ID for request tracking and stop response API.
Unique ID of this response event.
Unique message ID. Use this as the message_id parameter when calling feedback or suggested questions endpoints.
Conversation ID.
App mode. chat for Chatbot apps, agent-chat for Agent apps, advanced-chat for Chatflow apps.
Complete response content.
Metadata including usage and retriever resources.
Message creation timestamp (Unix epoch seconds).