Skip to main content
POST
/
ai
/
api
/
v2
/
messages
/
streaming
Stream a Message to the Agent
curl --request POST \
  --url https://be.datagol.ai/ai/api/v2/messages/streaming \
  --header 'Content-Type: application/json' \
  --header 'x-auth-token: <api-key>' \
  --data '
{
  "agentType": "CustomAgent",
  "type": "CustomAgent",
  "conversationId": "ae5ee879-e967-45e4-bca0-c6c78d10bd23",
  "message": "Summarise the data",
  "parameters": {
    "customAgentId": "1526da2b-3264-4118-b141-87857369b0bd"
  },
  "selectedLlmModel": "gpt-5.2"
}
'
"data: {\"response_type\":\"message_id\",\"content\":7903}\n"

Authorizations

x-auth-token
string
header
required

For server-to-server or automated access, use a DataGOL Service Account key. Pass it via the x-auth-token header instead of Authorization: x-auth-token: <service-account-key>

Body

application/json
agentType
enum<string>
required

Must be CustomAgent.

Available options:
CustomAgent
type
enum<string>
required

Duplicates agentType for internal routing.

Available options:
CustomAgent
conversationId
string<uuid>
required

The conversation ID returned by POST /ai/api/v2/conversations.

Example:

"ae5ee879-e967-45e4-bca0-c6c78d10bd23"

message
string
required

The user's message text to send to the agent.

Example:

"Summarise the data"

parameters
object
required
selectedLlmModel
string
required

Model for this specific message. Can be changed per message to switch models mid-conversation.

Example:

"gpt-5.2"

Response

200 - text/event-stream

Below is the mapping of each event type, its structure, and required frontend handling.

Response Type (response_type)Content Structure (content)Frontend Behavior & Handling Rules
message_idinteger (e.g., 7903)First event of every agent turn. Provides the server-assigned numeric ID. Stash it if you need a handle; otherwise, safely ignore it.
textstring (Markdown chunk)Streaming text chunk. Delivered incrementally. Append each chunk to the in-progress message; do not replace it.
tool_callobject ({action, input, tool_call_id})Agent invoking a tool. Render an inline "running tool..." indicator in the UI. Track tool_call_id.
subagent_task_endobject ({tool_call_id, tool_response})Tool finished. Match tool_call_id to stop the spinner.

CRITICAL: tool_response[0].text is a double-encoded JSON string. You must call JSON.parse() a second time to extract the actual structured payload.
htmlstring (HTML/SVG fragment)Rich visualization.

SECURITY RULE: Render this content strictly inside a sandboxed <iframe srcdoc="..."> so encapsulated styles do not leak. Do not inject via dangerouslySetInnerHTML.
(Any other type)Varies / UnknownForward-compatibility. Safely ignore unlisted types to prevent application crashes as new events are introduced.