curl --request GET \
--url https://api.synthra.ai/v1/sessions/session_abc123def456 \
--header 'Authorization: Bearer synthra_live_abc123def456'
const response = await fetch(
'https://api.synthra.ai/v1/sessions/session_abc123def456',
{
headers: {
'Authorization': `Bearer ${process.env.SYNTHRA_API_KEY}`
}
}
);
const data = await response.json();
import requests
response = requests.get(
'https://api.synthra.ai/v1/sessions/session_abc123def456',
headers={
'Authorization': f'Bearer {api_key}'
}
)
{
"sessionId": "session_abc123def456",
"userId": "user_9f8e7d6c5b4a",
"createdAt": "2024-03-08T14:30:00Z",
"expiresAt": "2024-03-09T14:30:00Z",
"lastActivity": "2024-03-08T15:45:23Z",
"messageCount": 15,
"tokenUsage": {
"total": 1847,
"prompt": 923,
"completion": 924
},
"metadata": {
"source": "web",
"language": "en"
}
}
{
"error": {
"code": "session_not_found",
"message": "Session does not exist or has expired"
}
}
Session Operations
Get Session
Retrieve session details and statistics
GET
/
v1
/
sessions
/
{sessionId}
curl --request GET \
--url https://api.synthra.ai/v1/sessions/session_abc123def456 \
--header 'Authorization: Bearer synthra_live_abc123def456'
const response = await fetch(
'https://api.synthra.ai/v1/sessions/session_abc123def456',
{
headers: {
'Authorization': `Bearer ${process.env.SYNTHRA_API_KEY}`
}
}
);
const data = await response.json();
import requests
response = requests.get(
'https://api.synthra.ai/v1/sessions/session_abc123def456',
headers={
'Authorization': f'Bearer {api_key}'
}
)
{
"sessionId": "session_abc123def456",
"userId": "user_9f8e7d6c5b4a",
"createdAt": "2024-03-08T14:30:00Z",
"expiresAt": "2024-03-09T14:30:00Z",
"lastActivity": "2024-03-08T15:45:23Z",
"messageCount": 15,
"tokenUsage": {
"total": 1847,
"prompt": 923,
"completion": 924
},
"metadata": {
"source": "web",
"language": "en"
}
}
{
"error": {
"code": "session_not_found",
"message": "Session does not exist or has expired"
}
}
Authorization
string
required
Bearer token. Format:
Bearer synthra_live_abc123def456Path Parameters
string
required
Unique session identifier. Format:
session_<16 chars>Response
string
Unique session identifier
string
User identifier associated with this session
string
ISO 8601 timestamp of session creation
string
ISO 8601 timestamp when session will auto-expire
string
ISO 8601 timestamp of last message
number
Total number of messages in session
object
Token usage statistics
object
Custom metadata attached to session
curl --request GET \
--url https://api.synthra.ai/v1/sessions/session_abc123def456 \
--header 'Authorization: Bearer synthra_live_abc123def456'
const response = await fetch(
'https://api.synthra.ai/v1/sessions/session_abc123def456',
{
headers: {
'Authorization': `Bearer ${process.env.SYNTHRA_API_KEY}`
}
}
);
const data = await response.json();
import requests
response = requests.get(
'https://api.synthra.ai/v1/sessions/session_abc123def456',
headers={
'Authorization': f'Bearer {api_key}'
}
)
{
"sessionId": "session_abc123def456",
"userId": "user_9f8e7d6c5b4a",
"createdAt": "2024-03-08T14:30:00Z",
"expiresAt": "2024-03-09T14:30:00Z",
"lastActivity": "2024-03-08T15:45:23Z",
"messageCount": 15,
"tokenUsage": {
"total": 1847,
"prompt": 923,
"completion": 924
},
"metadata": {
"source": "web",
"language": "en"
}
}
{
"error": {
"code": "session_not_found",
"message": "Session does not exist or has expired"
}
}