Skip to main content
GET
https://jwhite.tail8bf327.ts.net
/
api
/
v1
/
agents
/
{id}
/
sessions
Get Agent Sessions
curl --request GET \
  --url https://jwhite.tail8bf327.ts.net/api/v1/agents/{id}/sessions \
  --header 'x-api-key: <api-key>'
{
  "success": true,
  "sessions": [
    {
      "id": 456,
      "session_id": 456,
      "agent_id": 123,
      "call_type": "voice",
      "status": "completed",
      "started_at": "2024-01-15T12:00:00Z",
      "ended_at": "2024-01-15T12:05:30Z",
      "duration": 330,
      "metadata": null,
      "created_at": "2024-01-15T12:00:00Z"
    },
    {
      "id": 457,
      "session_id": 457,
      "agent_id": 123,
      "call_type": "voice",
      "status": "active",
      "started_at": "2024-01-15T13:00:00Z",
      "ended_at": null,
      "duration": null,
      "metadata": {
        "source": "web_app"
      },
      "created_at": "2024-01-15T13:00:00Z"
    }
  ]
}

Authentication

Requires JWT authentication (cookie-based) or API key authentication.
Authorization: Bearer <jwt_token>

Parameters

id
integer
required
The ID of the agent

Request

GET https://jwhite.tail8bf327.ts.net/api/v1/agents/123/sessions
Authorization: Bearer <jwt_token>

Response

{
  "success": true,
  "sessions": [
    {
      "id": 456,
      "session_id": 456,
      "agent_id": 123,
      "call_type": "voice",
      "status": "completed",
      "started_at": "2024-01-15T12:00:00Z",
      "ended_at": "2024-01-15T12:05:30Z",
      "duration": 330,
      "metadata": null,
      "created_at": "2024-01-15T12:00:00Z"
    },
    {
      "id": 457,
      "session_id": 457,
      "agent_id": 123,
      "call_type": "voice",
      "status": "active",
      "started_at": "2024-01-15T13:00:00Z",
      "ended_at": null,
      "duration": null,
      "metadata": {
        "source": "web_app"
      },
      "created_at": "2024-01-15T13:00:00Z"
    }
  ]
}
{
  "success": false,
  "error": "Agent not found or access denied"
}

Response Fields

FieldTypeDescription
successbooleanWhether the request was successful
sessionsarrayArray of session objects
sessions[].idintegerSession ID
sessions[].session_idintegerSession ID (alias)
sessions[].agent_idintegerParent agent ID
sessions[].call_typestringSession type (‘voice’, ‘video’, ‘chat’)
sessions[].statusstringSession status (‘active’, ‘completed’)
sessions[].started_atstringISO 8601 timestamp when session started
sessions[].ended_atstringISO 8601 timestamp when session ended (null if active)
sessions[].durationintegerSession duration in seconds (null if active)
sessions[].metadataobjectCustom metadata (JSON)
sessions[].created_atstringISO 8601 creation timestamp

Notes

  • Sessions are ordered by created_at in descending order (most recent first)
  • Active sessions will have null for ended_at and duration
  • You must own the agent to view its sessions

Error Responses

For information about error responses and status codes, see Error Responses.

Common Errors for This Endpoint

  • 401 Unauthorized - Invalid or missing authentication
  • 403 Forbidden - Insufficient permissions
  • 404 Not Found - Agent not found or access denied
  • 500 Internal Server Error - Server error