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

# Get runtime state

> Returns the current non-secret runtime projection used by the swap app and runtime proof surface.



## OpenAPI

````yaml /openapi.yaml get /v1/runtime/state
openapi: 3.1.0
info:
  title: Firmament Backend API
  version: 0.1.3
  summary: Public backend routes for Firmament swaps and runtime proof.
  description: >
    Firmament is a Solana RFQ maker backend for managed liquidity demos.

    This specification documents the public routes used by the swap app and
    runtime view.
servers:
  - url: https://api.firmament.shaikazeem.com
    description: Deployed Firmament API.
  - url: http://127.0.0.1:5050
    description: Local backend started with `cargo run`.
security: []
tags:
  - name: Health
    description: Runtime liveness.
  - name: Assets
    description: Supported Solana assets.
  - name: Pairs
    description: Configured directional pairs and constraints.
  - name: RFQ
    description: Firm quote requests.
  - name: Settlement
    description: Browser-wallet HTLC settlement.
  - name: Trades
    description: Trade status lookup.
  - name: Runtime
    description: Read-only runtime state, events, ledger, and trades.
paths:
  /v1/runtime/state:
    get:
      tags:
        - Runtime
      summary: Get runtime state
      description: >-
        Returns the current non-secret runtime projection used by the swap app
        and runtime proof surface.
      operationId: getRuntimeState
      responses:
        '200':
          description: Runtime state projection.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RuntimeStateResponse'
components:
  schemas:
    RuntimeStateResponse:
      type: object
      required:
        - state
      properties:
        state:
          $ref: '#/components/schemas/RuntimeState'
    RuntimeState:
      type: object
      required:
        - run_id
        - started_at
        - inventory
        - risk
        - pnl
        - rfq
        - rebalance
        - gateway
        - recent_events
      properties:
        run_id:
          type: string
          format: uuid
        started_at:
          type: string
          format: date-time
        inventory:
          $ref: '#/components/schemas/InventoryProjection'
        risk:
          $ref: '#/components/schemas/RiskProjection'
        pnl:
          $ref: '#/components/schemas/PnlProjection'
        rfq:
          $ref: '#/components/schemas/RfqProjection'
        rebalance:
          $ref: '#/components/schemas/RebalanceProjection'
        gateway:
          $ref: '#/components/schemas/GatewayProjection'
        recent_events:
          type: array
          items:
            $ref: '#/components/schemas/RuntimeEvent'
    InventoryProjection:
      type: object
      required:
        - balances
        - quoteable_thresholds
        - max_drift_bps
        - status
      properties:
        balances:
          type: array
          items:
            $ref: '#/components/schemas/TokenAmount'
        quoteable_thresholds:
          type: array
          items:
            $ref: '#/components/schemas/TokenAmount'
        max_drift_bps:
          type: integer
        status:
          type: string
          example: runtime_ready
    RiskProjection:
      type: object
      required:
        - last_decision
        - active_rejections
        - require_taker_allowlist
        - max_price_staleness_seconds
      properties:
        last_decision:
          anyOf:
            - $ref: '#/components/schemas/RiskDecision'
            - type: 'null'
        active_rejections:
          type: array
          items:
            $ref: '#/components/schemas/RejectionReason'
        require_taker_allowlist:
          type: boolean
        max_price_staleness_seconds:
          type: integer
          minimum: 1
    PnlProjection:
      type: object
      required:
        - realized_spread_usdc_estimate
        - fees_usdc_estimate
        - rebalance_cost_usdc_estimate
        - net_usdc_estimate
      properties:
        realized_spread_usdc_estimate:
          $ref: '#/components/schemas/DecimalString'
        fees_usdc_estimate:
          $ref: '#/components/schemas/DecimalString'
        rebalance_cost_usdc_estimate:
          $ref: '#/components/schemas/DecimalString'
        net_usdc_estimate:
          $ref: '#/components/schemas/DecimalString'
    RfqProjection:
      type: object
      required:
        - active_quote_count
        - accepted_quote_count
        - rejected_quote_count
        - active_settlement_count
      properties:
        active_quote_count:
          type: integer
          minimum: 0
        accepted_quote_count:
          type: integer
          minimum: 0
        rejected_quote_count:
          type: integer
          minimum: 0
        active_settlement_count:
          type: integer
          minimum: 0
    RebalanceProjection:
      type: object
      required:
        - pending_swap_count
        - completed_swap_count
      properties:
        pending_swap_count:
          type: integer
          minimum: 0
        completed_swap_count:
          type: integer
          minimum: 0
    GatewayProjection:
      type: object
      required:
        - enabled
        - usdc_refill_threshold_raw
        - usdc_refill_target_raw
        - status
      properties:
        enabled:
          type: boolean
        usdc_refill_threshold_raw:
          $ref: '#/components/schemas/AmountRaw'
        usdc_refill_target_raw:
          $ref: '#/components/schemas/AmountRaw'
        status:
          type: string
          example: not_checked
    RuntimeEvent:
      type: object
      required:
        - category
        - event
      properties:
        category:
          type: string
          enum:
            - quote
            - settlement
            - swap
            - gateway
            - risk
            - inventory
            - reconciliation
            - system
        event:
          type: object
          additionalProperties: true
          description: Event payload. Shape depends on the category and event type.
    TokenAmount:
      type: object
      required:
        - asset
        - amount_raw
      properties:
        asset:
          type: string
          example: USDC
        amount_raw:
          $ref: '#/components/schemas/AmountRaw'
    RiskDecision:
      oneOf:
        - type: object
          required:
            - status
            - checks
          properties:
            status:
              type: string
              const: accepted
            checks:
              type: array
              items:
                type: string
        - type: object
          required:
            - status
            - reason
            - details
          properties:
            status:
              type: string
              const: rejected
            reason:
              $ref: '#/components/schemas/RejectionReason'
            details:
              type: array
              items:
                type: string
      discriminator:
        propertyName: status
    RejectionReason:
      type: string
      enum:
        - unsupported_pair
        - unsupported_asset
        - amount_too_small
        - max_notional_exceeded
        - below_asset_min_notional
        - above_asset_max_notional
        - below_asset_min_amount
        - above_asset_max_amount
        - cumulative_cap_exceeded
        - inventory_below_quoteable_threshold
        - exposure_limit_exceeded
        - stale_price
        - wallet_not_allowed
        - gateway_unavailable
        - external_service_unavailable
        - validation_failed
    DecimalString:
      type: string
      description: Decimal value serialized by the runtime.
      examples:
        - '0'
    AmountRaw:
      type: integer
      minimum: 0
      format: int64
      examples:
        - 1000

````