Retrieve a session
curl --request GET \
--url https://agp.eu.hcompany.ai/api/v2/sessions/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://agp.eu.hcompany.ai/api/v2/sessions/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://agp.eu.hcompany.ai/api/v2/sessions/{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://agp.eu.hcompany.ai/api/v2/sessions/{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 => [
"Authorization: Bearer <token>"
],
]);
$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://agp.eu.hcompany.ai/api/v2/sessions/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://agp.eu.hcompany.ai/api/v2/sessions/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://agp.eu.hcompany.ai/api/v2/sessions/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"request": {},
"status": {},
"agent_view_url": {},
"latest_answer": {},
"created_at": "<string>",
"started_at": {},
"finished_at": {}
}Sessions
Retrieve a session
Get the full session object: status, agent, environments, latest answer, timestamps, and usage.
GET
/
api
/
v2
/
sessions
/
{id}
Retrieve a session
curl --request GET \
--url https://agp.eu.hcompany.ai/api/v2/sessions/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://agp.eu.hcompany.ai/api/v2/sessions/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://agp.eu.hcompany.ai/api/v2/sessions/{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://agp.eu.hcompany.ai/api/v2/sessions/{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 => [
"Authorization: Bearer <token>"
],
]);
$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://agp.eu.hcompany.ai/api/v2/sessions/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://agp.eu.hcompany.ai/api/v2/sessions/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://agp.eu.hcompany.ai/api/v2/sessions/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"request": {},
"status": {},
"agent_view_url": {},
"latest_answer": {},
"created_at": "<string>",
"started_at": {},
"finished_at": {}
}Retrieves a session: the original request, current status, and
latest_answer. It is the cursor-independent way to read a finished run’s result. Auth is optional, so public shares work. To check only whether a session finished, poll the lighter status endpoint.
Returns the session object.
Path parameters
string
required
The session ID returned when the session was created.
Response
The session object, also returned by create.string
Session UUID, used by every follow-up call.
object
Live state:
status, error, error_code, outcome, steps, usage_per_model, and subagent_session_ids. Field details: Get session status.string | null
The session’s Agent View page, for live viewing and replay.
string | object | null
The agent’s latest final answer: text, or an object matching the agent’s
answer_format. Mirrors the answer from changes. null until the agent first answers.string
ISO 8601 creation time.
string | null
When the agent started.
null until then.string | null
When the session reached a terminal state.
null until then.Examples
hai sessions get a1b2c3d4-e5f6-7890-abcd-ef1234567890
curl https://agp.eu.hcompany.ai/api/v2/sessions/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
-H "Authorization: Bearer $HAI_API_KEY"
from hai_agents import Client
client = Client()
session = client.sessions.get_session("a1b2c3d4-e5f6-7890-abcd-ef1234567890")
print(session.status.status, session.latest_answer)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
const session = await client.sessions.getSession({
id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
});
console.log(session.status.status, session.latestAnswer);
Response
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"request": {
"agent": {"name": "h/web-surfer-flash", "model": "holo4-35b-a3b", "...": "..."},
"messages": [
{"type": "user_message", "message": "Find the top 3 stories on Hacker News"}
],
"...": "..."
},
"status": {
"status": "completed",
"error": null,
"error_code": null,
"outcome": "success",
"steps": 12,
"usage_per_model": [
{
"name": "holo4-35b-a3b",
"input_tokens": 24800,
"cached_tokens": 18000,
"output_tokens": 1420,
"reasoning_tokens": 0
}
],
"subagent_session_ids": []
},
"agent_view_url": "https://platform.hcompany.ai/agents/sessions/a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"latest_answer": "1. ... 2. ... 3. ...",
"created_at": "2026-05-07T14:30:00Z",
"started_at": "2026-05-07T14:30:02Z",
"finished_at": "2026-05-07T14:31:15Z"
}
Errors
| Status | Cause |
|---|---|
404 | Session not found or you don’t have access. |
Was this page helpful?