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

# Sessions Health Check

> Check the health status of the sessions service and get active session statistics

<Note>
  This endpoint provides real-time health metrics for the Sessions API service, including active session counts and service uptime.
</Note>

## Response

<ResponseField name="status" type="string">
  Service health status: "healthy", "degraded", or "unhealthy"
</ResponseField>

<ResponseField name="activeSessions" type="number">
  Number of currently active (non-expired) sessions
</ResponseField>

<ResponseField name="timestamp" type="string">
  ISO timestamp of the health check
</ResponseField>

<ResponseField name="expiringSoon" type="number">
  Number of sessions that are within their warning threshold
</ResponseField>

<ResponseField name="invalidSessions" type="number">
  Number of corrupted or invalid sessions detected (only shown if > 0)
</ResponseField>

<ResponseField name="uptime" type="number">
  Service uptime in seconds
</ResponseField>

## Example Response

```json theme={null}
{
  "status": "healthy",
  "activeSessions": 42,
  "timestamp": "2024-01-15T10:30:45.123Z",
  "expiringSoon": 3,
  "uptime": 3600.5
}
```

## Health Status Meanings

* **healthy**: Service is operating normally
* **degraded**: Service is operational but experiencing issues (e.g., invalid sessions detected)
* **unhealthy**: Service is not operational or experiencing critical issues

## Usage

This endpoint is useful for:

* Monitoring service availability
* Tracking session volume
* Detecting memory leaks (via active session count)
* Setting up health check probes in orchestration systems
* Dashboard metrics and alerting


## OpenAPI

````yaml get /api/messaging/sessions/health
openapi: 3.1.0
info:
  title: Eliza OS API
  description: >-
    API documentation for Eliza OS v1.2.0 - A flexible and scalable AI agent
    framework.


    This API is designed to be used with a locally running Eliza instance.
    Endpoints allow for creating,

    managing, and interacting with AI agents through a REST interface.


    The API is organized into the following domains:

    - **System**: System-wide operations and environment management

    - **Agents**: Agent lifecycle and management operations

    - **Memory**: Agent memory and room management

    - **Messaging**: Message handling, channels, and servers

    - **Audio**: Audio processing and speech synthesis

    - **Media**: File upload and media management

    - **TEE**: Trusted Execution Environment operations

    - **WebSocket**: Real-time communication via Socket.IO
  version: 1.2.0
  contact:
    name: Eliza OS Community
    url: https://github.com/elizaos/eliza
servers:
  - url: http://localhost:3000
    description: Local development server
security: []
tags:
  - name: system
    description: System-wide operations and environment management
  - name: agents
    description: Operations for managing AI agents
  - name: memory
    description: Operations for managing agent memories
  - name: rooms
    description: Operations for managing rooms
  - name: messaging
    description: Operations for messages, channels, and servers
  - name: audio
    description: Operations for speech and audio processing
  - name: media
    description: Operations for file uploads and media management
  - name: logs
    description: Operations for accessing system and agent logs
  - name: tee
    description: Trusted Execution Environment operations
  - name: websocket
    description: Real-time WebSocket communication
paths:
  /api/messaging/sessions/health:
    get:
      tags:
        - messaging
      summary: Sessions API health check
      description: >-
        Check the health status of the sessions API and get active session
        statistics
      operationId: getSessionsHealth
      responses:
        '200':
          description: Sessions API is healthy
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - healthy
                      - degraded
                      - unhealthy
                  activeSessions:
                    type: integer
                    description: Number of currently active sessions
                  timestamp:
                    type: string
                    format: date-time
                  expiringSoon:
                    type: integer
                    description: Number of sessions near expiration
                  invalidSessions:
                    type: integer
                    description: Number of invalid sessions detected (only shown if > 0)
                  uptime:
                    type: number
                    description: Service uptime in seconds

````