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

# Get a session with its messages

> Returns the session's metadata and a page of its messages ordered by cursor ascending. Use `after` and `limit` to page through messages.




## OpenAPI

````yaml /openapi/openapi.yaml get /sessions/{id}
openapi: 3.0.3
info:
  title: Albus API
  description: Albus service REST API
  version: 1.0.0
servers:
  - url: https://albus.sh/api
    description: Production server
  - url: http://localhost:8080
    description: Local development server
security:
  - bearerAuth: []
  - apiKeyAuth: []
tags:
  - name: Auth
    description: Identify the authenticated user.
  - name: Health
    description: Check service availability.
  - name: Secrets
    description: Manage secrets available to agent sessions.
  - name: Sessions
    description: Run and inspect agent sessions.
  - name: Tokens
    description: Manage organization API keys.
paths:
  /sessions/{id}:
    parameters:
      - $ref: '#/components/parameters/SessionID'
    get:
      tags:
        - Sessions
      summary: Get a session with its messages
      description: >
        Returns the session's metadata and a page of its messages ordered by
        cursor ascending. Use `after` and `limit` to page through messages.
      operationId: getSession
      parameters:
        - $ref: '#/components/parameters/AfterCursor'
        - $ref: '#/components/parameters/Limit'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionResponse'
        '400':
          description: Invalid cursor
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrBadRequest'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrUnauthorized'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrNotFound'
      security:
        - bearerAuth: []
        - apiKeyAuth: []
components:
  parameters:
    SessionID:
      name: id
      in: path
      required: true
      description: >-
        Client-provided session identifier. Use the same value across requests
        to continue the same agent session.
      schema:
        type: string
        minLength: 2
        maxLength: 100
        pattern: ^[0-9a-zA-Z._:-]+$
    AfterCursor:
      name: after
      in: query
      required: false
      description: >
        Opaque pagination cursor. Return only items positioned after it; pass a
        value obtained from a previous page to fetch the next one.
      schema:
        type: string
    Limit:
      name: limit
      in: query
      required: false
      description: Maximum number of items to return.
      schema:
        type: integer
        minimum: 1
        maximum: 1000
        default: 100
  schemas:
    SessionResponse:
      type: object
      required:
        - session
        - messages
      properties:
        session:
          $ref: '#/components/schemas/Session'
        messages:
          type: array
          items:
            $ref: '#/components/schemas/SessionMessage'
    ErrBadRequest:
      type: object
      required:
        - message
      properties:
        message:
          type: string
          description: Human-readable error message
          example: Invalid request parameters
    ErrUnauthorized:
      type: object
      required:
        - message
      properties:
        message:
          type: string
          description: Human-readable error message
          example: Invalid or expired token
    ErrNotFound:
      type: object
      required:
        - message
      properties:
        message:
          type: string
          description: Human-readable error message
          example: Resource not found
    Session:
      type: object
      required:
        - id
        - state
        - invocation_count
        - created_at
        - updated_at
      properties:
        id:
          type: string
          minLength: 2
          maxLength: 100
          pattern: ^[0-9a-zA-Z._:-]+$
          description: Client-provided session identifier.
        state:
          type: string
          enum:
            - RUNNING
            - DONE
            - FAILED
            - CANCELED
          description: Lifecycle state of the session.
        current_invocation_id:
          type: string
          description: >
            The invocation currently running, if any. Omitted when the session
            is idle.
        invocation_count:
          type: integer
          format: int64
          description: Number of times this session has been run.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    SessionMessage:
      type: object
      required:
        - cursor
        - invocation_id
        - role
        - content
        - created_at
      properties:
        cursor:
          type: integer
          format: int64
          description: Monotonic per-session position of this message.
        invocation_id:
          type: string
          description: The invocation that produced this message.
        role:
          type: string
          enum:
            - user
            - assistant
        content:
          type: string
        created_at:
          type: string
          format: date-time
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    apiKeyAuth:
      type: http
      scheme: bearer
      description: Org-scoped API key issued via POST /tokens

````