curl "$ATAI_API_ENDPOINT/agents/sessions/ses_01jcf4p9r6wy3nv8s5m7jcae0b/results?limit=50" \
-H "Authorization: Bearer $ATAI_API_KEY"
import os
import requests
base_url = os.environ["ATAI_API_ENDPOINT"]
api_key = os.environ["ATAI_API_KEY"]
headers = {"Authorization": f"Bearer {api_key}"}
results_url = f"{base_url}/agents/sessions/ses_01jcf4p9r6wy3nv8s5m7jcae0b/results"
cursor = None
while True:
params = {"limit": 100}
if cursor:
params["after"] = cursor
response = requests.get(results_url, headers=headers, params=params)
if response.status_code != 200:
print(f"Error: {response.json()['errors']}")
break
page = response.json()
for result in page["data"]:
file_ref = result["data"]
print(f"{file_ref['filename']} -> {file_ref['ref']}")
if not page["has_more"]:
break
# The cursor is opaque: pass it back verbatim.
cursor = page["next_cursor"]
const response = await fetch(
`${process.env.ATAI_API_ENDPOINT}/agents/sessions/ses_01jcf4p9r6wy3nv8s5m7jcae0b/results?limit=50`,
{
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`
}
}
);
const body = await response.json();
if (response.ok) {
body.data.forEach((result) => console.log(result.data.filename, result.data.ref));
} else {
console.error('Error:', body.errors);
}
{
"data": [
{
"data": {
"ref": "https://<presigned-url>",
"filename": "predictions.ndjson",
"file_extension": "ndjson",
"file_type": null,
"num_bytes": 48213,
"file_attributes": {
"job_output.status": "<status>"
}
},
"created_at": "2026-10-29T16:12:38Z"
}
],
"has_more": false,
"next_cursor": null,
"prev_cursor": null
}
Sessions
Get Session Results
Page through the output files a batch session produced
GET
/
api
/
agents
/
sessions
/
{session_id}
/
results
curl "$ATAI_API_ENDPOINT/agents/sessions/ses_01jcf4p9r6wy3nv8s5m7jcae0b/results?limit=50" \
-H "Authorization: Bearer $ATAI_API_KEY"
import os
import requests
base_url = os.environ["ATAI_API_ENDPOINT"]
api_key = os.environ["ATAI_API_KEY"]
headers = {"Authorization": f"Bearer {api_key}"}
results_url = f"{base_url}/agents/sessions/ses_01jcf4p9r6wy3nv8s5m7jcae0b/results"
cursor = None
while True:
params = {"limit": 100}
if cursor:
params["after"] = cursor
response = requests.get(results_url, headers=headers, params=params)
if response.status_code != 200:
print(f"Error: {response.json()['errors']}")
break
page = response.json()
for result in page["data"]:
file_ref = result["data"]
print(f"{file_ref['filename']} -> {file_ref['ref']}")
if not page["has_more"]:
break
# The cursor is opaque: pass it back verbatim.
cursor = page["next_cursor"]
const response = await fetch(
`${process.env.ATAI_API_ENDPOINT}/agents/sessions/ses_01jcf4p9r6wy3nv8s5m7jcae0b/results?limit=50`,
{
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`
}
}
);
const body = await response.json();
if (response.ok) {
body.data.forEach((result) => console.log(result.data.filename, result.data.ref));
} else {
console.error('Error:', body.errors);
}
{
"data": [
{
"data": {
"ref": "https://<presigned-url>",
"filename": "predictions.ndjson",
"file_extension": "ndjson",
"file_type": null,
"num_bytes": 48213,
"file_attributes": {
"job_output.status": "<status>"
}
},
"created_at": "2026-10-29T16:12:38Z"
}
],
"has_more": false,
"next_cursor": null,
"prev_cursor": null
}
Requires version 2.0.1 or later of the Archetype platform.
Overview
This endpoint returns a page of the output files abatch session’s job produced, newest first.
Each entry points at a stored file.
Request
Forward cursor: return results older than this page. Pass the previous page’s
next_cursor. The
cursor is opaque: it is not a result id, so never compute on it. Mutually exclusive with
before.Backward cursor: return results newer than this page. Opaque, as
after is. Mutually exclusive
with after.Response
Cursor for the next page in the same direction. Pass it as
after when paging forward, or as
before when you supplied before. null when has_more is false.Cursor to step back the way this page was reached. Pass it as
before after a forward page, or
as after after a backward one. null when the request carried no cursor.Result entry object
File ref object (data)
Fetchable reference to the bytes: a presigned URL, or a data-service ref that has to be downloaded through the authenticated proxy.
Executor-recorded attributes. Carries
job_output.status, which marks a result written by a run that only partially succeeded.curl "$ATAI_API_ENDPOINT/agents/sessions/ses_01jcf4p9r6wy3nv8s5m7jcae0b/results?limit=50" \
-H "Authorization: Bearer $ATAI_API_KEY"
import os
import requests
base_url = os.environ["ATAI_API_ENDPOINT"]
api_key = os.environ["ATAI_API_KEY"]
headers = {"Authorization": f"Bearer {api_key}"}
results_url = f"{base_url}/agents/sessions/ses_01jcf4p9r6wy3nv8s5m7jcae0b/results"
cursor = None
while True:
params = {"limit": 100}
if cursor:
params["after"] = cursor
response = requests.get(results_url, headers=headers, params=params)
if response.status_code != 200:
print(f"Error: {response.json()['errors']}")
break
page = response.json()
for result in page["data"]:
file_ref = result["data"]
print(f"{file_ref['filename']} -> {file_ref['ref']}")
if not page["has_more"]:
break
# The cursor is opaque: pass it back verbatim.
cursor = page["next_cursor"]
const response = await fetch(
`${process.env.ATAI_API_ENDPOINT}/agents/sessions/ses_01jcf4p9r6wy3nv8s5m7jcae0b/results?limit=50`,
{
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`
}
}
);
const body = await response.json();
if (response.ok) {
body.data.forEach((result) => console.log(result.data.filename, result.data.ref));
} else {
console.error('Error:', body.errors);
}
{
"data": [
{
"data": {
"ref": "https://<presigned-url>",
"filename": "predictions.ndjson",
"file_extension": "ndjson",
"file_type": null,
"num_bytes": 48213,
"file_attributes": {
"job_output.status": "<status>"
}
},
"created_at": "2026-10-29T16:12:38Z"
}
],
"has_more": false,
"next_cursor": null,
"prev_cursor": null
}
Important Notes
- Passing both
afterandbeforereturns400, as does a malformed cursor. - A
409means the session is aservingsession, which writes no output files. Its answers are returned by Query Session. - A
404means the session does not exist, belongs to another organization, or is in a project you cannot see.
Was this page helpful?