Send a message to a session
Requires sessions:write. The message is authored by the key itself (author.type: "api_key") — a key may never author as anyone else. The agent_id field is accepted but ignored for a key, so a key cannot switch which agent answers mid-conversation; start a new session instead. A key converses only in the chat sessions it initiated — posting into any other session (another key’s chat, a person’s chat, a trigger session) is 404.
curl --request POST \
--url https://api.guild.ai/v1/sessions/{session_id}/events \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"content": "<string>",
"agent_id": null,
"selected_skills": null,
"mode": "text"
}
'import requests
url = "https://api.guild.ai/v1/sessions/{session_id}/events"
payload = {
"content": "<string>",
"agent_id": None,
"selected_skills": None,
"mode": "text"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({content: '<string>', agent_id: null, selected_skills: null, mode: 'text'})
};
fetch('https://api.guild.ai/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.guild.ai/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([
'content' => '<string>',
'agent_id' => null,
'selected_skills' => null,
'mode' => 'text'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.guild.ai/v1/sessions/{session_id}/events"
payload := strings.NewReader("{\n \"content\": \"<string>\",\n \"agent_id\": null,\n \"selected_skills\": null,\n \"mode\": \"text\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.guild.ai/v1/sessions/{session_id}/events")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"content\": \"<string>\",\n \"agent_id\": null,\n \"selected_skills\": null,\n \"mode\": \"text\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.guild.ai/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"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"content\": \"<string>\",\n \"agent_id\": null,\n \"selected_skills\": null,\n \"mode\": \"text\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"task_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"level": "INFO",
"message": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"type": "<unknown>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Authorizations
API key: key id as the username, secret as the password. An account API key carries the same scopes as an OAuth token and is checked against the scopes listed under oauth2 on each operation. A trigger API key is limited to its trigger's workspace and reaches only the session operations that list this scheme alongside the oauth2 scopes.
Path Parameters
Body
Response
Successful response
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
- Option 12
- Option 13
- Option 14
- Option 15
- Option 16
- Option 17
- Option 18
- Option 19
- Option 20
Severity of the line: INFO for ordinary output, ERROR for error-level output. Nullable for now; pre-existing rows have no level.
INFO, ERROR 65536When the line was produced in the container (not received)
curl --request POST \
--url https://api.guild.ai/v1/sessions/{session_id}/events \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"content": "<string>",
"agent_id": null,
"selected_skills": null,
"mode": "text"
}
'import requests
url = "https://api.guild.ai/v1/sessions/{session_id}/events"
payload = {
"content": "<string>",
"agent_id": None,
"selected_skills": None,
"mode": "text"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({content: '<string>', agent_id: null, selected_skills: null, mode: 'text'})
};
fetch('https://api.guild.ai/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.guild.ai/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([
'content' => '<string>',
'agent_id' => null,
'selected_skills' => null,
'mode' => 'text'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.guild.ai/v1/sessions/{session_id}/events"
payload := strings.NewReader("{\n \"content\": \"<string>\",\n \"agent_id\": null,\n \"selected_skills\": null,\n \"mode\": \"text\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.guild.ai/v1/sessions/{session_id}/events")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"content\": \"<string>\",\n \"agent_id\": null,\n \"selected_skills\": null,\n \"mode\": \"text\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.guild.ai/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"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"content\": \"<string>\",\n \"agent_id\": null,\n \"selected_skills\": null,\n \"mode\": \"text\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"task_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"level": "INFO",
"message": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"type": "<unknown>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}