Create turn events
curl --request POST \
--url https://api.example.com/api/v1/sessions/{session_id}/turns/{turn_id}/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"events": [
{
"approval": {
"status": "allow"
},
"thread_id": "<string>",
"tool_call_id": "<string>",
"type": "user.tool_approval"
}
]
}
'import requests
url = "https://api.example.com/api/v1/sessions/{session_id}/turns/{turn_id}/events"
payload = { "events": [
{
"approval": { "status": "allow" },
"thread_id": "<string>",
"tool_call_id": "<string>",
"type": "user.tool_approval"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
events: [
{
approval: {status: 'allow'},
thread_id: '<string>',
tool_call_id: '<string>',
type: 'user.tool_approval'
}
]
})
};
fetch('https://api.example.com/api/v1/sessions/{session_id}/turns/{turn_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/api/v1/sessions/{session_id}/turns/{turn_id}/events",
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([
'events' => [
[
'approval' => [
'status' => 'allow'
],
'thread_id' => '<string>',
'tool_call_id' => '<string>',
'type' => 'user.tool_approval'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.example.com/api/v1/sessions/{session_id}/turns/{turn_id}/events"
payload := strings.NewReader("{\n \"events\": [\n {\n \"approval\": {\n \"status\": \"allow\"\n },\n \"thread_id\": \"<string>\",\n \"tool_call_id\": \"<string>\",\n \"type\": \"user.tool_approval\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.example.com/api/v1/sessions/{session_id}/turns/{turn_id}/events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"events\": [\n {\n \"approval\": {\n \"status\": \"allow\"\n },\n \"thread_id\": \"<string>\",\n \"tool_call_id\": \"<string>\",\n \"type\": \"user.tool_approval\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/sessions/{session_id}/turns/{turn_id}/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"events\": [\n {\n \"approval\": {\n \"status\": \"allow\"\n },\n \"thread_id\": \"<string>\",\n \"tool_call_id\": \"<string>\",\n \"type\": \"user.tool_approval\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"approval": {
"status": "allow"
},
"created_at": "<string>",
"id": "<string>",
"thread_id": "<string>",
"tool_call_id": "<string>",
"type": "user.tool_approval"
}
]
}{
"error": {
"message": "<string>",
"code": "<string>",
"param": "<string>",
"type": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"param": "<string>",
"type": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"param": "<string>",
"type": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"param": "<string>",
"type": "<string>"
}
}Agent Sessions
Create turn events
Create events for a turn. Only the session creator may create them.
POST
/
api
/
v1
/
sessions
/
{session_id}
/
turns
/
{turn_id}
/
events
Create turn events
curl --request POST \
--url https://api.example.com/api/v1/sessions/{session_id}/turns/{turn_id}/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"events": [
{
"approval": {
"status": "allow"
},
"thread_id": "<string>",
"tool_call_id": "<string>",
"type": "user.tool_approval"
}
]
}
'import requests
url = "https://api.example.com/api/v1/sessions/{session_id}/turns/{turn_id}/events"
payload = { "events": [
{
"approval": { "status": "allow" },
"thread_id": "<string>",
"tool_call_id": "<string>",
"type": "user.tool_approval"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
events: [
{
approval: {status: 'allow'},
thread_id: '<string>',
tool_call_id: '<string>',
type: 'user.tool_approval'
}
]
})
};
fetch('https://api.example.com/api/v1/sessions/{session_id}/turns/{turn_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/api/v1/sessions/{session_id}/turns/{turn_id}/events",
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([
'events' => [
[
'approval' => [
'status' => 'allow'
],
'thread_id' => '<string>',
'tool_call_id' => '<string>',
'type' => 'user.tool_approval'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.example.com/api/v1/sessions/{session_id}/turns/{turn_id}/events"
payload := strings.NewReader("{\n \"events\": [\n {\n \"approval\": {\n \"status\": \"allow\"\n },\n \"thread_id\": \"<string>\",\n \"tool_call_id\": \"<string>\",\n \"type\": \"user.tool_approval\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.example.com/api/v1/sessions/{session_id}/turns/{turn_id}/events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"events\": [\n {\n \"approval\": {\n \"status\": \"allow\"\n },\n \"thread_id\": \"<string>\",\n \"tool_call_id\": \"<string>\",\n \"type\": \"user.tool_approval\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/sessions/{session_id}/turns/{turn_id}/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"events\": [\n {\n \"approval\": {\n \"status\": \"allow\"\n },\n \"thread_id\": \"<string>\",\n \"tool_call_id\": \"<string>\",\n \"type\": \"user.tool_approval\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"approval": {
"status": "allow"
},
"created_at": "<string>",
"id": "<string>",
"thread_id": "<string>",
"tool_call_id": "<string>",
"type": "user.tool_approval"
}
]
}{
"error": {
"message": "<string>",
"code": "<string>",
"param": "<string>",
"type": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"param": "<string>",
"type": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"param": "<string>",
"type": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"param": "<string>",
"type": "<string>"
}
}Authorizations
Caller credential (Authorization: Bearer <token>). Required on protected routes when auth is enabled. Browser sessions may use the HttpOnly id_token or accessToken cookie instead.
Path Parameters
Session identifier.
Required string length:
1 - 64Turn identifier.
Minimum string length:
1Body
application/json
One or more user events.
Minimum array length:
1- Option 1
- Option 2
- Option 3
- Option 4
Show child attributes
Show child attributes
Response
Events created.
Events with server-minted id and created_at, in request order.
- Option 1
- Option 2
- Option 3
- Option 4
Show child attributes
Show child attributes