> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lehar.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# List sessions

> Lists agent sessions for the workspace, newest first, with pagination. Normal-user bearer tokens are owner-scoped: they see only their own sessions and cannot filter by another user_id, while API-key and admin callers see every session in the workspace. Scope `sessions:read`.



## OpenAPI

````yaml /api-reference/openapi.json get /sessions
openapi: 3.1.0
info:
  title: Lehar API
  version: v0
  description: >-
    Customer-facing REST API for the Lehar voice-AI platform. Platform-admin
    endpoints are intentionally excluded from this reference. Regenerate with
    `npm run sync:openapi`.
servers:
  - url: https://api.lehar.ai/ca/api/v0
security:
  - ApiKeyAuth: []
  - BearerAuth: []
paths:
  /sessions:
    get:
      tags:
        - Sessions
      summary: List sessions
      description: >-
        Lists agent sessions for the workspace, newest first, with pagination.
        Normal-user bearer tokens are owner-scoped: they see only their own
        sessions and cannot filter by another user_id, while API-key and admin
        callers see every session in the workspace. Scope `sessions:read`.
      operationId: list_customer_sessions_ca_api_v0_sessions_get
      parameters:
        - name: limit
          in: query
          required: false
          description: >-
            Maximum number of sessions to return. Values above 100 are capped at
            100.
          schema:
            type: integer
            default: 20
            minimum: 0
            maximum: 100
        - name: offset
          in: query
          required: false
          description: Number of sessions to skip for pagination.
          schema:
            type: integer
            default: 0
            minimum: 0
        - name: user_id
          in: query
          required: false
          description: >-
            Filter to sessions owned by this user. Normal-user bearer callers
            are forced to their own user_id; passing a different value returns
            403.
          schema:
            type: string
        - name: agent_id
          in: query
          required: false
          description: Filter to sessions created with this agent.
          schema:
            type: string
      responses:
        '200':
          description: Paginated list of sessions.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        session_id:
                          type: string
                        customer_id:
                          type: string
                        user_id:
                          type: string
                          nullable: true
                        user_name:
                          type: string
                          nullable: true
                        agent_id:
                          type: string
                        room_name:
                          type: string
                          nullable: true
                        participant_identity:
                          type: string
                          nullable: true
                        participant_name:
                          type: string
                          nullable: true
                        dispatch_id:
                          type: string
                          nullable: true
                        livekit_url:
                          type: string
                          nullable: true
                        status:
                          type: string
                          enum:
                            - active
                            - ended
                            - failed
                            - expired
                        qualification_status:
                          type: string
                          enum:
                            - pending
                            - qualified
                            - not_qualified
                            - inconclusive
                          nullable: true
                          description: >-
                            From the linked campaign recipient; null for
                            ad-hoc/web sessions.
                        sentiment:
                          type: string
                          enum:
                            - positive
                            - negative
                            - neutral
                          nullable: true
                          description: >-
                            Post-call customer sentiment; null when not analyzed
                            or still in flight.
                        metadata:
                          type: object
                          additionalProperties: true
                        call_type:
                          type: string
                          description: web, outbound_phone, or inbound_phone.
                        origin:
                          type: string
                          enum:
                            - dashboard
                            - api
                            - campaign
                            - inbound
                            - test
                          nullable: true
                        call_id:
                          type: string
                          nullable: true
                          description: Set only for sessions fired via POST /calls.
                        started_at:
                          type: string
                          format: date-time
                        ended_at:
                          type: string
                          format: date-time
                          nullable: true
                        created_at:
                          type: string
                          format: date-time
                        updated_at:
                          type: string
                          format: date-time
                  pagination:
                    type: object
                    properties:
                      limit:
                        type: integer
                      offset:
                        type: integer
                      total:
                        type: integer
              example:
                data:
                  - id: 01k4qx7m8p2rs5t7v9w1x3y5z7
                    session_id: session_01k4qx7m8p2rs5t7v9w1x3y5z7
                    customer_id: customer_01k3ab2c4d6e8f0g2h4j6k8m0n
                    user_id: user_01k2zzs7q9r1s3t5v7w9x1y3z5
                    user_name: Priya Sharma
                    agent_id: agent_01k1mn3p5q7r9s1t3v5w7x9y1z
                    room_name: session_01k4qx7m8p2rs5t7v9w1x3y5z7
                    participant_identity: user_01k2zzs7q9r1s3t5v7w9x1y3z5
                    participant_name: Priya Sharma
                    dispatch_id: AD_9f2c1a7b
                    livekit_url: wss://lehar-staging.livekit.cloud
                    status: active
                    qualification_status: null
                    sentiment: null
                    metadata:
                      agent_id: agent_01k1mn3p5q7r9s1t3v5w7x9y1z
                      user_name: Priya Sharma
                      call_type: web
                    call_type: web
                    origin: dashboard
                    call_id: null
                    started_at: '2026-09-02T10:15:30.482119+00:00'
                    ended_at: null
                    created_at: '2026-09-02T10:15:30.482119+00:00'
                    updated_at: '2026-09-02T10:15:30.482119+00:00'
                pagination:
                  limit: 20
                  offset: 0
                  total: 1
        '400':
          description: >-
            Invalid pagination values, or the request has no resolvable
            customer_id.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
              example:
                error:
                  code: invalid_request
                  message: limit and offset must be non-negative integers
        '401':
          description: No valid authentication was provided.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
              example:
                error:
                  code: unauthorized
                  message: Authentication required
        '403':
          description: >-
            The caller lacks the sessions:read scope, or a normal user tried to
            list another user's sessions.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
              example:
                error:
                  code: forbidden
                  message: Customer users can only list their own sessions
        '404':
          description: The resolved customer_id does not exist.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
              example:
                error:
                  code: not_found
                  message: Customer not found
        '500':
          description: An unexpected server error occurred.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
              example:
                error:
                  code: internal_error
                  message: An unexpected error occurred
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
    BearerAuth:
      type: http
      scheme: bearer

````