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

# Get session detail

> Fetch one session plus a backward-paged window of its most recent events.

## Restrictions

| Aspect      | Value                                                         |
| ----------- | ------------------------------------------------------------- |
| Rate limits | **1,000 requests/minute**; **50 requests/second** per account |
| Permissions | None — any valid `app_key` can call this operation            |

## Usage

* Page older history with `search_after_ctx` from the previous response.
* `limit` (or legacy `num_recent_events`) caps the event page; default 100, max 1000.


## OpenAPI

````yaml /api-reference/safari.openapi.en.json post /safari/session/get
openapi: 3.1.0
info:
  title: Flashduty Open API
  description: >-
    Public HTTP API for the Flashduty AI SRE platform — skills, MCP servers
    (connectors), A2A agents, and sessions. Every operation is authenticated
    with an `app_key` query parameter issued from the Flashduty console.
  version: 1.0.0
servers:
  - url: https://api.flashcat.cloud
    description: Flashduty Open API
security:
  - AppKeyAuth: []
tags:
  - name: AI SRE/Skills
  - name: AI SRE/MCP servers
  - name: AI SRE/A2A agents
  - name: AI SRE/Sessions
  - name: AI SRE/Automations
paths:
  /safari/session/get:
    post:
      tags:
        - AI SRE/Sessions
      summary: Get session detail
      description: >-
        Fetch one session plus a backward-paged window of its most recent
        events.
      operationId: session-read-info
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SessionGetRequest'
            example:
              session_id: sess_f8oDvqiG64uur6sBNsTc4u
              num_recent_events: 50
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ResponseEnvelope'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/SessionGetResponse'
              example:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                data:
                  session:
                    session_id: sess_f8oDvqiG64uur6sBNsTc4u
                    session_name: Investigate cloud-assistant first heartbeat
                    app_name: ai-sre
                    entry_kind: web
                    person_id: '3790925372131'
                    team_id: 0
                    is_mine: false
                    can_manage: true
                    status: enabled
                    incognito: false
                    created_at: 1780367971228
                    updated_at: 1780367993457
                    token_usage:
                      input_tokens: 14948
                      cached_tokens: 11520
                      output_tokens: 888
                      reasoning_tokens: 351
                    current_context_tokens: 14948
                    context_window: 0
                    archived_at: 0
                    pinned_at: 0
                    last_event_at: 1780367992649
                    is_running: false
                    has_unread: true
                  events:
                    - event_id: evt_3aZQ9p
                      session_id: sess_f8oDvqiG64uur6sBNsTc4u
                      author: user
                      partial: false
                      turn_complete: false
                      status: normal
                      created_at: 1780367971241
                    - event_id: evt_7bWk2r
                      session_id: sess_f8oDvqiG64uur6sBNsTc4u
                      author: ai-sre
                      content:
                        role: model
                        parts:
                          - text: ...
                      partial: false
                      turn_complete: true
                      status: normal
                      created_at: 1780367992649
                  has_more_older: false
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/ServerError'
      security:
        - AppKeyAuth: []
components:
  schemas:
    SessionGetRequest:
      type: object
      description: >-
        Fetch one session plus a backward-paged window of its most recent
        events.
      properties:
        session_id:
          type: string
          description: Target session ID.
          minLength: 1
        num_recent_events:
          type: integer
          description: >-
            Legacy page size: number of most-recent events to return. Superseded
            by `limit` when both are set; 0 uses the server default (100).
          minimum: 0
          maximum: 1000
        limit:
          type: integer
          description: >-
            Page size for events; takes precedence over `num_recent_events`. 0
            uses the server default (100).
          minimum: 0
          maximum: 1000
        search_after_ctx:
          type: string
          description: >-
            Opaque keyset cursor from a previous response; pass it back to fetch
            the next older page.
          maxLength: 4096
      required:
        - session_id
    ResponseEnvelope:
      type: object
      description: >-
        Standard response envelope used by every Flashduty public API. On
        success `data` contains the endpoint-specific payload and `error` is
        absent. On failure `error` is present and `data` is absent. `request_id`
        is always present and is also mirrored in the `Flashcat-Request-Id`
        response header.
      properties:
        request_id:
          type: string
          description: >-
            Unique ID for this request. Mirrored in the Flashcat-Request-Id
            header. Include it when reporting issues.
          example: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
        error:
          $ref: '#/components/schemas/DutyError'
        data:
          description: Endpoint-specific payload. See each operation's 200 response schema.
      required:
        - request_id
    SessionGetResponse:
      type: object
      description: A session plus a backward-paged window of its events.
      properties:
        session:
          $ref: '#/components/schemas/SessionItem'
        events:
          type: array
          items:
            $ref: '#/components/schemas/EventItem'
          description: Recent events, ascending by (created_at, event_id).
        has_more_older:
          type: boolean
          description: True when older events remain beyond this page.
        search_after_ctx:
          type: string
          description: >-
            Opaque keyset cursor; pass back as search_after_ctx to fetch the
            next older page. Omitted when has_more_older is false.
    DutyError:
      type: object
      description: >-
        Error payload inside the response envelope. Present only on non-2xx
        responses.
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
          description: >-
            Human-readable error message, localized by the caller's
            Accept-Language. May contain field names, IDs, or other context from
            the failing request.
      required:
        - code
        - message
    SessionItem:
      type: object
      description: One agent session row.
      properties:
        session_id:
          type: string
          description: Session identifier.
        parent_session_id:
          type: string
          description: Parent session id for subagent (child) sessions; empty otherwise.
        session_name:
          type: string
          description: Session title; may be empty for untitled sessions.
        app_name:
          type: string
          description: Agent app that owns the session.
        entry_kind:
          type: string
          description: Surface that created the session.
          enum:
            - web
            - im
            - api
            - scheduled
            - subagent
        person_id:
          type: string
          description: Creator person id.
        team_id:
          type: integer
          format: int64
          description: Owning team id; 0 means no team is bound. Immutable after create.
        team_name:
          type: string
          description: Resolved team name; empty for unbound rows or deleted teams.
        is_mine:
          type: boolean
          description: True when the caller created this session.
        can_manage:
          type: boolean
          description: True when the caller may rename/archive/delete the session.
        status:
          type: string
          description: Lifecycle status.
          enum:
            - enabled
            - deleted
        incognito:
          type: boolean
          description: True for incognito (non-persisted-memory) sessions.
        created_at:
          type: integer
          format: int64
          description: Unix timestamp in milliseconds when the session was created.
        updated_at:
          type: integer
          format: int64
          description: Unix timestamp in milliseconds of the last session update.
        template_staging_round_id:
          type: string
          description: >-
            Current save→validate round id (template-assistant only); empty
            otherwise.
        state:
          type: object
          additionalProperties: true
          description: Raw session-state bag (session-scoped keys). Omitted when empty.
        bound_environment:
          $ref: '#/components/schemas/EnvironmentBinding'
        context_resolved:
          $ref: '#/components/schemas/ContextResolvedItem'
        token_usage:
          $ref: '#/components/schemas/SessionTokenUsage'
        current_context_tokens:
          type: integer
          format: int64
          description: >-
            Size in tokens of the LLM context window as of the most recent turn.
            0 means no turn has completed.
        context_window:
          type: integer
          format: int64
          description: The bound model's max context size in tokens. 0 means unknown.
        archived_at:
          type: integer
          format: int64
          description: Unix timestamp in milliseconds when archived; 0 means not archived.
        pinned_at:
          type: integer
          format: int64
          description: Caller's per-user pin timestamp in milliseconds; 0 means not pinned.
        last_event_at:
          type: integer
          format: int64
          description: >-
            Unix timestamp in milliseconds of the most recent assistant-side
            event.
        is_running:
          type: boolean
          description: True when an agent turn is currently in flight for this session.
        has_unread:
          type: boolean
          description: True when there is assistant output the caller has not yet viewed.
    EventItem:
      type: object
      description: >-
        One persisted session event. content/actions/usage_metadata carry the
        raw ADK envelope; treat them as opaque structured payloads.
      properties:
        event_id:
          type: string
          description: Event identifier.
        session_id:
          type: string
          description: Owning session id.
        invocation_id:
          type: string
          description: ADK invocation id grouping a turn.
        author:
          type: string
          description: Event author (e.g. user, the agent name).
        branch:
          type: string
          description: ADK branch path for nested agents.
        content:
          type: object
          additionalProperties: true
          description: ADK content envelope {role, parts:[...]}.
        actions:
          type: object
          additionalProperties: true
          description: ADK actions envelope (state deltas, transfers, escalation).
        usage_metadata:
          type: object
          additionalProperties: true
          description: Per-turn token usage metadata.
        partial:
          type: boolean
          description: True for a streaming partial chunk.
        turn_complete:
          type: boolean
          description: True on the terminal event of a turn.
        error_code:
          type: string
          description: Error code when the event represents a failure.
        error_message:
          type: string
          description: Human-readable error message, when present.
        status:
          type: string
          description: Event status.
          enum:
            - normal
            - compressed
        created_at:
          type: integer
          format: int64
          description: Unix timestamp in milliseconds when the event was written.
    ErrorResponse:
      type: object
      description: Response envelope for errors. `error` is required; `data` is absent.
      properties:
        request_id:
          type: string
          example: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
        error:
          $ref: '#/components/schemas/DutyError'
      required:
        - request_id
        - error
    ErrorCode:
      type: string
      description: >-
        Flashduty error code enum. Every failed API response sets `error.code`
        to one of these values. The value is a stable wire string — not a
        localized message and not a numeric status. HTTP status is
        informational.
      enum:
        - OK
        - InvalidParameter
        - BadRequest
        - InvalidContentType
        - ResourceNotFound
        - NoLicense
        - ReferenceExist
        - Unauthorized
        - BalanceNotEnough
        - AccessDenied
        - RouteNotFound
        - MethodNotAllowed
        - UndonedOrderExist
        - RequestLocked
        - EntityTooLarge
        - RequestTooFrequently
        - RequestVerifyRequired
        - DangerousOperation
        - InternalError
        - ServiceUnavailable
    EnvironmentBinding:
      type: object
      description: >-
        The runner or cloud sandbox the session is bound to. Null until the
        first message.
      properties:
        kind:
          type: string
          description: Environment kind (e.g. runner, sandbox).
        id:
          type: string
          description: Environment identifier.
        name:
          type: string
          description: Human-readable environment name.
        status:
          type: string
          description: Binding status.
    ContextResolvedItem:
      type: object
      description: Snapshot of the three-tier knowledge-pack resolution for this session.
      properties:
        account_pack_id:
          type: string
          description: Resolved account-scoped pack id.
        team_pack_id:
          type: string
          description: Resolved team-scoped pack id.
        incident_id:
          type: string
          description: Bound incident id, when war-room originated.
        resolved_at_ms:
          type: integer
          format: int64
          description: Unix timestamp in milliseconds when the packs were resolved.
        versions:
          type: object
          additionalProperties:
            type: integer
          description: Per-pack resolved version map.
    SessionTokenUsage:
      type: object
      description: >-
        Cumulative session-level token rollup across all turns. The
        account-billing source of truth.
      properties:
        input_tokens:
          type: integer
          format: int64
          description: Total prompt (input) tokens, including the cached portion.
        cached_tokens:
          type: integer
          format: int64
          description: Portion of input_tokens served from the prompt cache.
        output_tokens:
          type: integer
          format: int64
          description: Total generated (output) tokens.
        reasoning_tokens:
          type: integer
          format: int64
          description: Total reasoning/thinking tokens.
  responses:
    BadRequest:
      description: Invalid request — usually a missing or malformed parameter.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missingParameter:
              summary: Missing required parameter
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: InvalidParameter
                  message: The specified parameter skill_id is not valid.
    Unauthorized:
      description: Missing or invalid app_key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missingAppKey:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: Unauthorized
                  message: You are unauthorized.
    TooManyRequests:
      description: Rate limit hit. Either the global API limit or a per-account limit.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            rateLimited:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: RequestTooFrequently
                  message: Request too frequently.
    ServerError:
      description: Unexpected server-side error. Include the request_id when reporting.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            internal:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: InternalError
                  message: >-
                    We encountered an internal error, and it has been reported.
                    Please try again later.
  securitySchemes:
    AppKeyAuth:
      type: apiKey
      in: query
      name: app_key
      description: >-
        App key issued from the Flashduty console. Required on every public API
        call. Keep it secret — it grants the same access as the owning account.

````