Get Session
curl --request GET \
--url https://api.agenthuman.com/v1/sessions/{session_id} \
--header 'x-api-key: <api-key>'import requests
url = "https://api.agenthuman.com/v1/sessions/{session_id}"
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.agenthuman.com/v1/sessions/{session_id}', 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.agenthuman.com/v1/sessions/{session_id}",
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.agenthuman.com/v1/sessions/{session_id}"
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.agenthuman.com/v1/sessions/{session_id}")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.agenthuman.com/v1/sessions/{session_id}")
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{
"success": true,
"session": {
"session_id": "sess_01H3Z8G9YR3K2N5M6P7Q8W4T",
"status": "ended",
"started_at": "2024-01-15T12:00:00Z",
"ended_at": "2024-01-15T12:05:30Z",
"expiration": "2024-01-15T14:35:00Z",
"duration": 330,
"metadata": {
"user_name": "John Doe",
"session_purpose": "Customer Support",
"custom_field": "any value"
}
}
}
Sessions
Get Session
Retrieve a specific session by ID
GET
/
v1
/
sessions
/
{session_id}
Get Session
curl --request GET \
--url https://api.agenthuman.com/v1/sessions/{session_id} \
--header 'x-api-key: <api-key>'import requests
url = "https://api.agenthuman.com/v1/sessions/{session_id}"
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.agenthuman.com/v1/sessions/{session_id}', 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.agenthuman.com/v1/sessions/{session_id}",
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.agenthuman.com/v1/sessions/{session_id}"
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.agenthuman.com/v1/sessions/{session_id}")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.agenthuman.com/v1/sessions/{session_id}")
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{
"success": true,
"session": {
"session_id": "sess_01H3Z8G9YR3K2N5M6P7Q8W4T",
"status": "ended",
"started_at": "2024-01-15T12:00:00Z",
"ended_at": "2024-01-15T12:05:30Z",
"expiration": "2024-01-15T14:35:00Z",
"duration": 330,
"metadata": {
"user_name": "John Doe",
"session_purpose": "Customer Support",
"custom_field": "any value"
}
}
}
Path Parameters
string
required
The ID of the session to retrieve
Response
boolean
Whether the request was successful
object
The session object (See Session schema).
{
"success": true,
"session": {
"session_id": "sess_01H3Z8G9YR3K2N5M6P7Q8W4T",
"status": "ended",
"started_at": "2024-01-15T12:00:00Z",
"ended_at": "2024-01-15T12:05:30Z",
"expiration": "2024-01-15T14:35:00Z",
"duration": 330,
"metadata": {
"user_name": "John Doe",
"session_purpose": "Customer Support",
"custom_field": "any value"
}
}
}
This endpoint does not return
session_token or room. Save the session_token from the Create Session response if you need it for streaming. The room configuration is stored but not exposed in API responses.⌘I