List Sessions
curl --request GET \
--url https://api.truthlocks.com/v1/agent-sessions \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.truthlocks.com/v1/agent-sessions"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.truthlocks.com/v1/agent-sessions', 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.truthlocks.com/v1/agent-sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <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://api.truthlocks.com/v1/agent-sessions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<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://api.truthlocks.com/v1/agent-sessions")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.truthlocks.com/v1/agent-sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"items": [
{
"session_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"token": "<string>",
"scopes": [
"<string>"
],
"status": "active",
"metadata": {},
"expires_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"terminated_at": "2023-11-07T05:31:56Z"
}
],
"total": 123
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}Agent Sessions & Tools
List Sessions
List agent sessions with filtering by agent, status, and pagination
GET
/
v1
/
agent-sessions
List Sessions
curl --request GET \
--url https://api.truthlocks.com/v1/agent-sessions \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.truthlocks.com/v1/agent-sessions"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.truthlocks.com/v1/agent-sessions', 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.truthlocks.com/v1/agent-sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <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://api.truthlocks.com/v1/agent-sessions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<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://api.truthlocks.com/v1/agent-sessions")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.truthlocks.com/v1/agent-sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"items": [
{
"session_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"token": "<string>",
"scopes": [
"<string>"
],
"status": "active",
"metadata": {},
"expires_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"terminated_at": "2023-11-07T05:31:56Z"
}
],
"total": 123
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}List Sessions
GET /v1/agent-sessions
Returns a paginated list of agent sessions for the authenticated tenant. Results can be filtered by agent ID and session status. Sessions are returned in reverse chronological order (newest first).
Authentication
RequiresX-API-Key header or Bearer JWT token. Tenant-scoped via X-Tenant-ID.
Query Parameters
string
Filter sessions by the owning agent’s MAIP identifier (e.g.,
maip:t1234567:01HYX3KPZQ7RJGBN0WFMV8SDEH).string
Filter by session status. One of:
"active", "expired", "terminated",
"handed_off".integer
Maximum number of sessions to return per page. Range: 1-200. Default:
50.integer
Number of records to skip for pagination. Default:
0.Response
object[]
Array of session objects. Each contains
session_id, agent_id, status,
scopes, metadata, expires_at, parent_session_id, handed_off_to,
ip_address, user_agent, refreshed_at, terminated_at, created_at, and
updated_at. Token hashes are never exposed in list responses.integer
Total count of sessions matching the filter criteria, across all pages.
Example
curl -G https://api.truthlocks.com/v1/agent-sessions \
-H "X-API-Key: tl_live_..." \
-d "agent_id=maip:t1234567:01HYX3KPZQ7RJGBN0WFMV8SDEH" \
-d "status=active" \
-d "limit=25" \
-d "offset=0"
Session Status Reference
| Status | Description |
|---|---|
active | Session is valid and accepting requests |
expired | Session TTL has elapsed; no longer valid |
terminated | Session was explicitly terminated via API |
handed_off | Session was transferred to another agent via handoff |
Authorizations
API key for machine-to-machine authentication
Query Parameters
Filter sessions by agent
Filter by session status
Available options:
active, terminated, expired Required range:
1 <= x <= 100Required range:
x >= 0
