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"
}
'import requests
url = "https://be.datagol.ai/ai/api/v2/messages/streaming"
payload = {
"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"
}
headers = {
"x-auth-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-auth-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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'
})
};
fetch('https://be.datagol.ai/ai/api/v2/messages/streaming', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://be.datagol.ai/ai/api/v2/messages/streaming",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-auth-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://be.datagol.ai/ai/api/v2/messages/streaming"
payload := strings.NewReader("{\n \"agentType\": \"CustomAgent\",\n \"type\": \"CustomAgent\",\n \"conversationId\": \"ae5ee879-e967-45e4-bca0-c6c78d10bd23\",\n \"message\": \"Summarise the data\",\n \"parameters\": {\n \"customAgentId\": \"1526da2b-3264-4118-b141-87857369b0bd\"\n },\n \"selectedLlmModel\": \"gpt-5.2\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-auth-token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://be.datagol.ai/ai/api/v2/messages/streaming")
.header("x-auth-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agentType\": \"CustomAgent\",\n \"type\": \"CustomAgent\",\n \"conversationId\": \"ae5ee879-e967-45e4-bca0-c6c78d10bd23\",\n \"message\": \"Summarise the data\",\n \"parameters\": {\n \"customAgentId\": \"1526da2b-3264-4118-b141-87857369b0bd\"\n },\n \"selectedLlmModel\": \"gpt-5.2\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://be.datagol.ai/ai/api/v2/messages/streaming")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-auth-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agentType\": \"CustomAgent\",\n \"type\": \"CustomAgent\",\n \"conversationId\": \"ae5ee879-e967-45e4-bca0-c6c78d10bd23\",\n \"message\": \"Summarise the data\",\n \"parameters\": {\n \"customAgentId\": \"1526da2b-3264-4118-b141-87857369b0bd\"\n },\n \"selectedLlmModel\": \"gpt-5.2\"\n}"
response = http.request(request)
puts response.read_body"data: {\"response_type\":\"message_id\",\"content\":7903}\n"Stream Message
Sends a user message and streams the AI response as Server-Sent Events (SSE). This endpoint is on the AI Core service (ai.datagol.ai).
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"
}
'import requests
url = "https://be.datagol.ai/ai/api/v2/messages/streaming"
payload = {
"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"
}
headers = {
"x-auth-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-auth-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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'
})
};
fetch('https://be.datagol.ai/ai/api/v2/messages/streaming', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://be.datagol.ai/ai/api/v2/messages/streaming",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-auth-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://be.datagol.ai/ai/api/v2/messages/streaming"
payload := strings.NewReader("{\n \"agentType\": \"CustomAgent\",\n \"type\": \"CustomAgent\",\n \"conversationId\": \"ae5ee879-e967-45e4-bca0-c6c78d10bd23\",\n \"message\": \"Summarise the data\",\n \"parameters\": {\n \"customAgentId\": \"1526da2b-3264-4118-b141-87857369b0bd\"\n },\n \"selectedLlmModel\": \"gpt-5.2\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-auth-token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://be.datagol.ai/ai/api/v2/messages/streaming")
.header("x-auth-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agentType\": \"CustomAgent\",\n \"type\": \"CustomAgent\",\n \"conversationId\": \"ae5ee879-e967-45e4-bca0-c6c78d10bd23\",\n \"message\": \"Summarise the data\",\n \"parameters\": {\n \"customAgentId\": \"1526da2b-3264-4118-b141-87857369b0bd\"\n },\n \"selectedLlmModel\": \"gpt-5.2\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://be.datagol.ai/ai/api/v2/messages/streaming")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-auth-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agentType\": \"CustomAgent\",\n \"type\": \"CustomAgent\",\n \"conversationId\": \"ae5ee879-e967-45e4-bca0-c6c78d10bd23\",\n \"message\": \"Summarise the data\",\n \"parameters\": {\n \"customAgentId\": \"1526da2b-3264-4118-b141-87857369b0bd\"\n },\n \"selectedLlmModel\": \"gpt-5.2\"\n}"
response = http.request(request)
puts response.read_body"data: {\"response_type\":\"message_id\",\"content\":7903}\n"Authorizations
ServiceAccountAuthBearerAuth
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
Must be CustomAgent.
Available options:
CustomAgent Duplicates agentType for internal routing.
Available options:
CustomAgent The conversation ID returned by POST /ai/api/v2/conversations.
Example:
"ae5ee879-e967-45e4-bca0-c6c78d10bd23"
The user's message text to send to the agent.
Example:
"Summarise the data"
Show child attributes
Show child attributes
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_id | integer (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. |
text | string (Markdown chunk) | Streaming text chunk. Delivered incrementally. Append each chunk to the in-progress message; do not replace it. |
tool_call | object ({action, input, tool_call_id}) | Agent invoking a tool. Render an inline "running tool..." indicator in the UI. Track tool_call_id. |
subagent_task_end | object ({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. |
html | string (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 / Unknown | Forward-compatibility. Safely ignore unlisted types to prevent application crashes as new events are introduced. |
⌘I