Add a message to a session thread
curl --request POST \
--url https://agent-service-511985928315.us-east4.run.app/api/assistants/threads/{threadId}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Envole-User-Id: <api-key>' \
--data '
{
"content": [
{
"type": "text",
"text": "Hi what can you do for me"
}
]
}
'import requests
url = "https://agent-service-511985928315.us-east4.run.app/api/assistants/threads/{threadId}/messages"
payload = { "content": [
{
"type": "text",
"text": "Hi what can you do for me"
}
] }
headers = {
"Authorization": "Bearer <token>",
"X-Envole-User-Id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'X-Envole-User-Id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({content: [{type: 'text', text: 'Hi what can you do for me'}]})
};
fetch('https://agent-service-511985928315.us-east4.run.app/api/assistants/threads/{threadId}/messages', 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://agent-service-511985928315.us-east4.run.app/api/assistants/threads/{threadId}/messages",
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' => [
[
'type' => 'text',
'text' => 'Hi what can you do for me'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Envole-User-Id: <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://agent-service-511985928315.us-east4.run.app/api/assistants/threads/{threadId}/messages"
payload := strings.NewReader("{\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Hi what can you do for me\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("X-Envole-User-Id", "<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://agent-service-511985928315.us-east4.run.app/api/assistants/threads/{threadId}/messages")
.header("Authorization", "Bearer <token>")
.header("X-Envole-User-Id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Hi what can you do for me\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agent-service-511985928315.us-east4.run.app/api/assistants/threads/{threadId}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["X-Envole-User-Id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Hi what can you do for me\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"type": "AGENT_RESPONSE_CHUNK",
"eventId": "",
"threadId": "",
"requestId": "",
"eventMessage": {
"agent": null,
"content": "Hel",
"collaborationId": null,
"activeAssistantCollaborationRequired": null,
"toolExecutionApprovalRequest": null,
"timestamp": "2025-08-12T00:00:00"
}
}Session Thread APIs
Add Session Thread Message
Adds a message to a session thread and streams events back using Server-Sent Events.
POST
/
api
/
assistants
/
threads
/
{threadId}
/
messages
Add a message to a session thread
curl --request POST \
--url https://agent-service-511985928315.us-east4.run.app/api/assistants/threads/{threadId}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Envole-User-Id: <api-key>' \
--data '
{
"content": [
{
"type": "text",
"text": "Hi what can you do for me"
}
]
}
'import requests
url = "https://agent-service-511985928315.us-east4.run.app/api/assistants/threads/{threadId}/messages"
payload = { "content": [
{
"type": "text",
"text": "Hi what can you do for me"
}
] }
headers = {
"Authorization": "Bearer <token>",
"X-Envole-User-Id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'X-Envole-User-Id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({content: [{type: 'text', text: 'Hi what can you do for me'}]})
};
fetch('https://agent-service-511985928315.us-east4.run.app/api/assistants/threads/{threadId}/messages', 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://agent-service-511985928315.us-east4.run.app/api/assistants/threads/{threadId}/messages",
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' => [
[
'type' => 'text',
'text' => 'Hi what can you do for me'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Envole-User-Id: <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://agent-service-511985928315.us-east4.run.app/api/assistants/threads/{threadId}/messages"
payload := strings.NewReader("{\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Hi what can you do for me\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("X-Envole-User-Id", "<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://agent-service-511985928315.us-east4.run.app/api/assistants/threads/{threadId}/messages")
.header("Authorization", "Bearer <token>")
.header("X-Envole-User-Id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Hi what can you do for me\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agent-service-511985928315.us-east4.run.app/api/assistants/threads/{threadId}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["X-Envole-User-Id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Hi what can you do for me\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"type": "AGENT_RESPONSE_CHUNK",
"eventId": "",
"threadId": "",
"requestId": "",
"eventMessage": {
"agent": null,
"content": "Hel",
"collaborationId": null,
"activeAssistantCollaborationRequired": null,
"toolExecutionApprovalRequest": null,
"timestamp": "2025-08-12T00:00:00"
}
}Send a new message to a session thread and receive updates as it is processed.
Responses are returned as Server-Sent Events that stream message processing updates. See the Streaming section for event types and payload formats.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
External user identifier; not necessarily registered with Envole
Path Parameters
Body
application/json
- Text
- Tool Approval Result
- File
- Image
Show child attributes
Show child attributes
Response
SSE stream of events from the agent.
Available options:
CONNECTION_ESTABLISHED, MESSAGE_RECEIVED, AGENT_RESPONSE_CHUNK, AGENT_RESPONSE_COMPLETE, TOOL_EXECUTION_APPROVAL_REQUEST, TOOL_EXECUTION_APPROVAL_RESPONSE, NOTIFICATION_TOOL_EXECUTION_INITIATED, NOTIFICATION_TOOL_EXECUTION_IN_PROGRESS, NOTIFICATION_TOOL_EXECUTION_APPROVAL_REQUIRED, NOTIFICATION_TOOL_EXECUTION_APPROVAL_ACCEPTED, NOTIFICATION_TOOL_EXECUTION_APPROVAL_DENIED, NOTIFICATION_TOOL_EXECUTION_APPROVAL_ABORTED, NOTIFICATION_AGENT_THINKING_STARTED, NOTIFICATION_AGENT_THINKING_COMPLETE, NOTIFICATION_KNOWLEDGE_RETRIEVAL_INITIATED, NOTIFICATION_KNOWLEDGE_RETRIEVAL_IN_PROGRESS, NOTIFICATION_KNOWLEDGE_RETRIEVAL_COMPLETED, NOTIFICATION_KNOWLEDGE_RETRIEVAL_FAILED, NOTIFICATION_KNOWLEDGE_RETRIEVAL_DUPLICATED_CACHED, NOTIFICATION_REQUEST_ORCHESTRATION_SIMPLE, NOTIFICATION_REQUEST_ORCHESTRATION_COMPLEX, NOTIFICATION_REQUEST_ORCHESTRATION_CAPABILITIES, NOTIFICATION_REQUEST_ORCHESTRATION_KNOWLEDGE_BASE, NOTIFICATION_REQUEST_ORCHESTRATION_TOOL_USAGE, NOTIFICATION_REQUEST_ORCHESTRATION_COLLABORATION, NOTIFICATION_PLAN_ORCHESTRATION_COMPLEX_INITIATED, NOTIFICATION_PLAN_ORCHESTRATION_COMPLEX_IN_PROGRESS, NOTIFICATION_PLAN_ORCHESTRATION_COMPLEX_COMPLETED, NOTIFICATION_PLAN_ORCHESTRATION_COMPLEX_REVIEW_INITIATED, NOTIFICATION_PLAN_ORCHESTRATION_COMPLEX_REVIEW_IN_PROGRESS, NOTIFICATION_PLAN_ORCHESTRATION_COMPLEX_REVIEW_COMPLETED, NOTIFICATION_PLAN_ORCHESTRATION_KNOWLEDGE_BASE_INITIATED, NOTIFICATION_PLAN_ORCHESTRATION_KNOWLEDGE_BASE_IN_PROGRESS, NOTIFICATION_PLAN_ORCHESTRATION_KNOWLEDGE_BASE_COMPLETED, NOTIFICATION_PLAN_ORCHESTRATION_KNOWLEDGE_RETRIEVAL_INITIATED, NOTIFICATION_PLAN_ORCHESTRATION_TOOL_USAGE_INITIATED, NOTIFICATION_PLAN_ORCHESTRATION_TOOL_USAGE_IN_PROGRESS, NOTIFICATION_PLAN_ORCHESTRATION_TOOL_USAGE_COMPLETED, NOTIFICATION_PLAN_ORCHESTRATION_REFLECTION_INITIATED, NOTIFICATION_PLAN_ORCHESTRATION_REFLECTION_ABORTED, NOTIFICATION_PLAN_ORCHESTRATION_REFLECTION_FAILED, NOTIFICATION_PLAN_ORCHESTRATION_REFLECTION_COMPLETED, NOTIFICATION_PLAN_ORCHESTRATION_COLLABORATION_INITIATED, NOTIFICATION_PLAN_ORCHESTRATION_COLLABORATION_IN_PROGRESS, NOTIFICATION_PLAN_ORCHESTRATION_COLLABORATION_COMPLETED, NOTIFICATION_MULTI_ASSISTANT_COLLABORATION_STARTED, NOTIFICATION_MULTI_ASSISTANT_COLLABORATION_ASSISTANT_RESPONSE_IN_PROGRESS, NOTIFICATION_MULTI_ASSISTANT_COLLABORATION_ASSISTANT_RESPONSE_COMPLETED, NOTIFICATION_MULTI_ASSISTANT_COLLABORATION_UNIFIED_RESPONSE_STARTED, NOTIFICATION_MULTI_ASSISTANT_COLLABORATION_NO_UNIFIED_RESPONSE_REQUIRED, NOTIFICATION_MULTI_ASSISTANT_COLLABORATION_COMPLETED, NOTIFICATION_MULTI_ASSISTANT_COLLABORATION_FAILED, NOTIFICATION_CONTEXT_MEMORIES_RETRIEVAL_FAILED, ERROR Show child attributes
Show child attributes