curl --request GET \
--url https://api.example.com/v1/projects/{project_id}/conversations/{chat_id}/messages/{message_id}/events \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.example.com/v1/projects/{project_id}/conversations/{chat_id}/messages/{message_id}/events"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.example.com/v1/projects/{project_id}/conversations/{chat_id}/messages/{message_id}/events', 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://api.example.com/v1/projects/{project_id}/conversations/{chat_id}/messages/{message_id}/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/projects/{project_id}/conversations/{chat_id}/messages/{message_id}/events"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v1/projects/{project_id}/conversations/{chat_id}/messages/{message_id}/events")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/projects/{project_id}/conversations/{chat_id}/messages/{message_id}/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"code": "<string>",
"request_id": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"code": "<string>",
"request_id": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"code": "<string>",
"request_id": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"code": "<string>",
"request_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"code": "<string>",
"request_id": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"code": "<string>",
"request_id": "<string>"
}Stream message events
Re-stream the Server-Sent Events of an existing message — use to resume watching a reply after a dropped connection.
curl --request GET \
--url https://api.example.com/v1/projects/{project_id}/conversations/{chat_id}/messages/{message_id}/events \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.example.com/v1/projects/{project_id}/conversations/{chat_id}/messages/{message_id}/events"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.example.com/v1/projects/{project_id}/conversations/{chat_id}/messages/{message_id}/events', 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://api.example.com/v1/projects/{project_id}/conversations/{chat_id}/messages/{message_id}/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/projects/{project_id}/conversations/{chat_id}/messages/{message_id}/events"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v1/projects/{project_id}/conversations/{chat_id}/messages/{message_id}/events")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/projects/{project_id}/conversations/{chat_id}/messages/{message_id}/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"code": "<string>",
"request_id": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"code": "<string>",
"request_id": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"code": "<string>",
"request_id": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"code": "<string>",
"request_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"code": "<string>",
"request_id": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"code": "<string>",
"request_id": "<string>"
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Response
Server-Sent Events stream of agent activity.
Each event is a UTF-8 line prefixed with event:, id:, or data: per the SSE spec. The data: payload is a JSON object with the shape {"type": <event_type>, "sequence": <int>, "data": <object>}.
Event types emitted by the agent:
status— high-level progress;data.message(queued/running text) ordata.summary(short status line). When the conversation was busy and the message was queued (request fieldon_busy: "queue"), the first event isstatuswithdata.message: "queued"(or"held"if a Stop has already paused the queue),data.queuedMessageId,data.position,data.behindMessageId,data.held, anddata.revision; the reply then streams once the queued turn dispatches. A held queue does not run until it is resumed.queue.updated— the waiting message's queue state changed;data.position,data.held,data.revision,data.queuedMessageId.held: truemeans a Stop paused the queue: the message will not run until the queue is resumed (POST .../queue/resume).revisiononly moves forward; ignore any snapshot older than one you hold.tool.started— agent invoked a tool;data.id,data.nametool.input— tool input arguments;data.id,data.name,data.inputtool.completed— tool finished;data.idmessage.delta— incremental assistant text;data.text(append in order)done— terminal event;data.messageId,data.content(final assistant message),data.status(complete/error/cancelled)error— terminal error;data.code,data.message. A queued message may end withcode: "queue_wait_timeout"after 30 minutes of waiting — the message is still queued and can be observed again via the queue endpoints.
Resumability: when the connection drops before done, the same stream can be resumed via GET /v1/projects/{project_id}/conversations/{chat_id}/messages/{message_id}/events. Before a queued message has bound an assistant message id, reconnect by re-sending with the same idempotency_key, or poll GET /v1/projects/{project_id}/conversations/{chat_id}/queue/{queued_message_id}.