> ## 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.

# Get Session

> Retrieve session details, status, and remaining time

<Note>
  This endpoint returns comprehensive session information including timeout configuration, renewal count, and real-time expiration status.
</Note>

## Path Parameters

<ParamField path="sessionId" type="string" required>
  The unique identifier of the session
</ParamField>

## Response

<ResponseField name="sessionId" type="string">
  Unique session identifier
</ResponseField>

<ResponseField name="agentId" type="string">
  UUID of the agent
</ResponseField>

<ResponseField name="userId" type="string">
  UUID of the user
</ResponseField>

<ResponseField name="createdAt" type="string">
  ISO timestamp of session creation
</ResponseField>

<ResponseField name="lastActivity" type="string">
  ISO timestamp of last activity in the session
</ResponseField>

<ResponseField name="expiresAt" type="string">
  ISO timestamp when the session will expire
</ResponseField>

<ResponseField name="timeoutConfig" type="object">
  Current timeout configuration for the session

  <Expandable title="Configuration Properties">
    <ResponseField name="timeoutMinutes" type="number">
      Inactivity timeout in minutes
    </ResponseField>

    <ResponseField name="autoRenew" type="boolean">
      Whether auto-renewal is enabled
    </ResponseField>

    <ResponseField name="maxDurationMinutes" type="number">
      Maximum total session duration
    </ResponseField>

    <ResponseField name="warningThresholdMinutes" type="number">
      Minutes before expiration to trigger warning
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="renewalCount" type="number">
  Number of times the session has been renewed
</ResponseField>

<ResponseField name="timeRemaining" type="number">
  Milliseconds until session expiration
</ResponseField>

<ResponseField name="isNearExpiration" type="boolean">
  Whether the session is within the warning threshold
</ResponseField>

<ResponseField name="metadata" type="object">
  Any metadata attached to the session
</ResponseField>

## Error Responses

<ResponseExample>
  ```json theme={null}
  // 404 - Session not found
  {
    "error": "Session not found",
    "code": "SESSION_NOT_FOUND",
    "details": {
      "sessionId": "abc-123"
    }
  }

  // 410 - Session expired
  {
    "error": "Session has expired",
    "code": "SESSION_EXPIRED",
    "details": {
      "sessionId": "abc-123",
      "expiresAt": "2024-01-15T10:30:00Z"
    }
  }
  ```
</ResponseExample>


## OpenAPI

````yaml get /api/messaging/sessions/{sessionId}
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/{sessionId}:
    get:
      tags:
        - messaging
      summary: Get session information
      description: >-
        Retrieve information about a specific session including metadata and
        activity details
      operationId: getSession
      parameters:
        - name: sessionId
          in: path
          required: true
          schema:
            type: string
          description: ID of the session
      responses:
        '200':
          description: Session information retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  sessionId:
                    type: string
                  agentId:
                    type: string
                    format: uuid
                  userId:
                    type: string
                    format: uuid
                  createdAt:
                    type: string
                    format: date-time
                  lastActivity:
                    type: string
                    format: date-time
                  metadata:
                    type: object
                  expiresAt:
                    type: string
                    format: date-time
                    description: When the session will expire
                  timeoutConfig:
                    type: object
                    description: Current timeout configuration
                    properties:
                      timeoutMinutes:
                        type: integer
                      autoRenew:
                        type: boolean
                      maxDurationMinutes:
                        type: integer
                      warningThresholdMinutes:
                        type: integer
                  renewalCount:
                    type: integer
                    description: Number of times the session has been renewed
                  timeRemaining:
                    type: integer
                    description: Milliseconds until session expiration
                  isNearExpiration:
                    type: boolean
                    description: Whether the session is within the warning threshold
        '404':
          description: Session not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '410':
          description: Session has expired
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          properties:
            code:
              type: string
              description: Error code
            message:
              type: string
              description: Error message
            details:
              type: string
              description: Detailed error information

````