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

# List raw availability events (paginated)

> Returns the raw AgentAvailabilityEvent stream (connection / availability / capacity transitions) within a time window, optionally filtered by user, category, value, and source. Used to back the audit / drill-down view on the escalation dashboard.



## OpenAPI

````yaml /api-reference/openapi.yaml get /api/escalation-dashboard/availability-events
openapi: 3.0.3
info:
  title: Tether Relay and Tether API
  version: 1.0.0
  description: >-
    Route-derived OpenAPI contract generated from tether-relay backend sources.
    Regenerate with scripts/sync-openapi-from-backend.mjs.
servers:
  - url: https://your-instance.example.com
    description: Production
  - url: http://localhost:2212
    description: Local API service
security: []
tags:
  - name: AI
  - name: Applications
  - name: Approval
  - name: Auth
  - name: Automations
  - name: Calls
  - name: Campaigns
  - name: Contact Analytics
  - name: Contact Metrics
  - name: Contact Notes
  - name: Contacts
  - name: Conversation Monitor
  - name: Conversations
  - name: Departments
  - name: Email
  - name: Escalation Dashboard
  - name: Event Logs
  - name: Google Sheets
  - name: Marketplace
  - name: Messages
  - name: Notification Sounds
  - name: Notifications
  - name: Org Snapshots
  - name: Organizations
  - name: Outreach
  - name: Outreach Metrics
  - name: Outreach Sources
  - name: Pipelines
  - name: Processes
  - name: Prompts
  - name: Reminders
  - name: Sms
  - name: Templates
  - name: Traces
  - name: Training
  - name: Upload
  - name: User Snapshots
  - name: Users
  - name: Vertical
  - name: Webchats
  - name: Webhook
paths:
  /api/escalation-dashboard/availability-events:
    get:
      tags:
        - Escalation Dashboard
      summary: List raw availability events (paginated)
      description: >-
        Returns the raw AgentAvailabilityEvent stream (connection / availability
        / capacity transitions) within a time window, optionally filtered by
        user, category, value, and source. Used to back the audit / drill-down
        view on the escalation dashboard.
      operationId: get_availability_events
      parameters:
        - in: query
          name: departmentId
          required: false
          schema:
            type: string
          description: >-
            Optional department filter. ADMIN/SUPERADMIN may pass any
            departmentId; DEPARTMENT_HEAD is implicitly scoped to their own
            department and any other value is ignored.
        - in: query
          name: userId
          required: false
          schema:
            type: string
        - in: query
          name: start
          required: false
          schema:
            type: string
            format: date-time
          description: ISO-8601 start of the window. Defaults to end - 24h.
        - in: query
          name: end
          required: false
          schema:
            type: string
            format: date-time
          description: ISO-8601 end of the window. Defaults to now.
        - in: query
          name: page
          required: false
          schema:
            type: integer
            minimum: 1
            default: 1
            description: 1-based page number.
        - in: query
          name: limit
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 200
            default: 50
            description: Page size. Clamped to [1, 200].
        - in: query
          name: category
          required: false
          schema:
            type: string
            enum:
              - connection
              - availability
              - capacity
        - in: query
          name: value
          required: false
          schema:
            type: string
            enum:
              - online
              - offline
              - available
              - unavailable
              - at_capacity
              - has_capacity
        - in: query
          name: source
          required: false
          schema:
            type: string
            enum:
              - socket
              - toggle
              - auto_away
              - assignment
              - resolution
              - system
      responses:
        '200':
          description: Availability events returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AvailabilityEventsResponse'
        '400':
          description: Invalid start or end date
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EscalationDashboardError'
        '403':
          description: Access denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EscalationDashboardError'
        '500':
          description: Error fetching availability events
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EscalationDashboardError'
      security:
        - bearerAuth: []
components:
  schemas:
    AvailabilityEventsResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        data:
          type: object
          properties:
            events:
              type: array
              items:
                $ref: '#/components/schemas/AvailabilityEvent'
            pagination:
              $ref: '#/components/schemas/EscalationPagination'
          required:
            - events
            - pagination
          additionalProperties: false
      required:
        - success
        - data
      additionalProperties: false
      example:
        success: true
        data:
          events:
            - _id: 7b2c4e0d9f1a3b4e5c6d7e8f9012
              userId: 5f7b1c2e8a1d4e0012c3b4a5
              userName: Sam Patel
              category: availability
              value: available
              source: toggle
              occurredAt: '2026-05-18T14:31:02.000Z'
          pagination:
            page: 1
            limit: 50
            total: 143
            totalPages: 3
    EscalationDashboardError:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
        message:
          type: string
        error:
          type: string
      required:
        - success
        - message
      additionalProperties: true
      example:
        success: false
        message: Access denied
    AvailabilityEvent:
      type: object
      properties:
        _id:
          type: string
        userId:
          type: string
        userName:
          type: string
        userEmail:
          type: string
          nullable: true
        category:
          type: string
          enum:
            - connection
            - availability
            - capacity
        value:
          type: string
          enum:
            - online
            - offline
            - available
            - unavailable
            - at_capacity
            - has_capacity
        source:
          type: string
          nullable: true
          enum:
            - socket
            - toggle
            - auto_away
            - assignment
            - resolution
            - system
            - null
        occurredAt:
          type: string
          format: date-time
      required:
        - _id
        - userId
        - userName
        - category
        - value
        - occurredAt
      additionalProperties: false
      example:
        _id: 7b2c4e0d9f1a3b4e5c6d7e8f9012
        userId: 5f7b1c2e8a1d4e0012c3b4a5
        userName: Sam Patel
        userEmail: sam.patel@acme.example
        category: availability
        value: available
        source: toggle
        occurredAt: '2026-05-18T14:31:02.000Z'
    EscalationPagination:
      type: object
      properties:
        page:
          type: integer
        limit:
          type: integer
        total:
          type: integer
        totalPages:
          type: integer
      required:
        - page
        - limit
        - total
        - totalPages
      additionalProperties: false
      example:
        page: 1
        limit: 20
        total: 143
        totalPages: 8
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````