Skip to main content
Sessions enable stateful, multi-turn conversations with agents. Each session maintains conversation history and can be resumed or ended explicitly.

Base URL

All session endpoints are under:
https://api.superserve.ai/v1/sessions

Create Session

Create a new conversation session with an agent.
POST /v1/sessions
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json
Request Body:
agent_id
string
required
Agent ID (e.g., agt_abc123)
title
string
Optional session title for identification
idle_timeout_seconds
number
default:1740
Number of seconds of inactivity before the session automatically ends (default: 29 minutes)
Response:
id
string
required
Session ID (prefixed with ses_)
agent_id
string
required
Agent ID this session is connected to
agent_name
string
Name of the agent
status
string
required
Session status: active, idle, or ended
title
string
Session title if provided
message_count
number
required
Number of messages exchanged in this session
created_at
string
required
ISO 8601 timestamp when the session was created
last_activity_at
string
ISO 8601 timestamp of the last activity
Example Request:
{
  "agent_id": "agt_abc123",
  "title": "Customer support chat",
  "idle_timeout_seconds": 1740
}
Example Response:
{
  "id": "ses_xyz789",
  "agent_id": "agt_abc123",
  "agent_name": "my-agent",
  "status": "active",
  "title": "Customer support chat",
  "message_count": 0,
  "created_at": "2026-03-09T10:00:00Z",
  "last_activity_at": "2026-03-09T10:00:00Z"
}

List Sessions

Retrieve sessions with optional filters.
GET /v1/sessions?limit=20&agent_id=agt_abc123&status=active
Authorization: Bearer YOUR_API_TOKEN
Query Parameters:
limit
string
default:"20"
Maximum number of sessions to return
agent_id
string
Filter by agent ID
status
string
Filter by status: active, idle, or ended
Response:
sessions
array
required
Array of session objects (same schema as create session response)
Example Response:
{
  "sessions": [
    {
      "id": "ses_xyz789",
      "agent_id": "agt_abc123",
      "agent_name": "my-agent",
      "status": "active",
      "title": "Customer support chat",
      "message_count": 5,
      "created_at": "2026-03-09T10:00:00Z",
      "last_activity_at": "2026-03-09T10:15:00Z"
    }
  ]
}

Get Session

Retrieve details for a specific session.
GET /v1/sessions/{session_id}
Authorization: Bearer YOUR_API_TOKEN
Path Parameters:
session_id
string
required
Session ID (e.g., ses_xyz789). Can be a short prefix for convenience.
Response: Same schema as create session response. Example:
{
  "id": "ses_xyz789",
  "agent_id": "agt_abc123",
  "agent_name": "my-agent",
  "status": "active",
  "title": "Customer support chat",
  "message_count": 5,
  "created_at": "2026-03-09T10:00:00Z",
  "last_activity_at": "2026-03-09T10:15:00Z"
}

End Session

Explicitly end a session and release resources.
POST /v1/sessions/{session_id}/end
Authorization: Bearer YOUR_API_TOKEN
Path Parameters:
session_id
string
required
Session ID (e.g., ses_xyz789)
Response: Updated session object with status: "ended". Example:
{
  "id": "ses_xyz789",
  "agent_id": "agt_abc123",
  "agent_name": "my-agent",
  "status": "ended",
  "title": "Customer support chat",
  "message_count": 10,
  "created_at": "2026-03-09T10:00:00Z",
  "last_activity_at": "2026-03-09T10:30:00Z"
}

Resume Session

Resume an idle session.
POST /v1/sessions/{session_id}/resume
Authorization: Bearer YOUR_API_TOKEN
Path Parameters:
session_id
string
required
Session ID (e.g., ses_xyz789)
Response: Updated session object with status: "active".

Resolve Session ID

Resolve a short session ID prefix to the full ID.
GET /v1/sessions/resolve?id_prefix=xyz
Authorization: Bearer YOUR_API_TOKEN
Query Parameters:
id_prefix
string
required
Session ID prefix (e.g., xyz for ses_xyz789)
Response:
ids
string[]
Array of matching session IDs
Example:
{
  "ids": ["ses_xyz789abc123"]
}
If multiple sessions match the prefix, the API returns a 409 Conflict error. Provide a longer prefix to disambiguate.

Session Status

StatusDescription
activeSession is ready to receive messages
idleSession timed out due to inactivity (can be resumed)
endedSession was explicitly ended (cannot be resumed)

Error Responses

status
number
HTTP status code
detail
string
Error message
details
object
Additional error context
Common Errors:
StatusMessage
401Not authenticated
404Session not found
409Ambiguous session ID prefix
422Invalid session parameters

Build docs developers (and LLMs) love