Send input to a session
curl --request POST \
--url https://api.{domain}/v1/sessions/{session_id}/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"events": [
{
"type": "input.message",
"content": "Summarise what you found."
}
]
}
'import requests
url = "https://api.{domain}/v1/sessions/{session_id}/events"
payload = { "events": [
{
"type": "input.message",
"content": "Summarise what you found."
}
] }
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: [{type: 'input.message', content: 'Summarise what you found.'}]})
};
fetch('https://api.{domain}/v1/sessions/{session_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.{domain}/v1/sessions/{session_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' => [
[
'type' => 'input.message',
'content' => 'Summarise what you found.'
]
]
]),
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.{domain}/v1/sessions/{session_id}/events"
payload := strings.NewReader("{\n \"events\": [\n {\n \"type\": \"input.message\",\n \"content\": \"Summarise what you found.\"\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.{domain}/v1/sessions/{session_id}/events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"events\": [\n {\n \"type\": \"input.message\",\n \"content\": \"Summarise what you found.\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.{domain}/v1/sessions/{session_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 \"type\": \"input.message\",\n \"content\": \"Summarise what you found.\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"object": "input.accepted",
"session_id": "<string>",
"type": "input.message",
"outcome": "accepted",
"queued": true,
"queue_position": 123
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}API Reference
Send input to a session
Send input to a session: a message, a cancellation, or a tool result.
POST
/
v1
/
sessions
/
{session_id}
/
events
Send input to a session
curl --request POST \
--url https://api.{domain}/v1/sessions/{session_id}/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"events": [
{
"type": "input.message",
"content": "Summarise what you found."
}
]
}
'import requests
url = "https://api.{domain}/v1/sessions/{session_id}/events"
payload = { "events": [
{
"type": "input.message",
"content": "Summarise what you found."
}
] }
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: [{type: 'input.message', content: 'Summarise what you found.'}]})
};
fetch('https://api.{domain}/v1/sessions/{session_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.{domain}/v1/sessions/{session_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' => [
[
'type' => 'input.message',
'content' => 'Summarise what you found.'
]
]
]),
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.{domain}/v1/sessions/{session_id}/events"
payload := strings.NewReader("{\n \"events\": [\n {\n \"type\": \"input.message\",\n \"content\": \"Summarise what you found.\"\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.{domain}/v1/sessions/{session_id}/events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"events\": [\n {\n \"type\": \"input.message\",\n \"content\": \"Summarise what you found.\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.{domain}/v1/sessions/{session_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 \"type\": \"input.message\",\n \"content\": \"Summarise what you found.\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"object": "input.accepted",
"session_id": "<string>",
"type": "input.message",
"outcome": "accepted",
"queued": true,
"queue_position": 123
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}Authorizations
A gbr_pat_ access token. Scopes are recorded on the token when it is minted.
Headers
Retrying with the same key replays the first answer instead of acting again.
Maximum string length:
255Body
application/json
One event per request. Batching has no meaning while the vocabulary is this small.
Exactly one event. What it does depends on its type — send a message, answer a tool call, approve, steer or cancel.
Required array length:
1 elementShow child attributes
Show child attributes
Response
Send input to a session: a message, a cancellation, or a tool result.
Always input.accepted. Names the shape, so a value can be identified without knowing which call returned it.
Allowed value:
"input.accepted"Available options:
input.message, input.cancel, input.tool_result, input.steer For input.tool_result.
Available options:
accepted, already_resolved, not_delivered The session was busy; the message is durably queued and will run.