{
  "components": {
    "schemas": {
      "AccountBrandingPolicy": {
        "enum": [
          "noctant",
          "co_brand",
          "partner_managed",
          "white_label"
        ],
        "type": "string"
      },
      "AccountCommandAcceptedResponse": {
        "properties": {
          "command_id": {
            "type": "string"
          }
        },
        "required": [
          "command_id"
        ],
        "type": "object"
      },
      "AccountCommandStatus": {
        "enum": [
          "unknown",
          "outbox_pending",
          "nats_published",
          "engine_wal_confirmed",
          "dead_lettered"
        ],
        "type": "string"
      },
      "AccountCommandStatusResponse": {
        "properties": {
          "command": {
            "$ref": "#/components/schemas/AccountCommandStatusView"
          }
        },
        "required": [
          "command"
        ],
        "type": "object"
      },
      "AccountCommandStatusView": {
        "properties": {
          "accepted_at": {
            "description": "Time the command outbox row was durably accepted, when this command\nentered through an outbox-backed operator control route.",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "account_id": {
            "description": "Current execution account metadata for the stable account.",
            "format": "uuid",
            "type": "string"
          },
          "command_id": {
            "type": "string"
          },
          "command_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "dead_letter_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "dead_lettered_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "engine_command_outcome": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AccountEngineCommandOutcome"
              },
              {
                "type": "null"
              }
            ],
            "description": "Matching-engine command decision. `accepted` means the command produced\nat least one WAL-backed domain event; it does not imply fill,\nexecution, payout, or other business completion."
          },
          "engine_command_outcome_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "engine_command_outcome_event_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "engine_command_outcome_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "engine_command_outcome_reason_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "engine_wal_confirmed_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "engine_wal_event_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "engine_wal_event_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "engine_wal_last_republished_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "engine_wal_republish_count": {
            "description": "Number of retry publishes after the first command-stream `PubAck` while\nwaiting for engine WAL confirmation.",
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "external_account_id": {
            "description": "Operator-owned stable account reference used to scope this lookup.",
            "type": "string"
          },
          "nats_published_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "$ref": "#/components/schemas/AccountCommandStatus"
          }
        },
        "required": [
          "external_account_id",
          "account_id",
          "command_id",
          "status"
        ],
        "type": "object"
      },
      "AccountCorrectionListCursor": {
        "properties": {
          "before_correction_id": {
            "format": "uuid",
            "type": "string"
          },
          "before_requested_at": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "before_requested_at",
          "before_correction_id"
        ],
        "type": "object"
      },
      "AccountCorrectionResponse": {
        "properties": {
          "correction": {
            "$ref": "#/components/schemas/AccountCorrectionView"
          }
        },
        "required": [
          "correction"
        ],
        "type": "object"
      },
      "AccountCorrectionStatus": {
        "enum": [
          "publishing",
          "published",
          "executed",
          "publish_failed",
          "execution_failed",
          "invalid_execution"
        ],
        "type": "string"
      },
      "AccountCorrectionType": {
        "enum": [
          "balance_adjustment"
        ],
        "type": "string"
      },
      "AccountCorrectionView": {
        "properties": {
          "account_id": {
            "format": "uuid",
            "type": "string"
          },
          "amount": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "causation_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "command_id": {
            "type": "string"
          },
          "correction_id": {
            "format": "uuid",
            "type": "string"
          },
          "correction_type": {
            "$ref": "#/components/schemas/AccountCorrectionType"
          },
          "correlation_id": {
            "type": "string"
          },
          "executed_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "execution_event_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "execution_failed_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "execution_failure_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "execution_failure_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "idempotency_key": {
            "type": "string"
          },
          "operator_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "publish_failed_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "published_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "reason": {
            "type": "string"
          },
          "requested_at": {
            "format": "date-time",
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/AccountCorrectionStatus"
          },
          "trace_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "user_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "correction_id",
          "user_id",
          "account_id",
          "correction_type",
          "status",
          "amount",
          "reason",
          "idempotency_key",
          "command_id",
          "correlation_id",
          "requested_at"
        ],
        "type": "object"
      },
      "AccountCorrectionsListResponse": {
        "properties": {
          "corrections": {
            "items": {
              "$ref": "#/components/schemas/AccountCorrectionView"
            },
            "type": "array"
          },
          "count": {
            "description": "Number of corrections in this response page.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "next_cursor": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AccountCorrectionListCursor"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "corrections",
          "count"
        ],
        "type": "object"
      },
      "AccountEngineCommandOutcome": {
        "enum": [
          "accepted",
          "rejected",
          "ignored"
        ],
        "type": "string"
      },
      "AccountExecutionMode": {
        "enum": [
          "simulated",
          "broker"
        ],
        "type": "string"
      },
      "AccountExecutionScope": {
        "enum": [
          "current",
          "attempt",
          "all_attempts"
        ],
        "type": "string"
      },
      "AccountFeedSource": {
        "enum": [
          "noctant",
          "partner"
        ],
        "type": "string"
      },
      "AccountListCursor": {
        "properties": {
          "before_created_at": {
            "format": "date-time",
            "type": "string"
          },
          "before_program_account_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "before_created_at",
          "before_program_account_id"
        ],
        "type": "object"
      },
      "AccountListResponse": {
        "properties": {
          "accounts": {
            "items": {
              "$ref": "#/components/schemas/OperatorAccountView"
            },
            "type": "array"
          },
          "count": {
            "description": "Number of accounts in this response page.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "next_cursor": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AccountListCursor"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "accounts",
          "count"
        ],
        "type": "object"
      },
      "AccountMarketMode": {
        "enum": [
          "live_market",
          "replay_backtest"
        ],
        "type": "string"
      },
      "AccountOrderListCursor": {
        "properties": {
          "before_created_at": {
            "format": "date-time",
            "type": "string"
          },
          "before_order_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "before_created_at",
          "before_order_id"
        ],
        "type": "object"
      },
      "AccountOrderView": {
        "properties": {
          "account_id": {
            "format": "uuid",
            "type": "string"
          },
          "average_fill_price": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "filled_quantity": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "limit_price": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "order_id": {
            "format": "uuid",
            "type": "string"
          },
          "order_type": {
            "type": "string"
          },
          "org_id": {
            "format": "uuid",
            "type": "string"
          },
          "program_account_attempt_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "quantity": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "remaining_quantity": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "side": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "stop_loss": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "stop_price": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "symbol": {
            "type": "string"
          },
          "take_profit": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "time_in_force": {
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "order_id",
          "account_id",
          "org_id",
          "symbol",
          "side",
          "order_type",
          "quantity",
          "time_in_force",
          "source",
          "status",
          "filled_quantity",
          "remaining_quantity",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "AccountOrdersResponse": {
        "properties": {
          "count": {
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "next_cursor": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AccountOrderListCursor"
              },
              {
                "type": "null"
              }
            ]
          },
          "orders": {
            "items": {
              "$ref": "#/components/schemas/AccountOrderView"
            },
            "type": "array"
          }
        },
        "required": [
          "orders",
          "count"
        ],
        "type": "object"
      },
      "AccountPositionView": {
        "properties": {
          "account_id": {
            "format": "uuid",
            "type": "string"
          },
          "avg_entry_price": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "opened_at": {
            "format": "date-time",
            "type": "string"
          },
          "org_id": {
            "format": "uuid",
            "type": "string"
          },
          "position_id": {
            "format": "uuid",
            "type": "string"
          },
          "quantity": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "side": {
            "type": "string"
          },
          "stop_loss": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "symbol": {
            "type": "string"
          },
          "take_profit": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "unrealized_pnl": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "updated_at": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "account_id",
          "org_id",
          "symbol",
          "position_id",
          "side",
          "quantity",
          "avg_entry_price",
          "opened_at",
          "updated_at"
        ],
        "type": "object"
      },
      "AccountPositionsResponse": {
        "properties": {
          "count": {
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "positions": {
            "items": {
              "$ref": "#/components/schemas/AccountPositionView"
            },
            "type": "array"
          }
        },
        "required": [
          "positions",
          "count"
        ],
        "type": "object"
      },
      "AccountProgramOrigin": {
        "enum": [
          "practice",
          "preset",
          "firm"
        ],
        "type": "string"
      },
      "AccountProgramType": {
        "enum": [
          "standard",
          "challenge",
          "funded"
        ],
        "type": "string"
      },
      "AccountProviderType": {
        "enum": [
          "prop_firm",
          "journal",
          "prop_simulator",
          "education_partner",
          "broker_partner"
        ],
        "type": "string"
      },
      "AccountProvisioningSource": {
        "enum": [
          "user_request",
          "operator_api",
          "challenge_start",
          "challenge_advance",
          "challenge_pass",
          "admin_action",
          "seed"
        ],
        "type": "string"
      },
      "AccountResponse": {
        "properties": {
          "account": {
            "$ref": "#/components/schemas/OperatorAccountView",
            "description": "Account view returned by `GET /v1/accounts/by-external-id?external_account_id=...`."
          }
        },
        "required": [
          "account"
        ],
        "type": "object"
      },
      "AccountRulesOwner": {
        "enum": [
          "noctant",
          "partner",
          "none"
        ],
        "type": "string"
      },
      "AccountStatusUpdateResponse": {
        "properties": {
          "account": {
            "$ref": "#/components/schemas/OperatorAccountView"
          },
          "changed": {
            "description": "`false` when the sponsored account was already in the requested state.",
            "type": "boolean"
          },
          "command_id": {
            "description": "Matching-engine command id when this request enqueued one.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "account",
          "changed"
        ],
        "type": "object"
      },
      "AccountSummaryResponse": {
        "properties": {
          "summary": {
            "$ref": "#/components/schemas/AccountSummaryView"
          }
        },
        "required": [
          "summary"
        ],
        "type": "object"
      },
      "AccountSummaryView": {
        "properties": {
          "account_id": {
            "format": "uuid",
            "type": "string"
          },
          "balance": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "currency": {
            "type": "string"
          },
          "equity": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "external_account_id": {
            "type": "string"
          },
          "free_margin": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "global_user_id": {
            "format": "uuid",
            "type": "string"
          },
          "margin_level": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "margin_used": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "org_id": {
            "format": "uuid",
            "type": "string"
          },
          "trading_status": {
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "type": "string"
          },
          "version": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "account_id",
          "org_id",
          "global_user_id",
          "external_account_id",
          "currency",
          "balance",
          "equity",
          "margin_used",
          "free_margin",
          "trading_status",
          "updated_at",
          "version"
        ],
        "type": "object"
      },
      "AccountTradeListCursor": {
        "properties": {
          "before_closed_at": {
            "format": "date-time",
            "type": "string"
          },
          "before_trade_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "before_closed_at",
          "before_trade_id"
        ],
        "type": "object"
      },
      "AccountTradeView": {
        "properties": {
          "account_id": {
            "format": "uuid",
            "type": "string"
          },
          "close_reason": {
            "type": "string"
          },
          "closed_at": {
            "format": "date-time",
            "type": "string"
          },
          "commission": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "correlation_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "duration_seconds": {
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "entry_fill_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "entry_order_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "entry_price": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "entry_time": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "exit_fill_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "exit_order_id": {
            "format": "uuid",
            "type": "string"
          },
          "exit_price": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "gross_pnl": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "is_profitable": {
            "type": "boolean"
          },
          "net_pnl": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "org_id": {
            "format": "uuid",
            "type": "string"
          },
          "pnl_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "position_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "program_account_attempt_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "quantity": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "side": {
            "type": "string"
          },
          "swap": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "symbol": {
            "type": "string"
          },
          "trade_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "trade_id",
          "exit_order_id",
          "account_id",
          "org_id",
          "symbol",
          "side",
          "quantity",
          "entry_price",
          "exit_price",
          "gross_pnl",
          "commission",
          "swap",
          "net_pnl",
          "is_profitable",
          "close_reason",
          "closed_at"
        ],
        "type": "object"
      },
      "AccountTradesResponse": {
        "properties": {
          "count": {
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "next_cursor": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AccountTradeListCursor"
              },
              {
                "type": "null"
              }
            ]
          },
          "trades": {
            "items": {
              "$ref": "#/components/schemas/AccountTradeView"
            },
            "type": "array"
          }
        },
        "required": [
          "trades",
          "count"
        ],
        "type": "object"
      },
      "AccountVisibilityPolicy": {
        "enum": [
          "all_connected",
          "same_sponsor_only",
          "same_sponsor_plus_noctant"
        ],
        "type": "string"
      },
      "ApprovePayoutRequestRequest": {
        "description": "Request body for operator payout approval routes.\n\n`/approve` records the workflow decision only. `/approve-and-execute`\nrecords the workflow decision and publishes the reserved platform\naccount-effect command. Neither route asserts that an external bank/\ncrypto payment has happened.",
        "properties": {
          "note": {
            "description": "Optional human note for the audit log.",
            "maxLength": 500,
            "type": [
              "string",
              "null"
            ]
          },
          "operator_reference": {
            "description": "Operator-side case/ticket/reference. Opaque to Noctant.",
            "maxLength": 255,
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "ChallengeView": {
        "description": "`POST /v1/challenges` / `GET /v1/challenges/{id}`\n\nFull view of a challenge instance. Mirrors the platform-internal\n`ChallengeInstanceView` exactly; we re-declare it here so operator-\nfacing changes can evolve independently from the internal type if\never needed, and so the operator-api contract crate stays the single\nplace any external consumer looks for response shapes.",
        "properties": {
          "account_id": {
            "format": "uuid",
            "type": "string"
          },
          "account_number": {
            "description": "Human-readable account number (assigned by the platform at\naccount creation).",
            "type": "string"
          },
          "account_run_label": {
            "description": "Combined label: \"ACC-NUMBER / Rn\".",
            "type": "string"
          },
          "activated_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "activation_price_snapshot": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "activation_required_snapshot": {
            "type": "boolean"
          },
          "activation_status": {
            "type": "string"
          },
          "chain_id": {
            "format": "uuid",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "current_drawdown": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "daily_loss_period_start_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "daily_loss_start_equity": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "daily_loss_start_recorded_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "daily_pnl": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "ended_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "execution_snapshot": true,
          "initial_balance": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "instance_id": {
            "format": "uuid",
            "type": "string"
          },
          "org_id": {
            "description": "Org that owns the tenant context. Operators can assume this\nequals their own `org_id`.",
            "format": "uuid",
            "type": "string"
          },
          "parent_instance_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "peak_balance": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "peak_balance_eod": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "peak_equity": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "peak_equity_eod": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "profitable_days": {
            "format": "int32",
            "type": "integer"
          },
          "purchase_price_snapshot": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "reset_number": {
            "format": "int32",
            "type": "integer"
          },
          "rules_snapshot": true,
          "run_label": {
            "description": "Short run label, e.g. \"R0\" for the initial run, \"R1\" for first\nreset, etc.",
            "type": "string"
          },
          "started_at": {
            "format": "date-time",
            "type": "string"
          },
          "status": {
            "description": "Lifecycle state. Values mirror `challenge_instances.status`:\n`active`, `activation_pending`, `reset_pending`, `pending_review`,\n`passed`, `failed`, `expired`, `reset`, `suspended`, `completed`.",
            "type": "string"
          },
          "step_sequence": {
            "format": "int32",
            "type": "integer"
          },
          "template_id": {
            "format": "uuid",
            "type": "string"
          },
          "template_version": {
            "format": "int32",
            "type": "integer"
          },
          "total_pnl": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "trading_days": {
            "format": "int32",
            "type": "integer"
          },
          "user_id": {
            "description": "The user's `global_user_id`.",
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "instance_id",
          "chain_id",
          "reset_number",
          "template_id",
          "template_version",
          "step_sequence",
          "rules_snapshot",
          "execution_snapshot",
          "org_id",
          "user_id",
          "account_id",
          "account_number",
          "run_label",
          "account_run_label",
          "status",
          "started_at",
          "initial_balance",
          "purchase_price_snapshot",
          "activation_required_snapshot",
          "activation_status",
          "daily_pnl",
          "total_pnl",
          "trading_days",
          "profitable_days",
          "created_at"
        ],
        "type": "object"
      },
      "CloseAllPositionsRequest": {
        "description": "`POST /v1/accounts/by-external-id/close-all?external_account_id=...`.",
        "properties": {
          "idempotency_key": {
            "type": "string"
          },
          "reason": {
            "maxLength": 500,
            "type": [
              "string",
              "null"
            ]
          },
          "request_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "idempotency_key"
        ],
        "type": "object"
      },
      "CreateAccountBalanceCorrectionRequest": {
        "description": "`POST /v1/users/{id}/account-corrections`.\n\nCreates an audited signed balance correction. `amount` is a delta:\npositive credits the account, negative debits it.",
        "properties": {
          "amount": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "external_account_id": {
            "description": "Stable operator account selector. The service resolves this to the\ncurrent execution account under the account's program-account attempt.",
            "type": "string"
          },
          "idempotency_key": {
            "description": "Operator-provided idempotency key, scoped by the stable sponsored\naccount selected by `external_account_id`.",
            "type": "string"
          },
          "note": {
            "description": "Optional human note for the audit log.",
            "maxLength": 500,
            "type": [
              "string",
              "null"
            ]
          },
          "operator_reference": {
            "description": "Operator-side case/ticket/reference. Opaque to Noctant.",
            "maxLength": 255,
            "type": [
              "string",
              "null"
            ]
          },
          "reason": {
            "maxLength": 500,
            "minLength": 1,
            "type": "string"
          }
        },
        "required": [
          "external_account_id",
          "amount",
          "reason",
          "idempotency_key"
        ],
        "type": "object"
      },
      "CreateAccountRequest": {
        "description": "`POST /v1/accounts`.\n\nCreates a persistent simulated account sponsored by the calling operator.\nThe request is idempotent on `(operator_id, external_account_id)`.\n\nIf `product_id` is supplied, it must reference an operator-owned\n`active` or `hidden` product whose template is currently visible and has no\nfresh-account advancement steps. Product-backed accounts require\n`rules_owner = noctant`. Exact idempotency replays return the original\naccount before live product exposure is rechecked.",
        "properties": {
          "account_name": {
            "maxLength": 200,
            "type": [
              "string",
              "null"
            ]
          },
          "branding_policy": {
            "$ref": "#/components/schemas/AccountBrandingPolicy"
          },
          "claim_allowed": {
            "type": "boolean"
          },
          "currency": {
            "maxLength": 5,
            "minLength": 3,
            "type": "string"
          },
          "execution_profile_key": {
            "maxLength": 128,
            "minLength": 1,
            "type": "string"
          },
          "external_account_id": {
            "type": "string"
          },
          "external_user_id": {
            "description": "Operator-side user identifier from `POST /v1/users`. Exactly one of\nthis or `global_user_id` must be supplied.",
            "type": [
              "string",
              "null"
            ]
          },
          "feed_source": {
            "$ref": "#/components/schemas/AccountFeedSource"
          },
          "global_user_id": {
            "description": "Platform `global_user_id`. Exactly one of this or `external_user_id`\nmust be supplied.",
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "initial_balance": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "marketing_allowed": {
            "type": "boolean"
          },
          "product_id": {
            "description": "Optional challenge product to associate with this sponsored program\naccount. When supplied, the product must be owned by the calling\noperator, sellable (`active` or `hidden`), visible through its template,\nand not backed by fresh-account advancement while public fresh-account\nexposure remains gated. Requires `rules_owner = noctant`.",
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "provider_type": {
            "$ref": "#/components/schemas/AccountProviderType"
          },
          "rules_owner": {
            "$ref": "#/components/schemas/AccountRulesOwner"
          },
          "visibility_policy": {
            "$ref": "#/components/schemas/AccountVisibilityPolicy"
          }
        },
        "required": [
          "external_account_id",
          "initial_balance",
          "currency",
          "execution_profile_key",
          "provider_type",
          "rules_owner",
          "feed_source",
          "branding_policy",
          "visibility_policy",
          "claim_allowed",
          "marketing_allowed"
        ],
        "type": "object"
      },
      "CreateAccountResponse": {
        "properties": {
          "account": {
            "$ref": "#/components/schemas/OperatorAccountView"
          },
          "created": {
            "description": "`true` when this call created the account; `false` for an idempotent\nreplay returning the existing account.",
            "type": "boolean"
          }
        },
        "required": [
          "account",
          "created"
        ],
        "type": "object"
      },
      "CreateChallengeRequest": {
        "description": "`POST /v1/challenges`\n\nStarts a challenge on a pre-existing account for a pre-existing user.\nBoth `user_id` and `external_account_id` must have been established by prior\noperator-api calls (`POST /v1/users` for the user; `POST /v1/accounts`\nfor the sponsored account).\n\nPublic idempotency is scoped by operator-api before challenge-service sees it:\n`org_id/operator_id/environment/action/idempotency_key` is converted to a\nbounded service key. Re-sending the same public key for the same operator\nenvironment, action, and challenge facts returns the original challenge view;\nreusing the key for different challenge facts returns 409 Conflict.",
        "properties": {
          "external_account_id": {
            "description": "Stable operator account selector. Must identify an actively sponsored\nNoctant-rules account for `user_id`.",
            "type": "string"
          },
          "idempotency_key": {
            "description": "Operator-provided retry key. Required for partner-facing mutation\nsafety because challenge-service may commit even if the HTTP response\nis lost before the operator sees it.",
            "type": "string"
          },
          "template_id": {
            "description": "Template defining the rules (drawdown, target, phases, size).\nMust be visible to the operator — either a shared preset or a\nnon-archived template owned by the operator's org. Templates with\nfresh-account advancement steps remain hidden until fresh execution\naccounts pass public exposure review after durable activation-readiness\npromotion.",
            "format": "uuid",
            "type": "string"
          },
          "user_id": {
            "description": "`global_user_id` of a user previously provisioned by this operator.",
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "idempotency_key",
          "user_id",
          "external_account_id",
          "template_id"
        ],
        "type": "object"
      },
      "CreateHistoricalLaunchSessionRequest": {
        "description": "Future `POST /v1/historical-launch-sessions`.\n\nCreates a short-lived, one-time hosted redirect token for a historical\nreplay/backtest product. This request is intentionally accountless:\nfeed/time/product authority is checked through replay/backtest grants, not\nby pretending a historical session has an operator-sponsored live account.",
        "properties": {
          "external_user_id": {
            "description": "Operator-side user identifier from `POST /v1/users`. Exactly one of\nthis or `global_user_id` must be supplied.",
            "type": [
              "string",
              "null"
            ]
          },
          "feed_id": {
            "description": "Historical feed selected by the operator launch. Replay-service must\ncreate the eventual replay/backtest session on this exact feed.",
            "format": "uuid",
            "type": "string"
          },
          "global_user_id": {
            "description": "Platform `global_user_id`. Exactly one of this or `external_user_id`\nmust be supplied.",
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "market_time_end": {
            "description": "Exclusive historical market-time upper bound for the launched session.",
            "format": "date-time",
            "type": "string"
          },
          "market_time_start": {
            "description": "Inclusive historical market-time lower bound for the launched session.",
            "format": "date-time",
            "type": "string"
          },
          "requested_product_mode": {
            "$ref": "#/components/schemas/LaunchProductMode"
          },
          "requested_route": {
            "maxLength": 2048,
            "minLength": 1,
            "type": "string"
          },
          "return_url": {
            "maxLength": 2048,
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "requested_route",
          "requested_product_mode",
          "feed_id",
          "market_time_start",
          "market_time_end"
        ],
        "type": "object"
      },
      "CreateLaunchSessionRequest": {
        "description": "`POST /v1/launch-sessions`.\n\nCreates a short-lived, one-time hosted redirect token for an already\nsponsored account. The caller selects account + route only; account\nvisibility is copied from the sponsorship row by the service.",
        "properties": {
          "external_account_id": {
            "description": "Stable operator account selector.",
            "type": "string"
          },
          "external_user_id": {
            "description": "Operator-side user identifier from `POST /v1/users`. Exactly one of\nthis or `global_user_id` must be supplied.",
            "type": [
              "string",
              "null"
            ]
          },
          "global_user_id": {
            "description": "Platform `global_user_id`. Exactly one of this or `external_user_id`\nmust be supplied.",
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "requested_product_mode": {
            "$ref": "#/components/schemas/LaunchProductMode"
          },
          "requested_route": {
            "maxLength": 2048,
            "minLength": 1,
            "type": "string"
          },
          "return_url": {
            "maxLength": 2048,
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "external_account_id",
          "requested_route",
          "requested_product_mode"
        ],
        "type": "object"
      },
      "CreateLaunchSessionResponse": {
        "properties": {
          "launch_session": {
            "$ref": "#/components/schemas/LaunchSessionView"
          },
          "launch_url": {
            "description": "Hosted URL containing the one-time plaintext token. Store the URL only\nlong enough to redirect the browser.",
            "type": "string"
          }
        },
        "required": [
          "launch_session",
          "launch_url"
        ],
        "type": "object"
      },
      "CreatePayoutRequestRequest": {
        "description": "`POST /v1/users/{id}/payout-requests`.\n\nCreates an operator-originated payout request for a user account. The\nplatform still evaluates the account's frozen challenge payout policy and\nrecords the durable statement; the operator remains responsible for any\nexternal money movement.",
        "properties": {
          "amount": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "external_account_id": {
            "description": "Stable operator account selector. The service resolves this to the\ncurrent execution account under the account's program-account attempt.",
            "type": "string"
          },
          "idempotency_key": {
            "description": "Operator-provided idempotency key, scoped by the stable sponsored\naccount selected by `external_account_id`.",
            "type": "string"
          },
          "note": {
            "description": "Optional human note for the audit log.",
            "maxLength": 500,
            "type": [
              "string",
              "null"
            ]
          },
          "operator_reference": {
            "description": "Operator-side case/ticket/reference. Opaque to Noctant.",
            "maxLength": 255,
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "external_account_id",
          "amount",
          "idempotency_key"
        ],
        "type": "object"
      },
      "CreateProductRequest": {
        "description": "`POST /v1/products`\n\nCreates a challenge product for the calling operator. The referenced\n`template_id` must be owned by the operator's org OR be a shared\npreset (`template_type = 'preset'`), and it must not be archived.\nThe database trigger remains a backstop for cross-org ownership, while the\nAPI rejects non-visible/archived templates before first insert. Exact\nidempotency replays return the original accepted product even if live\ntemplate exposure changed later. Templates with fresh-account advancement\nsteps remain gated pending public fresh-account exposure review.",
        "properties": {
          "cooldown_hours_after_breach": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "currency": {
            "description": "ISO-4217 currency code. Uppercase. Required.",
            "pattern": "^[A-Z]{3}$",
            "type": "string"
          },
          "description": {
            "maxLength": 5000,
            "type": [
              "string",
              "null"
            ]
          },
          "display_name": {
            "maxLength": 200,
            "minLength": 1,
            "type": "string"
          },
          "display_order": {
            "description": "Sort order for public listing pages. Lower = earlier.",
            "format": "int32",
            "type": "integer"
          },
          "idempotency_key": {
            "type": "string"
          },
          "kyc_gate": {
            "$ref": "#/components/schemas/KycGate",
            "description": "Per-product KYC gating. Required; use `None` to explicitly disable gating."
          },
          "max_concurrent_per_user": {
            "description": "Optional purchase limits.",
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "metadata": {
            "description": "Arbitrary commercial metadata. Stored verbatim; never read by\nmatching engine or rules engine. Required; use `{}` or `null` when\nthere is no metadata."
          },
          "price": {
            "description": "Price in the product's `currency`. Must be ≥ 0. Stored as\nDECIMAL(18,2) on the platform side.",
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "public_listing": {
            "description": "Whether the product appears in public listings. Required.",
            "type": "boolean"
          },
          "slug": {
            "description": "URL-safe identifier, unique within this operator.",
            "maxLength": 63,
            "minLength": 1,
            "pattern": "^[a-z0-9][a-z0-9_-]{0,62}$",
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/ProductStatus",
            "description": "Initial lifecycle state. Required; use `Draft` for a product that is not sellable yet."
          },
          "template_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "idempotency_key",
          "template_id",
          "display_name",
          "slug",
          "price",
          "currency",
          "status",
          "public_listing",
          "display_order",
          "kyc_gate",
          "metadata"
        ],
        "type": "object"
      },
      "CreateWebhookReplayRequest": {
        "description": "`POST /v1/webhooks/replays`.",
        "properties": {
          "event_types": {
            "description": "Optional explicit event type filter. Omit for all currently deliverable\nevent types. Empty lists are invalid.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "external_account_id": {
            "description": "Optional stable operator account reference. When omitted, the replay\nscans all sponsored program accounts visible to the operator and any\naccountless historical backtest webhook events linked to the operator.\nWhen present, accountless historical events are intentionally excluded.",
            "type": [
              "string",
              "null"
            ]
          },
          "from_created_at": {
            "description": "Inclusive lower bound over source outbox `created_at`.",
            "format": "date-time",
            "type": "string"
          },
          "idempotency_key": {
            "description": "Operator-provided idempotency key scoped to the authenticated operator.",
            "type": "string"
          },
          "limit": {
            "description": "Max source events to enqueue. Defaults to\n[`WEBHOOK_REPLAY_DEFAULT_LIMIT`] and caps at\n[`WEBHOOK_REPLAY_MAX_EVENTS`].",
            "format": "int64",
            "type": [
              "integer",
              "null"
            ]
          },
          "to_created_at": {
            "description": "Exclusive upper bound over source outbox `created_at`.",
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "idempotency_key",
          "from_created_at",
          "to_created_at"
        ],
        "type": "object"
      },
      "CreateWebhookReplayResponse": {
        "description": "`POST /v1/webhooks/replays`.",
        "properties": {
          "duplicate": {
            "type": "boolean"
          },
          "enqueued_count": {
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "event_types": {
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "external_account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "from_created_at": {
            "format": "date-time",
            "type": "string"
          },
          "limit": {
            "format": "int64",
            "type": "integer"
          },
          "replay_request_id": {
            "format": "uuid",
            "type": "string"
          },
          "to_created_at": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "replay_request_id",
          "enqueued_count",
          "duplicate",
          "from_created_at",
          "to_created_at",
          "limit"
        ],
        "type": "object"
      },
      "HistoricalLaunchSessionView": {
        "properties": {
          "feed_id": {
            "description": "Historical feed pinned by the redeemed operator launch.",
            "format": "uuid",
            "type": "string"
          },
          "market_time_end": {
            "description": "Exclusive market-time upper bound authorized by the launch.",
            "format": "date-time",
            "type": "string"
          },
          "market_time_start": {
            "description": "Inclusive market-time lower bound authorized by the launch.",
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "feed_id",
          "market_time_start",
          "market_time_end"
        ],
        "type": "object"
      },
      "HistoricalSessionListCursor": {
        "properties": {
          "before_created_at": {
            "format": "date-time",
            "type": "string"
          },
          "before_session_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "before_created_at",
          "before_session_id"
        ],
        "type": "object"
      },
      "HistoricalSessionMode": {
        "enum": [
          "replay",
          "backtest"
        ],
        "type": "string"
      },
      "HistoricalSessionResponse": {
        "properties": {
          "session": {
            "$ref": "#/components/schemas/HistoricalSessionView"
          }
        },
        "required": [
          "session"
        ],
        "type": "object"
      },
      "HistoricalSessionSourceScope": {
        "enum": [
          "historical_session",
          "backtest_run"
        ],
        "type": "string"
      },
      "HistoricalSessionState": {
        "enum": [
          "created",
          "completed"
        ],
        "type": "string"
      },
      "HistoricalSessionTradeListCursor": {
        "properties": {
          "before_closed_market_time": {
            "format": "date-time",
            "type": "string"
          },
          "before_trade_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "before_closed_market_time",
          "before_trade_id"
        ],
        "type": "object"
      },
      "HistoricalSessionTradeView": {
        "properties": {
          "backtest_run_id": {
            "format": "uuid",
            "type": "string"
          },
          "closed_market_time": {
            "format": "date-time",
            "type": "string"
          },
          "commission": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "duration_seconds": {
            "format": "int64",
            "type": "integer"
          },
          "entry_market_time": {
            "format": "date-time",
            "type": "string"
          },
          "entry_price": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "exit_price": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "external_user_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "feed_id": {
            "format": "uuid",
            "type": "string"
          },
          "global_user_id": {
            "format": "uuid",
            "type": "string"
          },
          "gross_pnl": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "launch_session_id": {
            "format": "uuid",
            "type": "string"
          },
          "net_pnl": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "org_id": {
            "format": "uuid",
            "type": "string"
          },
          "quantity": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "requested_product_mode": {
            "$ref": "#/components/schemas/LaunchProductMode"
          },
          "session_id": {
            "format": "uuid",
            "type": "string"
          },
          "session_mode": {
            "$ref": "#/components/schemas/HistoricalTradeSessionMode"
          },
          "side": {
            "type": "string"
          },
          "source_id": {
            "format": "uuid",
            "type": "string"
          },
          "source_mode": {
            "$ref": "#/components/schemas/HistoricalTradeSessionMode"
          },
          "source_scope": {
            "$ref": "#/components/schemas/HistoricalTradeSourceScope"
          },
          "symbol": {
            "type": "string"
          },
          "trade_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "trade_id",
          "session_id",
          "backtest_run_id",
          "source_mode",
          "source_scope",
          "source_id",
          "launch_session_id",
          "org_id",
          "global_user_id",
          "requested_product_mode",
          "feed_id",
          "session_mode",
          "symbol",
          "side",
          "quantity",
          "entry_price",
          "exit_price",
          "gross_pnl",
          "commission",
          "net_pnl",
          "entry_market_time",
          "closed_market_time",
          "duration_seconds"
        ],
        "type": "object"
      },
      "HistoricalSessionTradesResponse": {
        "properties": {
          "count": {
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "next_cursor": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/HistoricalSessionTradeListCursor"
              },
              {
                "type": "null"
              }
            ]
          },
          "session": {
            "$ref": "#/components/schemas/HistoricalSessionView"
          },
          "trades": {
            "items": {
              "$ref": "#/components/schemas/HistoricalSessionTradeView"
            },
            "type": "array"
          }
        },
        "required": [
          "session",
          "trades",
          "count"
        ],
        "type": "object"
      },
      "HistoricalSessionView": {
        "properties": {
          "backtest_run_id": {
            "format": "uuid",
            "type": "string"
          },
          "completed_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "external_user_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "feed_id": {
            "format": "uuid",
            "type": "string"
          },
          "final_balance": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "global_user_id": {
            "format": "uuid",
            "type": "string"
          },
          "initial_balance": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "launch_session_id": {
            "format": "uuid",
            "type": "string"
          },
          "losing_trades": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "market_time_end": {
            "format": "date-time",
            "type": "string"
          },
          "market_time_start": {
            "format": "date-time",
            "type": "string"
          },
          "max_drawdown": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "org_id": {
            "format": "uuid",
            "type": "string"
          },
          "peak_balance": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "realized_pnl": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "requested_product_mode": {
            "$ref": "#/components/schemas/LaunchProductMode"
          },
          "session_id": {
            "format": "uuid",
            "type": "string"
          },
          "session_mode": {
            "$ref": "#/components/schemas/HistoricalSessionMode"
          },
          "source_id": {
            "format": "uuid",
            "type": "string"
          },
          "source_mode": {
            "$ref": "#/components/schemas/HistoricalSessionMode"
          },
          "source_scope": {
            "$ref": "#/components/schemas/HistoricalSessionSourceScope"
          },
          "state": {
            "$ref": "#/components/schemas/HistoricalSessionState"
          },
          "trade_count": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "updated_at": {
            "format": "date-time",
            "type": "string"
          },
          "winning_trades": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "session_id",
          "backtest_run_id",
          "source_mode",
          "source_scope",
          "source_id",
          "launch_session_id",
          "org_id",
          "global_user_id",
          "requested_product_mode",
          "session_mode",
          "feed_id",
          "market_time_start",
          "market_time_end",
          "state",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "HistoricalSessionsResponse": {
        "properties": {
          "count": {
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "next_cursor": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/HistoricalSessionListCursor"
              },
              {
                "type": "null"
              }
            ]
          },
          "sessions": {
            "items": {
              "$ref": "#/components/schemas/HistoricalSessionView"
            },
            "type": "array"
          }
        },
        "required": [
          "sessions",
          "count"
        ],
        "type": "object"
      },
      "HistoricalTradeSessionMode": {
        "enum": [
          "backtest"
        ],
        "type": "string"
      },
      "HistoricalTradeSourceScope": {
        "enum": [
          "backtest_run"
        ],
        "type": "string"
      },
      "KycGate": {
        "description": "KYC gate on a product — when enforced, the operator must have\nreported `kyc_records.status = verified` for the user at the gate\npoint before the action succeeds.",
        "oneOf": [
          {
            "enum": [
              "none"
            ],
            "type": "string"
          },
          {
            "const": "challenge_start",
            "description": "User must be verified before a challenge instance is created.",
            "type": "string"
          },
          {
            "const": "payout_only",
            "description": "User must be verified to qualify for payout.",
            "type": "string"
          },
          {
            "const": "both",
            "description": "Both gates apply.",
            "type": "string"
          }
        ]
      },
      "KycStatus": {
        "description": "Status values accepted by `POST /v1/users/{id}/kyc-status`.\n\nLower-case on the wire. `serde`'s `rename_all = \"lowercase\"`\nguarantees the serialized form matches the DB `kyc_records.status`\ncolumn enum.",
        "enum": [
          "pending",
          "verified",
          "rejected",
          "expired"
        ],
        "type": "string"
      },
      "KycStatusResponse": {
        "description": "Response shape — echoes the persisted record.",
        "properties": {
          "expires_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "provider_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "rejected_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "rejection_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "reported_at": {
            "format": "date-time",
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/KycStatus"
          },
          "updated_at": {
            "format": "date-time",
            "type": "string"
          },
          "verified_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "status",
          "reported_at",
          "updated_at"
        ],
        "type": "object"
      },
      "LaunchProductMode": {
        "enum": [
          "terminal",
          "challenge",
          "simulator",
          "replay",
          "backtest"
        ],
        "type": "string"
      },
      "LaunchSessionKind": {
        "enum": [
          "account",
          "historical"
        ],
        "type": "string"
      },
      "LaunchSessionResponse": {
        "description": "`GET /v1/launch-sessions/{launch_session_id}`.",
        "properties": {
          "launch_session": {
            "$ref": "#/components/schemas/LaunchSessionView"
          }
        },
        "required": [
          "launch_session"
        ],
        "type": "object"
      },
      "LaunchSessionView": {
        "properties": {
          "account_id": {
            "description": "Current execution account for the hosted launch. Program-account routes\nand sponsorship are anchored by `program_account_id`; this field is the\nconcrete account metadata the browser uses for account-hub selection.",
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "account_visibility_policy": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AccountVisibilityPolicy"
              },
              {
                "type": "null"
              }
            ]
          },
          "browser_session_attached": {
            "description": "True after the auth/BFF has attached the normal browser session id.\nThe raw session id is never exposed on the API surface.",
            "type": "boolean"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "expires_at": {
            "format": "date-time",
            "type": "string"
          },
          "global_user_id": {
            "format": "uuid",
            "type": "string"
          },
          "historical_launch": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/HistoricalLaunchSessionView"
              },
              {
                "type": "null"
              }
            ]
          },
          "launch_session_id": {
            "format": "uuid",
            "type": "string"
          },
          "launch_session_kind": {
            "$ref": "#/components/schemas/LaunchSessionKind"
          },
          "operator_id": {
            "format": "uuid",
            "type": "string"
          },
          "org_id": {
            "format": "uuid",
            "type": "string"
          },
          "program_account_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "redeemed_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "requested_product_mode": {
            "$ref": "#/components/schemas/LaunchProductMode"
          },
          "requested_route": {
            "type": "string"
          },
          "return_url": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "launch_session_id",
          "launch_session_kind",
          "operator_id",
          "org_id",
          "global_user_id",
          "requested_route",
          "requested_product_mode",
          "expires_at",
          "browser_session_attached",
          "created_at"
        ],
        "type": "object"
      },
      "OperatorAccountView": {
        "properties": {
          "account_id": {
            "description": "Current execution account metadata. Stable operator account identity is\n`program_account_id` plus the operator-scoped `external_account_id`.",
            "format": "uuid",
            "type": "string"
          },
          "account_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "account_number": {
            "type": "string"
          },
          "branding_policy": {
            "$ref": "#/components/schemas/AccountBrandingPolicy"
          },
          "challenge_instance_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "claim_allowed": {
            "type": "boolean"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "current_program_account_attempt_id": {
            "format": "uuid",
            "type": "string"
          },
          "execution_mode": {
            "$ref": "#/components/schemas/AccountExecutionMode"
          },
          "execution_profile_key": {
            "type": "string"
          },
          "external_account_id": {
            "type": "string"
          },
          "feed_source": {
            "$ref": "#/components/schemas/AccountFeedSource"
          },
          "global_user_id": {
            "format": "uuid",
            "type": "string"
          },
          "market_mode": {
            "$ref": "#/components/schemas/AccountMarketMode"
          },
          "marketing_allowed": {
            "type": "boolean"
          },
          "org_id": {
            "format": "uuid",
            "type": "string"
          },
          "product_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "program_account_id": {
            "format": "uuid",
            "type": "string"
          },
          "program_origin": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AccountProgramOrigin"
              },
              {
                "type": "null"
              }
            ]
          },
          "program_type": {
            "$ref": "#/components/schemas/AccountProgramType"
          },
          "provider_type": {
            "$ref": "#/components/schemas/AccountProviderType"
          },
          "provisioning_source": {
            "$ref": "#/components/schemas/AccountProvisioningSource"
          },
          "rules_owner": {
            "$ref": "#/components/schemas/AccountRulesOwner"
          },
          "sponsorship_status": {
            "$ref": "#/components/schemas/SponsoredAccountStatus"
          },
          "updated_at": {
            "format": "date-time",
            "type": "string"
          },
          "visibility_policy": {
            "$ref": "#/components/schemas/AccountVisibilityPolicy"
          }
        },
        "required": [
          "org_id",
          "global_user_id",
          "program_account_id",
          "current_program_account_attempt_id",
          "account_id",
          "external_account_id",
          "account_number",
          "currency",
          "execution_profile_key",
          "execution_mode",
          "market_mode",
          "program_type",
          "provisioning_source",
          "provider_type",
          "rules_owner",
          "feed_source",
          "branding_policy",
          "visibility_policy",
          "claim_allowed",
          "marketing_allowed",
          "sponsorship_status",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "OperatorApiAccess": {
        "enum": [
          "disabled",
          "allowlisted_beta"
        ],
        "type": "string"
      },
      "OperatorContextResponse": {
        "properties": {
          "operator": {
            "$ref": "#/components/schemas/OperatorContextView"
          }
        },
        "required": [
          "operator"
        ],
        "type": "object"
      },
      "OperatorContextView": {
        "properties": {
          "activated_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "allowed_origins": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "environment": {
            "$ref": "#/components/schemas/OperatorEnvironment"
          },
          "name": {
            "type": "string"
          },
          "operator_api_access": {
            "$ref": "#/components/schemas/OperatorApiAccess"
          },
          "operator_api_scopes": {
            "items": {
              "enum": [
                "users:create",
                "users:read",
                "accounts:create",
                "accounts:read",
                "accounts:status_write",
                "accounts:close_all",
                "account_summary:read",
                "orders:read",
                "positions:read",
                "trades:read",
                "historical_sessions:read",
                "challenges:create",
                "challenges:read",
                "challenges:reset",
                "launch_sessions:create",
                "launch_sessions:read",
                "products:create",
                "products:read",
                "kyc_status:write",
                "payouts:read",
                "payout_requests:create",
                "payout_requests:approve",
                "payout_requests:reject",
                "payout_settlements:write",
                "account_corrections:read",
                "account_corrections:create",
                "api_keys:rotate",
                "webhook_deliveries:read",
                "webhooks:replay",
                "webhooks:receive"
              ],
              "type": "string"
            },
            "type": "array"
          },
          "operator_id": {
            "format": "uuid",
            "type": "string"
          },
          "org_id": {
            "format": "uuid",
            "type": "string"
          },
          "rate_limit_tier": {
            "$ref": "#/components/schemas/OperatorRateLimitTier"
          },
          "slug": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/OperatorStatus"
          },
          "updated_at": {
            "format": "date-time",
            "type": "string"
          },
          "webhook": {
            "$ref": "#/components/schemas/OperatorWebhookConfigView"
          }
        },
        "required": [
          "operator_id",
          "org_id",
          "name",
          "slug",
          "status",
          "environment",
          "rate_limit_tier",
          "operator_api_access",
          "operator_api_scopes",
          "webhook",
          "allowed_origins",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "OperatorEnvironment": {
        "enum": [
          "production",
          "staging",
          "development",
          "sandbox"
        ],
        "type": "string"
      },
      "OperatorRateLimitTier": {
        "enum": [
          "standard",
          "pro",
          "enterprise",
          "unlimited"
        ],
        "type": "string"
      },
      "OperatorStatus": {
        "enum": [
          "pending",
          "active",
          "suspended",
          "terminated"
        ],
        "type": "string"
      },
      "OperatorWebhookConfigView": {
        "properties": {
          "configured": {
            "type": "boolean"
          },
          "enabled": {
            "type": "boolean"
          },
          "event_types": {
            "description": "`None` means all current and future partner webhook event types.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "url_fingerprint": {
            "type": [
              "string",
              "null"
            ]
          },
          "url_origin": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "enabled",
          "configured"
        ],
        "type": "object"
      },
      "PayoutAccountEffectStatus": {
        "enum": [
          "not_applicable",
          "reserved",
          "executing",
          "executed",
          "failed",
          "invalid_execution"
        ],
        "type": "string"
      },
      "PayoutExternalSettlementStatus": {
        "enum": [
          "not_tracked",
          "pending_operator_payment",
          "operator_marked_paid",
          "operator_rejected_payment",
          "operator_cancelled_payment"
        ],
        "type": "string"
      },
      "PayoutListCursor": {
        "properties": {
          "before_event_id": {
            "format": "uuid",
            "type": "string"
          },
          "before_occurred_at": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "before_occurred_at",
          "before_event_id"
        ],
        "type": "object"
      },
      "PayoutPolicyStatus": {
        "enum": [
          "pending_review",
          "approved",
          "rejected"
        ],
        "type": "string"
      },
      "PayoutRecord": {
        "description": "One payout cash event.",
        "properties": {
          "amount": {
            "description": "Amount paid out. Always positive (cash event credits are\npositive in the ledger convention).",
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "chain_id": {
            "description": "Chain containing the instance, if any. Useful for grouping\npayouts across resets/advances within one challenge chain.",
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "correlation_id": {
            "description": "Business correlation id for reconstructing the payout flow.\nFor challenge-created payouts this is the payout request id.",
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "description": "ISO-4217 currency of the payout. Inherited from the underlying\nchallenge at the time of the event.",
            "type": "string"
          },
          "description": {
            "description": "Operator-facing description the platform attached at write\ntime. May be `None` for older events.",
            "type": [
              "string",
              "null"
            ]
          },
          "event_id": {
            "format": "uuid",
            "type": "string"
          },
          "instance_id": {
            "description": "Challenge instance the payout settled. `None` when the payout\nwas recorded out-of-band and not attached to a specific run.",
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "occurred_at": {
            "description": "When the payout was recorded in the platform ledger.",
            "format": "date-time",
            "type": "string"
          },
          "source_event_id": {
            "description": "Balance event that caused this payout cash event. Present for\npayouts produced by the challenge payout execution path.",
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "event_id",
          "amount",
          "currency",
          "occurred_at"
        ],
        "type": "object"
      },
      "PayoutStatement": {
        "description": "Operator-facing payout request statement.\n\nThis is the durable request/decision record, not proof that a third-party\nfirm has sent external money. External settlement fields are only populated\nwhen the operator chooses to track that state in Noctant.",
        "properties": {
          "accepted_gross_amount": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "account_effect_executed_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "account_effect_status": {
            "$ref": "#/components/schemas/PayoutAccountEffectStatus"
          },
          "account_id": {
            "format": "uuid",
            "type": "string"
          },
          "approved_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "causation_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "challenge_chain_id": {
            "format": "uuid",
            "type": "string"
          },
          "challenge_instance_id": {
            "format": "uuid",
            "type": "string"
          },
          "correlation_id": {
            "type": "string"
          },
          "executed_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "execution_event_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "external_settlement_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "external_settlement_status": {
            "$ref": "#/components/schemas/PayoutExternalSettlementStatus"
          },
          "externally_settled_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "firm_retained_amount": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "operator_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "ordinal_payout_number": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "payout_request_id": {
            "format": "uuid",
            "type": "string"
          },
          "policy_decision": true,
          "policy_input": true,
          "policy_snapshot": true,
          "policy_status": {
            "$ref": "#/components/schemas/PayoutPolicyStatus"
          },
          "rejected_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "requested_amount": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "requested_at": {
            "format": "date-time",
            "type": "string"
          },
          "required_remaining_buffer": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "trace_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "trader_amount": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "user_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "payout_request_id",
          "user_id",
          "account_id",
          "challenge_instance_id",
          "challenge_chain_id",
          "policy_status",
          "account_effect_status",
          "external_settlement_status",
          "requested_amount",
          "policy_snapshot",
          "policy_input",
          "policy_decision",
          "correlation_id",
          "requested_at"
        ],
        "type": "object"
      },
      "PayoutStatementListCursor": {
        "properties": {
          "before_payout_request_id": {
            "format": "uuid",
            "type": "string"
          },
          "before_requested_at": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "before_requested_at",
          "before_payout_request_id"
        ],
        "type": "object"
      },
      "PayoutStatementResponse": {
        "description": "`GET /v1/users/{id}/payout-statements/{request_id}` response.",
        "properties": {
          "statement": {
            "$ref": "#/components/schemas/PayoutStatement"
          }
        },
        "required": [
          "statement"
        ],
        "type": "object"
      },
      "PayoutStatementsListResponse": {
        "description": "`GET /v1/users/{id}/payout-statements` response.",
        "properties": {
          "count": {
            "description": "Number of payout statements in this response page.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "next_cursor": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PayoutStatementListCursor"
              },
              {
                "type": "null"
              }
            ]
          },
          "statements": {
            "items": {
              "$ref": "#/components/schemas/PayoutStatement"
            },
            "type": "array"
          }
        },
        "required": [
          "statements",
          "count"
        ],
        "type": "object"
      },
      "PayoutsListResponse": {
        "description": "`GET /v1/users/{id}/payouts` response.",
        "properties": {
          "count": {
            "description": "Number of payout records in this response page.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "next_cursor": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PayoutListCursor"
              },
              {
                "type": "null"
              }
            ]
          },
          "payouts": {
            "items": {
              "$ref": "#/components/schemas/PayoutRecord"
            },
            "type": "array"
          }
        },
        "required": [
          "payouts",
          "count"
        ],
        "type": "object"
      },
      "ProductListResponse": {
        "description": "`GET /v1/products` response.",
        "properties": {
          "products": {
            "items": {
              "$ref": "#/components/schemas/ProductView"
            },
            "type": "array"
          }
        },
        "required": [
          "products"
        ],
        "type": "object"
      },
      "ProductStatus": {
        "description": "Product lifecycle.",
        "oneOf": [
          {
            "const": "draft",
            "description": "Editable, not sellable.",
            "type": "string"
          },
          {
            "const": "active",
            "description": "Sellable; listed if `public_listing = true`.",
            "type": "string"
          },
          {
            "const": "hidden",
            "description": "Sellable only via direct link.",
            "type": "string"
          },
          {
            "const": "archived",
            "description": "Not sellable; kept for reporting.",
            "type": "string"
          }
        ]
      },
      "ProductView": {
        "description": "Read/return view of a product. Used by `POST`, `GET list`, and\n`GET /v1/products/{id}` responses.",
        "properties": {
          "activated_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "archived_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "cooldown_hours_after_breach": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "display_name": {
            "type": "string"
          },
          "display_order": {
            "format": "int32",
            "type": "integer"
          },
          "kyc_gate": {
            "$ref": "#/components/schemas/KycGate"
          },
          "max_concurrent_per_user": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "metadata": true,
          "operator_id": {
            "format": "uuid",
            "type": "string"
          },
          "price": {
            "pattern": "^-?\\d+(\\.\\d+)?([eE]\\d+)?$",
            "type": [
              "string",
              "number"
            ]
          },
          "product_id": {
            "format": "uuid",
            "type": "string"
          },
          "public_listing": {
            "type": "boolean"
          },
          "slug": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/ProductStatus"
          },
          "template_id": {
            "format": "uuid",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "product_id",
          "operator_id",
          "template_id",
          "display_name",
          "slug",
          "price",
          "currency",
          "status",
          "public_listing",
          "display_order",
          "kyc_gate",
          "metadata",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "ProvisionUserRequest": {
        "description": "`POST /v1/users`\n\nProvisions a user scoped to the calling operator. The request is\n**idempotent** on `(operator_id, external_id)`: re-submitting the\nsame `external_id` returns the existing user, it does not create a\nduplicate. `email` updates on each call (refreshes the\n`email_last_seen` snapshot).",
        "properties": {
          "display_name": {
            "description": "Display name (human-readable). Optional.",
            "maxLength": 255,
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "description": "User's email address. Optional at provisioning — operators that\nhaven't yet captured an email at signup can omit, then pass\n`PATCH /v1/users/{id}` when they have it.\n\nFormat is validated with the `validator` crate's `email` check;\nrejected emails produce 400.",
            "format": "email",
            "type": [
              "string",
              "null"
            ]
          },
          "external_id": {
            "description": "Operator-side identifier for the user (their CRM primary key).\nMust be stable for the life of the user on the operator's side.\n\nOpaque to Noctant — treated as an arbitrary string. Matched\nbyte-for-byte on re-provisioning.",
            "type": "string"
          }
        },
        "required": [
          "external_id"
        ],
        "type": "object"
      },
      "ProvisionUserResponse": {
        "description": "Response to [`ProvisionUserRequest`].",
        "properties": {
          "created": {
            "description": "`true` if this call created a new user; `false` if the user\nalready existed and was returned unchanged (idempotent replay).",
            "type": "boolean"
          },
          "created_at": {
            "description": "When this mapping was first created. Stable across subsequent\nidempotent provisioning calls.",
            "format": "date-time",
            "type": "string"
          },
          "display_name": {
            "description": "Last-known display name. May be `null`.",
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "description": "Last-known email. May be `null` if the operator never supplied one.",
            "type": [
              "string",
              "null"
            ]
          },
          "external_id": {
            "description": "Echo of the operator's `external_id`. Useful for operators that\nwant to pair responses to their own outbound requests without\ntracking the mapping themselves.",
            "type": "string"
          },
          "global_user_id": {
            "description": "Platform-wide user identifier. Use this in subsequent API calls\nthat take a user reference (e.g., `POST /v1/challenges`).",
            "format": "uuid",
            "type": "string"
          },
          "updated_at": {
            "description": "When this mapping was last updated (re-provisioning refreshes\n`email_last_seen` / `display_name_last_seen`).",
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "global_user_id",
          "external_id",
          "created_at",
          "updated_at",
          "created"
        ],
        "type": "object"
      },
      "RejectPayoutRequestRequest": {
        "description": "`POST /v1/users/{id}/payout-requests/{request_id}/reject`.\n\nRejects an operator-review payout request before any external\nsettlement is tracked. The reason is stored on the audit row and in\nthe durable policy decision payload.",
        "properties": {
          "operator_reference": {
            "maxLength": 255,
            "type": [
              "string",
              "null"
            ]
          },
          "reason": {
            "maxLength": 500,
            "minLength": 1,
            "type": "string"
          }
        },
        "required": [
          "reason"
        ],
        "type": "object"
      },
      "ReportKycStatusRequest": {
        "description": "`POST /v1/users/{global_user_id}/kyc-status`\n\nReports the KYC status of a previously-provisioned user. Upsert on\n`(operator_id, user_id)` — subsequent calls update the existing\nrecord. Every call emits a `kyc_events` row with the previous and\nnew status.\n\nEvery report must include `reported_at`, the operator/provider report\ntimestamp that Noctant stores verbatim. Per-status decision timestamp\nrequirements are validated server-side:\n  * `verified` -> `verified_at` is required\n  * `rejected` -> `rejected_at` is required; `rejection_reason` may be supplied\n  * `pending` / `expired` -> no decision timestamp is required",
        "properties": {
          "expires_at": {
            "description": "Current verification expiry. Meaningful for `verified` and `expired`\nreports; cleared for `pending` and `rejected`.",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "provider_name": {
            "description": "Operator-supplied label for their KYC provider. Informational\nonly — stored verbatim. Examples: \"sumsub\", \"veriff\", \"manual\".",
            "maxLength": 64,
            "type": [
              "string",
              "null"
            ]
          },
          "provider_reference": {
            "description": "Operator-side reference for the KYC case (e.g. Sumsub applicantId).\nOpaque to Noctant.",
            "maxLength": 255,
            "type": [
              "string",
              "null"
            ]
          },
          "rejected_at": {
            "description": "Timestamp of the current rejection. Required when\n`status = rejected`; cleared for other statuses.",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "rejection_reason": {
            "description": "Free-form current rejection detail. Used only when `status = rejected`.",
            "maxLength": 500,
            "type": [
              "string",
              "null"
            ]
          },
          "reported_at": {
            "description": "Operator/provider report timestamp. This is source authority for when\nthe KYC status report was produced, not the platform receive time.",
            "format": "date-time",
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/KycStatus"
          },
          "verified_at": {
            "description": "Timestamp of the current verification. Required when\n`status = verified`; cleared for other statuses.",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "status",
          "reported_at"
        ],
        "type": "object"
      },
      "ResetChallengeRequest": {
        "description": "`POST /v1/challenges/{id}/reset`\n\nOperator-initiated reset. Starts a new run in the same challenge\nchain (new `reset_number`, fresh balance, fresh drawdown anchors) —\nthe prior run is moved to terminal state by challenge-service.\n\nReset policy (whether and when resets are allowed) lives on the\ntemplate. If the template does not permit a reset in the current\nstate, operator-api surfaces the mapped conflict/validation response.\n\nPublic idempotency is scoped by operator-api before challenge-service sees it:\n`org_id/operator_id/environment/action/idempotency_key` is converted to a\nbounded service key. Re-sending the same public key for the same operator\nenvironment, action, and source instance returns the same new run; reusing\nthe key for a different reset request returns 409 Conflict.",
        "properties": {
          "idempotency_key": {
            "description": "Operator-provided retry key.",
            "type": "string"
          },
          "reason": {
            "description": "Optional human-readable reason surfaced in the audit log.\nNot sent to challenge-service; stored only on operator-api's\naudit row.",
            "maxLength": 500,
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "idempotency_key"
        ],
        "type": "object"
      },
      "RotateOperatorApiKeyResponse": {
        "properties": {
          "api_key": {
            "description": "New plaintext API key. Returned once; Noctant stores only its hash and\nprefix.",
            "type": "string"
          },
          "api_key_prefix": {
            "type": "string"
          },
          "rotated_at": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "api_key",
          "api_key_prefix",
          "rotated_at"
        ],
        "type": "object"
      },
      "SponsoredAccountStatus": {
        "enum": [
          "active",
          "disabled",
          "closed"
        ],
        "type": "string"
      },
      "UpdateAccountStatusRequest": {
        "description": "`PATCH /v1/accounts/by-external-id/status?external_account_id=...`.",
        "properties": {
          "force_close_positions": {
            "default": false,
            "description": "When disabling an account, also ask the matching engine to force-close\nopen positions. Ignored for active no-op/re-enable requests.",
            "type": "boolean"
          },
          "idempotency_key": {
            "type": "string"
          },
          "reason": {
            "maxLength": 500,
            "type": [
              "string",
              "null"
            ]
          },
          "request_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "$ref": "#/components/schemas/SponsoredAccountStatus",
            "description": "Desired sponsorship/trading control state.\n\nThe first beta control surface supports `active` and `disabled`.\n`closed` remains a persisted read status but is intentionally rejected\nhere until the platform has a first-class close-account command."
          }
        },
        "required": [
          "status",
          "idempotency_key"
        ],
        "type": "object"
      },
      "UpdatePayoutSettlementRequest": {
        "description": "`PATCH /v1/users/{id}/payout-requests/{request_id}/external-settlement`.\n\nTracks an operator-owned external payment state. This is separate from\nplatform account effects; marking a payout paid here never proves that\nthe matching engine debited the trading account.",
        "properties": {
          "external_settlement_reference": {
            "description": "Required when `status = operator_marked_paid`. Optional for other\ntracked states.",
            "maxLength": 255,
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "description": "Optional human note for the audit log.",
            "maxLength": 500,
            "type": [
              "string",
              "null"
            ]
          },
          "operator_reference": {
            "maxLength": 255,
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "$ref": "#/components/schemas/PayoutExternalSettlementStatus"
          }
        },
        "required": [
          "status"
        ],
        "type": "object"
      },
      "UserSummary": {
        "description": "Stable fields of a user as seen by operators. This is the shape\nreturned by `POST /v1/users`, `GET /v1/users/{id}`,\n`GET /v1/users?external_id=...`, and any future endpoints that return a\nuser.",
        "properties": {
          "created_at": {
            "description": "When this mapping was first created. Stable across subsequent\nidempotent provisioning calls.",
            "format": "date-time",
            "type": "string"
          },
          "display_name": {
            "description": "Last-known display name. May be `null`.",
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "description": "Last-known email. May be `null` if the operator never supplied one.",
            "type": [
              "string",
              "null"
            ]
          },
          "external_id": {
            "description": "Echo of the operator's `external_id`. Useful for operators that\nwant to pair responses to their own outbound requests without\ntracking the mapping themselves.",
            "type": "string"
          },
          "global_user_id": {
            "description": "Platform-wide user identifier. Use this in subsequent API calls\nthat take a user reference (e.g., `POST /v1/challenges`).",
            "format": "uuid",
            "type": "string"
          },
          "updated_at": {
            "description": "When this mapping was last updated (re-provisioning refreshes\n`email_last_seen` / `display_name_last_seen`).",
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "global_user_id",
          "external_id",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "WebhookDeliveriesResponse": {
        "description": "`GET /v1/webhooks/deliveries`.",
        "properties": {
          "count": {
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          },
          "deliveries": {
            "items": {
              "$ref": "#/components/schemas/WebhookDeliveryView"
            },
            "type": "array"
          },
          "next_cursor": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/WebhookDeliveryListCursor"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "deliveries",
          "count"
        ],
        "type": "object"
      },
      "WebhookDeliveryListCursor": {
        "properties": {
          "before_attempt_number": {
            "format": "int32",
            "type": "integer"
          },
          "before_delivery_row_id": {
            "format": "uuid",
            "type": "string"
          },
          "before_finished_at": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "before_finished_at",
          "before_attempt_number",
          "before_delivery_row_id"
        ],
        "type": "object"
      },
      "WebhookDeliveryStatus": {
        "description": "Delivery-attempt status from the `webhook_deliveries` ledger.",
        "enum": [
          "delivered",
          "transient_fail",
          "permanent_fail",
          "dead_letter"
        ],
        "type": "string"
      },
      "WebhookDeliveryView": {
        "description": "One operator-visible webhook delivery attempt.\n\nThis intentionally mirrors the existing append-only delivery ledger without\nexposing internal NATS subjects, response headers, or signing material.",
        "properties": {
          "attempt_number": {
            "format": "int32",
            "type": "integer"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "delivery_row_id": {
            "format": "uuid",
            "type": "string"
          },
          "duration_ms": {
            "format": "int32",
            "type": "integer"
          },
          "error_class": {
            "type": [
              "string",
              "null"
            ]
          },
          "error_message": {
            "type": [
              "string",
              "null"
            ]
          },
          "event_id": {
            "format": "uuid",
            "type": "string"
          },
          "event_type": {
            "type": "string"
          },
          "finished_at": {
            "format": "date-time",
            "type": "string"
          },
          "response_body_excerpt": {
            "type": [
              "string",
              "null"
            ]
          },
          "response_status": {
            "format": "int32",
            "type": [
              "integer",
              "null"
            ]
          },
          "started_at": {
            "format": "date-time",
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/WebhookDeliveryStatus"
          }
        },
        "required": [
          "delivery_row_id",
          "event_id",
          "event_type",
          "attempt_number",
          "status",
          "started_at",
          "finished_at",
          "duration_ms",
          "created_at"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "operatorBearerAuth": {
        "description": "Operator API key sent as `Authorization: Bearer <key>`.",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "title": "Noctant Operator API",
    "version": "v1"
  },
  "openapi": "3.1.0",
  "paths": {
    "/v1/accounts": {
      "get": {
        "operationId": "listAccounts",
        "parameters": [
          {
            "in": "query",
            "name": "before_created_at",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "before_program_account_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountListResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "List accounts sponsored by the operator.",
        "tags": [
          "Accounts"
        ],
        "x-required-scopes": [
          "accounts:read"
        ]
      },
      "post": {
        "operationId": "createAccount",
        "parameters": [
          {
            "description": "Optional UUID used for audit/log correlation on write requests.",
            "in": "header",
            "name": "x-noctant-request-id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAccountRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateAccountResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateAccountResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Create or replay a sponsored program account.",
        "tags": [
          "Accounts"
        ],
        "x-required-scopes": [
          "accounts:create"
        ]
      }
    },
    "/v1/accounts/by-external-id": {
      "get": {
        "operationId": "getAccountByExternalId",
        "parameters": [
          {
            "in": "query",
            "name": "external_account_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Lookup a sponsored account by stable external account id.",
        "tags": [
          "Accounts"
        ],
        "x-required-scopes": [
          "accounts:read"
        ]
      }
    },
    "/v1/accounts/by-external-id/close-all": {
      "post": {
        "operationId": "closeAllPositionsByExternalId",
        "parameters": [
          {
            "in": "query",
            "name": "external_account_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Optional UUID used for audit/log correlation on write requests.",
            "in": "header",
            "name": "x-noctant-request-id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CloseAllPositionsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountCommandAcceptedResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Request close-all for the current execution account.",
        "tags": [
          "Accounts"
        ],
        "x-required-scopes": [
          "accounts:close_all"
        ]
      }
    },
    "/v1/accounts/by-external-id/commands/{command_id}": {
      "get": {
        "operationId": "getAccountCommandStatusByExternalId",
        "parameters": [
          {
            "in": "path",
            "name": "command_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "external_account_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountCommandStatusResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Read matching-engine acceptance status for one account command.",
        "tags": [
          "Accounts"
        ],
        "x-required-scopes": [
          "accounts:read"
        ]
      }
    },
    "/v1/accounts/by-external-id/orders": {
      "get": {
        "operationId": "listOrdersByExternalId",
        "parameters": [
          {
            "in": "query",
            "name": "external_account_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "attempt_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "before_created_at",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "before_order_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "execution_scope",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/AccountExecutionScope"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountOrdersResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Read order history by stable external account id.",
        "tags": [
          "Accounts"
        ],
        "x-required-scopes": [
          "orders:read"
        ]
      }
    },
    "/v1/accounts/by-external-id/positions": {
      "get": {
        "operationId": "listPositionsByExternalId",
        "parameters": [
          {
            "in": "query",
            "name": "external_account_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountPositionsResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Read current open positions by stable external account id.",
        "tags": [
          "Accounts"
        ],
        "x-required-scopes": [
          "positions:read"
        ]
      }
    },
    "/v1/accounts/by-external-id/status": {
      "patch": {
        "operationId": "updateAccountStatusByExternalId",
        "parameters": [
          {
            "in": "query",
            "name": "external_account_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Optional UUID used for audit/log correlation on write requests.",
            "in": "header",
            "name": "x-noctant-request-id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAccountStatusRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountStatusUpdateResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountStatusUpdateResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Update sponsored account status by stable external account id.",
        "tags": [
          "Accounts"
        ],
        "x-required-scopes": [
          "accounts:status_write"
        ]
      }
    },
    "/v1/accounts/by-external-id/summary": {
      "get": {
        "operationId": "getAccountSummaryByExternalId",
        "parameters": [
          {
            "in": "query",
            "name": "external_account_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountSummaryResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Read current account summary by stable external account id.",
        "tags": [
          "Accounts"
        ],
        "x-required-scopes": [
          "account_summary:read"
        ]
      }
    },
    "/v1/accounts/by-external-id/trades": {
      "get": {
        "operationId": "listTradesByExternalId",
        "parameters": [
          {
            "in": "query",
            "name": "external_account_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "attempt_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "before_closed_at",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "before_trade_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "execution_scope",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/AccountExecutionScope"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountTradesResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Read closed-trade history by stable external account id.",
        "tags": [
          "Accounts"
        ],
        "x-required-scopes": [
          "trades:read"
        ]
      }
    },
    "/v1/challenges": {
      "post": {
        "operationId": "createChallenge",
        "parameters": [
          {
            "description": "Optional UUID used for audit/log correlation on write requests.",
            "in": "header",
            "name": "x-noctant-request-id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateChallengeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChallengeView"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Start a challenge on an active sponsored account.",
        "tags": [
          "Challenges"
        ],
        "x-required-scopes": [
          "challenges:create"
        ]
      }
    },
    "/v1/challenges/{instance_id}": {
      "get": {
        "operationId": "getChallenge",
        "parameters": [
          {
            "in": "path",
            "name": "instance_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChallengeView"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Get a challenge through sponsored-account scope.",
        "tags": [
          "Challenges"
        ],
        "x-required-scopes": [
          "challenges:read"
        ]
      }
    },
    "/v1/challenges/{instance_id}/reset": {
      "post": {
        "operationId": "resetChallenge",
        "parameters": [
          {
            "in": "path",
            "name": "instance_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Optional UUID used for audit/log correlation on write requests.",
            "in": "header",
            "name": "x-noctant-request-id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResetChallengeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChallengeView"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Reset an eligible active challenge.",
        "tags": [
          "Challenges"
        ],
        "x-required-scopes": [
          "challenges:reset"
        ]
      }
    },
    "/v1/historical-launch-sessions": {
      "post": {
        "operationId": "createHistoricalLaunchSession",
        "parameters": [
          {
            "description": "Optional UUID used for audit/log correlation on write requests.",
            "in": "header",
            "name": "x-noctant-request-id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateHistoricalLaunchSessionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateLaunchSessionResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Create a hosted launch session for a historical backtest product.",
        "tags": [
          "Launch Sessions"
        ],
        "x-required-scopes": [
          "launch_sessions:create"
        ]
      }
    },
    "/v1/historical-sessions": {
      "get": {
        "operationId": "listHistoricalSessions",
        "parameters": [
          {
            "in": "query",
            "name": "before_created_at",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "before_session_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "external_user_id",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "feed_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "global_user_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "launch_session_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "requested_product_mode",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/LaunchProductMode"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          {
            "in": "query",
            "name": "state",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/HistoricalSessionState"
                },
                {
                  "type": "null"
                }
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HistoricalSessionsResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "List operator-launched replay/backtest sessions.",
        "tags": [
          "Historical Sessions"
        ],
        "x-required-scopes": [
          "historical_sessions:read"
        ]
      }
    },
    "/v1/historical-sessions/{backtest_run_id}": {
      "get": {
        "operationId": "getHistoricalSession",
        "parameters": [
          {
            "in": "path",
            "name": "backtest_run_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HistoricalSessionResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Get one operator-launched replay/backtest session.",
        "tags": [
          "Historical Sessions"
        ],
        "x-required-scopes": [
          "historical_sessions:read"
        ]
      }
    },
    "/v1/historical-sessions/{backtest_run_id}/trades": {
      "get": {
        "operationId": "listHistoricalSessionTrades",
        "parameters": [
          {
            "in": "path",
            "name": "backtest_run_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "before_closed_market_time",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "before_trade_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HistoricalSessionTradesResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "List backtest trades for one operator-launched historical session.",
        "tags": [
          "Historical Sessions"
        ],
        "x-required-scopes": [
          "historical_sessions:read"
        ]
      }
    },
    "/v1/launch-sessions": {
      "post": {
        "operationId": "createLaunchSession",
        "parameters": [
          {
            "description": "Optional UUID used for audit/log correlation on write requests.",
            "in": "header",
            "name": "x-noctant-request-id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateLaunchSessionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateLaunchSessionResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Create a hosted launch session for a sponsored account.",
        "tags": [
          "Launch Sessions"
        ],
        "x-required-scopes": [
          "launch_sessions:create"
        ]
      }
    },
    "/v1/launch-sessions/{launch_session_id}": {
      "get": {
        "operationId": "getLaunchSession",
        "parameters": [
          {
            "in": "path",
            "name": "launch_session_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LaunchSessionResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Get launch-session status.",
        "tags": [
          "Launch Sessions"
        ],
        "x-required-scopes": [
          "launch_sessions:read"
        ]
      }
    },
    "/v1/me": {
      "get": {
        "operationId": "getOperatorContext",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperatorContextResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Get authenticated operator context.",
        "tags": [
          "Operator"
        ],
        "x-required-scopes": []
      }
    },
    "/v1/me/rotate-api-key": {
      "post": {
        "operationId": "rotateOperatorApiKey",
        "parameters": [
          {
            "description": "Optional UUID used for audit/log correlation on write requests.",
            "in": "header",
            "name": "x-noctant-request-id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RotateOperatorApiKeyResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Rotate the authenticated operator API key.",
        "tags": [
          "Operator"
        ],
        "x-required-scopes": [
          "api_keys:rotate"
        ]
      }
    },
    "/v1/products": {
      "get": {
        "operationId": "listProducts",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductListResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "List public-contract-safe products.",
        "tags": [
          "Products"
        ],
        "x-required-scopes": [
          "products:read"
        ]
      },
      "post": {
        "operationId": "createProduct",
        "parameters": [
          {
            "description": "Optional UUID used for audit/log correlation on write requests.",
            "in": "header",
            "name": "x-noctant-request-id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateProductRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductView"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Create an operator challenge product.",
        "tags": [
          "Products"
        ],
        "x-required-scopes": [
          "products:create"
        ]
      }
    },
    "/v1/products/{product_id}": {
      "get": {
        "operationId": "getProduct",
        "parameters": [
          {
            "in": "path",
            "name": "product_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductView"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Get one public-contract-safe product.",
        "tags": [
          "Products"
        ],
        "x-required-scopes": [
          "products:read"
        ]
      }
    },
    "/v1/users": {
      "get": {
        "operationId": "getUserByExternalId",
        "parameters": [
          {
            "in": "query",
            "name": "external_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserSummary"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Lookup a user by operator external id.",
        "tags": [
          "Users"
        ],
        "x-required-scopes": [
          "users:read"
        ]
      },
      "post": {
        "operationId": "provisionUser",
        "parameters": [
          {
            "description": "Optional UUID used for audit/log correlation on write requests.",
            "in": "header",
            "name": "x-noctant-request-id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProvisionUserRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProvisionUserResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProvisionUserResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Provision or replay an operator user.",
        "tags": [
          "Users"
        ],
        "x-required-scopes": [
          "users:create"
        ]
      }
    },
    "/v1/users/{global_user_id}": {
      "get": {
        "operationId": "getUser",
        "parameters": [
          {
            "in": "path",
            "name": "global_user_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserSummary"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Lookup a provisioned user by Noctant global user id.",
        "tags": [
          "Users"
        ],
        "x-required-scopes": [
          "users:read"
        ]
      }
    },
    "/v1/users/{global_user_id}/account-corrections": {
      "get": {
        "operationId": "listAccountCorrections",
        "parameters": [
          {
            "in": "path",
            "name": "global_user_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "before_correction_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "before_requested_at",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountCorrectionsListResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "List account correction statements for a sponsored user.",
        "tags": [
          "Account Corrections"
        ],
        "x-required-scopes": [
          "account_corrections:read"
        ]
      },
      "post": {
        "operationId": "createAccountCorrection",
        "parameters": [
          {
            "in": "path",
            "name": "global_user_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Optional UUID used for audit/log correlation on write requests.",
            "in": "header",
            "name": "x-noctant-request-id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAccountBalanceCorrectionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountCorrectionResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Create an audited account balance correction.",
        "tags": [
          "Account Corrections"
        ],
        "x-required-scopes": [
          "account_corrections:create"
        ]
      }
    },
    "/v1/users/{global_user_id}/account-corrections/{correction_id}": {
      "get": {
        "operationId": "getAccountCorrection",
        "parameters": [
          {
            "in": "path",
            "name": "global_user_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "correction_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountCorrectionResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Get one account correction statement.",
        "tags": [
          "Account Corrections"
        ],
        "x-required-scopes": [
          "account_corrections:read"
        ]
      }
    },
    "/v1/users/{global_user_id}/kyc-status": {
      "post": {
        "operationId": "reportKycStatus",
        "parameters": [
          {
            "in": "path",
            "name": "global_user_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Optional UUID used for audit/log correlation on write requests.",
            "in": "header",
            "name": "x-noctant-request-id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReportKycStatusRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KycStatusResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Report KYC status for a provisioned user.",
        "tags": [
          "KYC"
        ],
        "x-required-scopes": [
          "kyc_status:write"
        ]
      }
    },
    "/v1/users/{global_user_id}/payout-requests": {
      "post": {
        "operationId": "createPayoutRequest",
        "parameters": [
          {
            "in": "path",
            "name": "global_user_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Optional UUID used for audit/log correlation on write requests.",
            "in": "header",
            "name": "x-noctant-request-id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePayoutRequestRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayoutStatementResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Create an operator-originated payout request.",
        "tags": [
          "Payouts"
        ],
        "x-required-scopes": [
          "payout_requests:create"
        ]
      }
    },
    "/v1/users/{global_user_id}/payout-requests/{payout_request_id}/approve": {
      "post": {
        "operationId": "approvePayoutRequest",
        "parameters": [
          {
            "in": "path",
            "name": "global_user_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "payout_request_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Optional UUID used for audit/log correlation on write requests.",
            "in": "header",
            "name": "x-noctant-request-id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApprovePayoutRequestRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayoutStatementResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Approve a payout request without executing account effects.",
        "tags": [
          "Payouts"
        ],
        "x-required-scopes": [
          "payout_requests:approve"
        ]
      }
    },
    "/v1/users/{global_user_id}/payout-requests/{payout_request_id}/approve-and-execute": {
      "post": {
        "operationId": "approveAndExecutePayoutRequest",
        "parameters": [
          {
            "in": "path",
            "name": "global_user_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "payout_request_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Optional UUID used for audit/log correlation on write requests.",
            "in": "header",
            "name": "x-noctant-request-id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApprovePayoutRequestRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayoutStatementResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Approve a payout request and execute account effects.",
        "tags": [
          "Payouts"
        ],
        "x-required-scopes": [
          "payout_requests:approve"
        ]
      }
    },
    "/v1/users/{global_user_id}/payout-requests/{payout_request_id}/external-settlement": {
      "patch": {
        "operationId": "updatePayoutSettlement",
        "parameters": [
          {
            "in": "path",
            "name": "global_user_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "payout_request_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Optional UUID used for audit/log correlation on write requests.",
            "in": "header",
            "name": "x-noctant-request-id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePayoutSettlementRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayoutStatementResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Update operator-owned external payout settlement state.",
        "tags": [
          "Payouts"
        ],
        "x-required-scopes": [
          "payout_settlements:write"
        ]
      }
    },
    "/v1/users/{global_user_id}/payout-requests/{payout_request_id}/reject": {
      "post": {
        "operationId": "rejectPayoutRequest",
        "parameters": [
          {
            "in": "path",
            "name": "global_user_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "payout_request_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Optional UUID used for audit/log correlation on write requests.",
            "in": "header",
            "name": "x-noctant-request-id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RejectPayoutRequestRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayoutStatementResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Reject a payout request.",
        "tags": [
          "Payouts"
        ],
        "x-required-scopes": [
          "payout_requests:reject"
        ]
      }
    },
    "/v1/users/{global_user_id}/payout-statements": {
      "get": {
        "operationId": "listPayoutStatements",
        "parameters": [
          {
            "in": "path",
            "name": "global_user_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "before_payout_request_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "before_requested_at",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayoutStatementsListResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "List payout request statements for a sponsored user.",
        "tags": [
          "Payouts"
        ],
        "x-required-scopes": [
          "payouts:read"
        ]
      }
    },
    "/v1/users/{global_user_id}/payout-statements/{payout_request_id}": {
      "get": {
        "operationId": "getPayoutStatement",
        "parameters": [
          {
            "in": "path",
            "name": "global_user_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "payout_request_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayoutStatementResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Get one payout request statement.",
        "tags": [
          "Payouts"
        ],
        "x-required-scopes": [
          "payouts:read"
        ]
      }
    },
    "/v1/users/{global_user_id}/payouts": {
      "get": {
        "operationId": "listPayouts",
        "parameters": [
          {
            "in": "path",
            "name": "global_user_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "before_event_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "before_occurred_at",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayoutsListResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "List payout cash events for a sponsored user.",
        "tags": [
          "Payouts"
        ],
        "x-required-scopes": [
          "payouts:read"
        ]
      }
    },
    "/v1/webhooks/deliveries": {
      "get": {
        "operationId": "listWebhookDeliveries",
        "parameters": [
          {
            "in": "query",
            "name": "before_attempt_number",
            "required": false,
            "schema": {
              "format": "int32",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "before_delivery_row_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "before_finished_at",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "event_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "event_type",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "int64",
              "type": [
                "integer",
                "null"
              ]
            }
          },
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/WebhookDeliveryStatus"
                },
                {
                  "type": "null"
                }
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDeliveriesResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "List webhook delivery attempts.",
        "tags": [
          "Webhooks"
        ],
        "x-required-scopes": [
          "webhook_deliveries:read"
        ]
      }
    },
    "/v1/webhooks/replays": {
      "post": {
        "operationId": "createWebhookReplay",
        "parameters": [
          {
            "description": "Optional UUID used for audit/log correlation on write requests.",
            "in": "header",
            "name": "x-noctant-request-id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWebhookReplayRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateWebhookReplayResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateWebhookReplayResponse"
                }
              }
            },
            "description": "Successful response."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Validation or malformed request."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Missing or invalid API key."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "API key lacks the required scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Resource not found in operator scope."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Conflict, idempotency mismatch, or invalid lifecycle state."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Rate limit exceeded."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object"
                }
              }
            },
            "description": "Upstream dependency unavailable."
          }
        },
        "security": [
          {
            "operatorBearerAuth": []
          }
        ],
        "summary": "Enqueue bounded webhook replay/backfill.",
        "tags": [
          "Webhooks"
        ],
        "x-required-scopes": [
          "webhooks:replay"
        ]
      }
    }
  },
  "servers": [
    {
      "description": "Current Operator API origin. SDK consumers should override `baseUrl` for server-to-server integrations.",
      "url": "/"
    }
  ]
}
