Send Chat Message
Available for: Chatflow, Chatbot, Agent apps.
Sends a message to a chat app and returns the assistant’s reply. The events in the streaming response vary by app type.
Authorizations
Every request authenticates with an API key: Authorization: Bearer {API_KEY}. App endpoints take an app API key; knowledge endpoints take a knowledge base API key (Get Started).
Keep keys server-side; never embed them in client code. Requests with a missing or invalid key fail with HTTP 401 (unauthorized).
Body
Request body to send a chat message.
The user's message.
Values for the app's input variables, keyed by variable name. The expected names and types come from the user_input_form field of Get App Parameters.
End-user identifier, defined by your app and unique within it. Conversations, messages, and files are visible only to requests carrying the same user. See End User Identity.
Mode of response return. Defaults to blocking when omitted.
streaming(recommended): the reply arrives as Server-Sent Events.blocking: returns once generation completes. Long generations risk interruption: a reverse proxy in front of the API may end the connection if the response doesn't arrive within its timeout.- Agent apps support
streamingonly; ablockingrequest fails with 400.
streaming, blocking ID of the conversation to continue. Omit it or pass an empty string to start a new conversation; the response returns a conversation_id to send with the next message. To resume an earlier conversation, get its ID from List Conversations.
Files to attach to the message. For a local file, first upload it via Upload File, then reference the returned id as upload_file_id with transfer_method: local_file.
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).