curl https://api.u1.archetypeai.app/v0.5/lens/sessions/metadata \
-H "Authorization: Bearer $ATAI_API_KEY"
curl "https://api.u1.archetypeai.app/v0.5/lens/sessions/metadata?session_id=lsn-250313c2177253cbaa7a73542edd90" \
-H "Authorization: Bearer $ATAI_API_KEY"
import requests
import os
api_key = os.environ.get("ATAI_API_KEY")
response = requests.get(
"https://api.u1.archetypeai.app/v0.5/lens/sessions/metadata",
headers={"Authorization": f"Bearer {api_key}"}
)
sessions = response.json()
if not sessions:
print("No active sessions")
else:
for session in sessions:
print(f"Session: {session['session_id']}")
print(f" Status: {session['session_status']}")
const response = await fetch('https://api.u1.archetypeai.app/v0.5/lens/sessions/metadata', {
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`
}
});
const sessions = await response.json();
if (sessions.length === 0) {
console.log('No active sessions');
} else {
sessions.forEach(session => {
console.log(`Session: ${session.session_id}`);
});
}
[
{
"session_id": "lsn-250313c2177253cbaa7a73542edd90",
"lens_id": "lns-fd669361822b07e2-237ab3ffd79199b1",
"last_update_timestamp": 1741843135.1848276,
"session_status": "SESSION_STATUS_RUNNING",
"session_runner": "lens_service:runner:lens-node-worker-node-abc123",
"session_endpoint": "wss://api.u1.archetypeai.app/v0.5/lens/sessions/lsn-250313c2177253cbaa7a73542edd90",
"session_index": 0,
"session_duration_sec": 2811.020206451416
}
]
[]
[]
{
"errors": [
{
"code": "unauthorized_request",
"message": "Unauthorized or invalid access.",
"suggestion": "Provide valid authentication credentials and ensure they have the required permissions.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"detail": [
{
"type": "int_parsing",
"loc": [
"query",
"shard_index"
],
"msg": "Input should be a valid integer, unable to parse string as an integer",
"input": "abc"
}
]
}
Lens API
Get Sessions Metadata
Get detailed metadata for all active lens sessions
GET
/
lens
/
sessions
/
metadata
curl https://api.u1.archetypeai.app/v0.5/lens/sessions/metadata \
-H "Authorization: Bearer $ATAI_API_KEY"
curl "https://api.u1.archetypeai.app/v0.5/lens/sessions/metadata?session_id=lsn-250313c2177253cbaa7a73542edd90" \
-H "Authorization: Bearer $ATAI_API_KEY"
import requests
import os
api_key = os.environ.get("ATAI_API_KEY")
response = requests.get(
"https://api.u1.archetypeai.app/v0.5/lens/sessions/metadata",
headers={"Authorization": f"Bearer {api_key}"}
)
sessions = response.json()
if not sessions:
print("No active sessions")
else:
for session in sessions:
print(f"Session: {session['session_id']}")
print(f" Status: {session['session_status']}")
const response = await fetch('https://api.u1.archetypeai.app/v0.5/lens/sessions/metadata', {
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`
}
});
const sessions = await response.json();
if (sessions.length === 0) {
console.log('No active sessions');
} else {
sessions.forEach(session => {
console.log(`Session: ${session.session_id}`);
});
}
[
{
"session_id": "lsn-250313c2177253cbaa7a73542edd90",
"lens_id": "lns-fd669361822b07e2-237ab3ffd79199b1",
"last_update_timestamp": 1741843135.1848276,
"session_status": "SESSION_STATUS_RUNNING",
"session_runner": "lens_service:runner:lens-node-worker-node-abc123",
"session_endpoint": "wss://api.u1.archetypeai.app/v0.5/lens/sessions/lsn-250313c2177253cbaa7a73542edd90",
"session_index": 0,
"session_duration_sec": 2811.020206451416
}
]
[]
[]
{
"errors": [
{
"code": "unauthorized_request",
"message": "Unauthorized or invalid access.",
"suggestion": "Provide valid authentication credentials and ensure they have the required permissions.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"detail": [
{
"type": "int_parsing",
"loc": [
"query",
"shard_index"
],
"msg": "Input should be a valid integer, unable to parse string as an integer",
"input": "abc"
}
]
}
Requires version 1.1.5 or later of the Archetype platform.
Overview
This endpoint returns detailed information about each active lens session in your organization.Request
string
Optional. Filter to a specific session by ID.
integer
default:"-1"
Optional. Shard index for pagination. Use
-1 to retrieve all sessions.integer
default:"-1"
Optional. Maximum items per shard. Use
-1 for no limit.Response
Returns an array of session objects, each containing:string
Unique identifier for the session
string
The lens ID associated with this session
float
Unix timestamp of the last activity on this session
string
Current status of the session
string
WebSocket endpoint for this session
float
How long the session has been active in seconds
string
Identifier of the backend runner hosting the session.
integer
Zero-based index of this session within the runner.
curl https://api.u1.archetypeai.app/v0.5/lens/sessions/metadata \
-H "Authorization: Bearer $ATAI_API_KEY"
curl "https://api.u1.archetypeai.app/v0.5/lens/sessions/metadata?session_id=lsn-250313c2177253cbaa7a73542edd90" \
-H "Authorization: Bearer $ATAI_API_KEY"
import requests
import os
api_key = os.environ.get("ATAI_API_KEY")
response = requests.get(
"https://api.u1.archetypeai.app/v0.5/lens/sessions/metadata",
headers={"Authorization": f"Bearer {api_key}"}
)
sessions = response.json()
if not sessions:
print("No active sessions")
else:
for session in sessions:
print(f"Session: {session['session_id']}")
print(f" Status: {session['session_status']}")
const response = await fetch('https://api.u1.archetypeai.app/v0.5/lens/sessions/metadata', {
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`
}
});
const sessions = await response.json();
if (sessions.length === 0) {
console.log('No active sessions');
} else {
sessions.forEach(session => {
console.log(`Session: ${session.session_id}`);
});
}
[
{
"session_id": "lsn-250313c2177253cbaa7a73542edd90",
"lens_id": "lns-fd669361822b07e2-237ab3ffd79199b1",
"last_update_timestamp": 1741843135.1848276,
"session_status": "SESSION_STATUS_RUNNING",
"session_runner": "lens_service:runner:lens-node-worker-node-abc123",
"session_endpoint": "wss://api.u1.archetypeai.app/v0.5/lens/sessions/lsn-250313c2177253cbaa7a73542edd90",
"session_index": 0,
"session_duration_sec": 2811.020206451416
}
]
[]
[]
{
"errors": [
{
"code": "unauthorized_request",
"message": "Unauthorized or invalid access.",
"suggestion": "Provide valid authentication credentials and ensure they have the required permissions.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"detail": [
{
"type": "int_parsing",
"loc": [
"query",
"shard_index"
],
"msg": "Input should be a valid integer, unable to parse string as an integer",
"input": "abc"
}
]
}
Was this page helpful?
⌘I