Skip to main content
GET
/
api
/
assistants
/
threads
/
{threadId}
/
messages
Retrieve session thread messages
curl --request GET \
  --url https://agent-service-511985928315.us-east4.run.app/api/assistants/threads/{threadId}/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'X-Envole-User-Id: <api-key>'
import requests

url = "https://agent-service-511985928315.us-east4.run.app/api/assistants/threads/{threadId}/messages"

headers = {
"Authorization": "Bearer <token>",
"X-Envole-User-Id": "<api-key>"
}

response = requests.get(url, headers=headers)

print(response.text)
const options = {
method: 'GET',
headers: {Authorization: 'Bearer <token>', 'X-Envole-User-Id': '<api-key>'}
};

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 => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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"
"net/http"
"io"
)

func main() {

url := "https://agent-service-511985928315.us-east4.run.app/api/assistants/threads/{threadId}/messages"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("X-Envole-User-Id", "<api-key>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://agent-service-511985928315.us-east4.run.app/api/assistants/threads/{threadId}/messages")
.header("Authorization", "Bearer <token>")
.header("X-Envole-User-Id", "<api-key>")
.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::Get.new(url)
request["Authorization"] = 'Bearer <token>'
request["X-Envole-User-Id"] = '<api-key>'

response = http.request(request)
puts response.read_body
[
  {
    "id": "msg_122",
    "role": "user",
    "content": "Can you send an email to john@company.com about the project status update?",
    "timestamp": "2024-01-01T11:59:00Z"
  },
  {
    "id": "msg_123",
    "handle": "@project_manager",
    "role": "assistant",
    "content": "I'll send an email to john@company.com with the project status update. Let me compose and send that for you.",
    "toolExecutionHumanApprovalRequest": [
      {
        "toolId": "tool_456",
        "name": "gmail_send_email",
        "provider": "GMAIL",
        "category": "EMAIL",
        "toolExecutionId": "exec_789",
        "executionBatchId": "batch_101",
        "toolArguments": {
          "to": "john@company.com",
          "subject": "Project Status Update",
          "body": "Hi John,\n\nHere's the latest project status update...",
          "from": "assistant@company.com"
        },
        "status": "PENDING_HUMAN_APPROVAL"
      }
    ],
    "timestamp": "2024-01-01T12:00:00Z"
  }
]
Get messages from a session thread.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

X-Envole-User-Id
string
header
required

External user identifier; not necessarily registered with Envole

Path Parameters

threadId
string
required

Query Parameters

maxResults
integer

Response

A list of session thread messages.

id
string
handle
string
role
enum<string>
Available options:
user,
assistant,
system
content
string
toolExecutionHumanApprovalRequest
object[]
timestamp
string<date-time>