{
  "openapi": "3.0.0",
  "info": {
    "title": "Limitless Exchange API",
    "description": "Production-ready REST API for prediction market trading, portfolio management, and market data on Limitless Exchange (Base L2).",
    "version": "1.0",
    "contact": {
      "name": "API Support",
      "url": "https://limitless.exchange",
      "email": "help@limitless.network"
    }
  },
  "servers": [
    {
      "url": "https://api.limitless.exchange",
      "description": "Production API"
    }
  ],
  "tags": [
    {
      "name": "Authentication",
      "description": "User authentication and session management"
    },
    {
      "name": "Markets",
      "description": "Browse, search, and analyze prediction markets"
    },
    {
      "name": "Market Navigation",
      "description": "Navigation tree, market pages, and property filters"
    },
    {
      "name": "Trading",
      "description": "Create, manage, and cancel orders"
    },
    {
      "name": "Portfolio",
      "description": "Position tracking, trade history, and performance"
    },
    {
      "name": "API Tokens",
      "description": "Scoped API token management for partner integrations"
    },
    {
      "name": "Partner Accounts",
      "description": "Sub-account creation and allowance recovery for partner integrations"
    },
    {
      "name": "System",
      "description": "Public API state and availability information"
    },
    {
      "name": "Referral",
      "description": "Referral program earnings, referred users, and leaderboards"
    },
    {
      "name": "Leaderboard",
      "description": "Live Unrealized PnL leaderboards for open markets and biggest open positions"
    }
  ],
  "paths": {
    "/maintenance/status": {
      "get": {
        "summary": "Get maintenance status",
        "description": "Returns active and scheduled maintenance information. Use this endpoint to detect temporary trading restrictions and planned maintenance notices.",
        "operationId": "MaintenanceController_getStatus",
        "tags": [
          "System"
        ],
        "parameters": [
          {
            "name": "target",
            "in": "query",
            "required": false,
            "description": "Optional maintenance target filter. Use `trading` to return only trading-related maintenance effects.",
            "schema": {
              "type": "string",
              "enum": [
                "trading"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Maintenance status returned successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MaintenanceStatus"
                },
                "examples": {
                  "normal": {
                    "summary": "No active or scheduled maintenance",
                    "value": {
                      "active": [],
                      "scheduled": []
                    }
                  },
                  "tradingRestricted": {
                    "summary": "Trading currently cancel-only with a scheduled post-only stage",
                    "value": {
                      "active": [
                        {
                          "startsAt": "2026-06-22T15:00:00.000Z",
                          "endsAt": "2026-06-22T18:00:00.000Z",
                          "publicMessage": "Trading is temporarily limited to cancellations.",
                          "effects": [
                            {
                              "target": "trading",
                              "mode": "cancel_only"
                            }
                          ]
                        }
                      ],
                      "scheduled": [
                        {
                          "startsAt": "2026-06-22T18:00:00.000Z",
                          "endsAt": "2026-06-22T19:00:00.000Z",
                          "publicMessage": "Trading will be post-only during the next maintenance stage.",
                          "effects": [
                            {
                              "target": "trading",
                              "mode": "post_only"
                            }
                          ]
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/auth/signing-message": {
      "get": {
        "description": "Returns a signing message with a randomly generated nonce for authentication purposes.",
        "operationId": "AuthController_getSigningMessage",
        "parameters": [],
        "responses": {
          "200": {
            "description": "A signing message containing a nonce has been successfully generated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "string",
                  "example": "Welcome to Limitless.exchange! Please sign this message to verify your identity.\n\nNonce: 0xa1b2c3d4e5f67890..."
                }
              }
            }
          }
        },
        "summary": "Get signing message",
        "tags": [
          "Authentication"
        ]
      }
    },
    "/auth/verify-auth": {
      "get": {
        "description": "Verifies if the user is authenticated",
        "operationId": "AuthController_verifyAuth",
        "parameters": [],
        "responses": {
          "200": {
            "description": "User is authenticated"
          },
          "401": {
            "description": "User is not authenticated"
          }
        },
        "summary": "Verify authentication",
        "tags": [
          "Authentication"
        ]
      }
    },
    "/auth/login": {
      "post": {
        "deprecated": true,
        "description": "Deprecated. Cookie-based session login has been removed. Use API keys instead.",
        "operationId": "AuthController_login",
        "parameters": [],
        "responses": {
          "410": {
            "description": "Cookie-based session login has been removed. Use API keys instead."
          }
        },
        "summary": "User login (removed)",
        "tags": [
          "Authentication"
        ]
      }
    },
    "/auth/logout": {
      "post": {
        "description": "Logs out the user",
        "operationId": "AuthController_logout",
        "parameters": [],
        "responses": {
          "200": {
            "description": "User has been successfully logged out",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Logged out successfully"
                    }
                  }
                }
              }
            }
          }
        },
        "summary": "User logout",
        "tags": [
          "Authentication"
        ]
      }
    },
    "/auth/api-keys": {
      "post": {
        "description": "Creates a new API key for programmatic access. Only available for users authenticated via the UI (Privy). Previous active keys are automatically revoked.",
        "operationId": "ApiKeyController_createApiKey",
        "parameters": [],
        "responses": {
          "201": {
            "description": "API key created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "keyId": {
                      "type": "string",
                      "description": "Unique identifier for the API key",
                      "example": "key_abc123def456"
                    },
                    "apiKey": {
                      "type": "string",
                      "description": "The API key value. Only shown once at creation time.",
                      "example": "lmts_sk_1234567890abcdef..."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "When the key was created",
                      "example": "2025-06-15T10:30:00Z"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "API key management is only available via the UI"
          }
        },
        "summary": "Create API key",
        "tags": [
          "Authentication"
        ]
      },
      "get": {
        "description": "Returns the currently active API key metadata for the authenticated user. Does not return the key value itself.",
        "operationId": "ApiKeyController_getActiveKey",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Active API key metadata, or null if no active key exists",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "nullable": true,
                  "properties": {
                    "keyId": {
                      "type": "string",
                      "description": "Unique identifier for the API key",
                      "example": "key_abc123def456"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "When the key was created",
                      "example": "2025-06-15T10:30:00Z"
                    },
                    "lastUsedAt": {
                      "type": "string",
                      "format": "date-time",
                      "nullable": true,
                      "description": "When the key was last used",
                      "example": "2025-06-16T08:00:00Z"
                    }
                  }
                }
              }
            }
          }
        },
        "summary": "Get active API key",
        "tags": [
          "Authentication"
        ]
      },
      "delete": {
        "description": "Revokes the currently active API key. The key will immediately stop working for authentication.",
        "operationId": "ApiKeyController_revokeKey",
        "parameters": [],
        "responses": {
          "200": {
            "description": "API key revoked successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "API key revoked successfully"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "No active API key found"
          },
          "403": {
            "description": "API key management is only available via the UI"
          }
        },
        "summary": "Revoke API key",
        "tags": [
          "Authentication"
        ]
      }
    },
    "/markets/active/{categoryId}": {
      "get": {
        "description": "Retrieves markets and groups that are active and not yet resolved, with optional category filtering",
        "operationId": "MarketController_getActiveMarkets[0]",
        "parameters": [
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Page number for pagination",
            "schema": {
              "example": 1,
              "type": "number"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Number of items per page",
            "schema": {
              "example": 10,
              "type": "number"
            }
          },
          {
            "name": "sortBy",
            "required": false,
            "in": "query",
            "description": "Sort by query parameter",
            "schema": {
              "example": "newest",
              "type": "string"
            }
          },
          {
            "name": "tradeType",
            "required": false,
            "in": "query",
            "description": "Filter by trade type (amm, clob, or group)",
            "schema": {
              "enum": [
                "amm",
                "clob",
                "group"
              ],
              "type": "string"
            }
          },
          {
            "name": "automationType",
            "required": false,
            "in": "query",
            "description": "Filter by automation type (manual, lumy, or sports)",
            "schema": {
              "enum": [
                "manual",
                "lumy",
                "sports"
              ],
              "type": "string"
            }
          },
          {
            "name": "categoryId",
            "required": false,
            "in": "path",
            "description": "Filter markets by category ID",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Active markets and groups with volume and liquidity data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowseActiveMarketsResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Server error when retrieving markets data"
          }
        },
        "summary": "Browse Active Markets",
        "tags": [
          "Markets"
        ]
      }
    },
    "/markets/active": {
      "get": {
        "description": "Retrieves markets and groups that are active and not yet resolved, with optional category filtering",
        "operationId": "MarketController_getActiveMarkets[1]",
        "parameters": [
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Page number for pagination",
            "schema": {
              "example": 1,
              "type": "number"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Number of items per page",
            "schema": {
              "example": 10,
              "type": "number"
            }
          },
          {
            "name": "sortBy",
            "required": false,
            "in": "query",
            "description": "Sort by query parameter",
            "schema": {
              "example": "newest",
              "type": "string"
            }
          },
          {
            "name": "tradeType",
            "required": false,
            "in": "query",
            "description": "Filter by trade type (amm, clob, or group)",
            "schema": {
              "enum": [
                "amm",
                "clob",
                "group"
              ],
              "type": "string"
            }
          },
          {
            "name": "automationType",
            "required": false,
            "in": "query",
            "description": "Filter by automation type (manual, lumy, or sports)",
            "schema": {
              "enum": [
                "manual",
                "lumy",
                "sports"
              ],
              "type": "string"
            }
          },
          {
            "name": "categoryId",
            "required": false,
            "in": "path",
            "description": "Filter markets by category ID",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Active markets and groups with volume and liquidity data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowseActiveMarketsResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Server error when retrieving markets data"
          }
        },
        "summary": "Browse Active Markets",
        "tags": [
          "Markets"
        ]
      }
    },
    "/markets/categories/count": {
      "get": {
        "description": "Returns the number of active markets for each category and the total market count",
        "operationId": "MarketController_getActiveMarketCountPerCategory",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Object containing category counts and total count",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CategoryCountResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Server error when retrieving category count data"
          }
        },
        "summary": "Get active market count per category",
        "tags": [
          "Markets"
        ]
      }
    },
    "/markets/active/slugs": {
      "get": {
        "description": "Retrieves slugs, strike prices, tickers, and deadlines for all active markets and groups. Group markets are nested under their parent group.",
        "operationId": "MarketController_getActiveSlugs",
        "parameters": [],
        "responses": {
          "200": {
            "description": "List of active market and group slugs with metadata",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "slug": {
                        "type": "string",
                        "description": "Market or group slug identifier",
                        "example": "btc-price-prediction-2024"
                      },
                      "strikePrice": {
                        "type": "string",
                        "nullable": true,
                        "description": "Strike price (null for groups)",
                        "example": "50000"
                      },
                      "ticker": {
                        "type": "string",
                        "nullable": true,
                        "description": "Asset ticker symbol",
                        "example": "BTC"
                      },
                      "deadline": {
                        "type": "string",
                        "nullable": true,
                        "format": "date-time",
                        "description": "Expiration deadline",
                        "example": "2024-12-31T23:59:59Z"
                      },
                      "markets": {
                        "type": "array",
                        "nullable": true,
                        "description": "Nested markets (group entries only)",
                        "items": {
                          "type": "object",
                          "properties": {
                            "slug": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    },
                    "required": [
                      "slug"
                    ]
                  }
                }
              }
            }
          },
          "500": {
            "description": "Server error when retrieving market slugs"
          }
        },
        "summary": "Get active market slugs with metadata",
        "tags": [
          "Markets"
        ]
      }
    },
    "/markets/{addressOrSlug}": {
      "get": {
        "description": "Retrieves market or group data using either an Ethereum address or a slug identifier",
        "operationId": "MarketController_find",
        "parameters": [
          {
            "name": "addressOrSlug",
            "required": true,
            "in": "path",
            "description": "Market/group address (0x...) or slug identifier (my-market-name)",
            "schema": {
              "example": "crypto-predictions-2025"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Market or group details with pricing and volume data",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ClobMarketResponseDto",
                      "description": "CLOB market with position IDs and trading data"
                    },
                    {
                      "$ref": "#/components/schemas/NegRiskGroupResponseDto",
                      "description": "NegRisk group with nested markets array"
                    },
                    {
                      "$ref": "#/components/schemas/AmmMarketResponseDto",
                      "description": "AMM market with liquidity and volume data"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Market or group not found"
          },
          "500": {
            "description": "Server error when retrieving market/group data"
          }
        },
        "summary": "Get Market Details",
        "tags": [
          "Markets"
        ]
      }
    },
    "/markets/{addressOrSlug}/oracle-candles": {
      "get": {
        "description": "Returns Chainlink candlestick data for markets configured with Chainlink Data Streams chart metadata. Useful for charting the underlying oracle price alongside prediction market prices.",
        "operationId": "MarketController_getOracleCandles",
        "parameters": [
          {
            "name": "addressOrSlug",
            "required": true,
            "in": "path",
            "description": "Market address (0x...) or slug identifier",
            "schema": {
              "type": "string",
              "example": "btc-above-100k-june"
            }
          },
          {
            "name": "interval",
            "required": false,
            "in": "query",
            "description": "Candlestick interval",
            "schema": {
              "type": "string",
              "enum": [
                "1m",
                "5m",
                "15m",
                "1h",
                "4h",
                "1d"
              ],
              "default": "1m"
            }
          },
          {
            "name": "from",
            "required": false,
            "in": "query",
            "description": "Start timestamp in UNIX seconds. Defaults to market creation time minus 15 minutes.",
            "schema": {
              "type": "number",
              "example": 1719792000
            }
          },
          {
            "name": "to",
            "required": false,
            "in": "query",
            "description": "End timestamp in UNIX seconds. Defaults to now.",
            "schema": {
              "type": "number",
              "example": 1719878400
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Candlestick data for the underlying oracle",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "interval": {
                      "type": "string",
                      "description": "The requested candlestick interval",
                      "example": "1h"
                    },
                    "source": {
                      "type": "string",
                      "description": "Data source identifier",
                      "example": "chainlink"
                    },
                    "symbol": {
                      "type": "string",
                      "description": "The resolved Chainlink symbol",
                      "example": "BTC/USD"
                    },
                    "timestampStart": {
                      "type": "number",
                      "description": "Start of the data range (UNIX seconds)",
                      "example": 1719792000
                    },
                    "timestampEnd": {
                      "type": "number",
                      "description": "End of the data range (UNIX seconds)",
                      "example": 1719878400
                    },
                    "rows": {
                      "type": "array",
                      "description": "Array of OHLCV candlestick rows",
                      "items": {
                        "type": "object",
                        "properties": {
                          "timestamp": {
                            "type": "number",
                            "description": "Candle open time (UNIX seconds)"
                          },
                          "open": {
                            "type": "number",
                            "description": "Opening price"
                          },
                          "high": {
                            "type": "number",
                            "description": "Highest price"
                          },
                          "low": {
                            "type": "number",
                            "description": "Lowest price"
                          },
                          "close": {
                            "type": "number",
                            "description": "Closing price"
                          },
                          "volume": {
                            "type": "number",
                            "description": "Trading volume"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid interval, time range, or market does not have Chainlink oracle configured"
          },
          "404": {
            "description": "Market not found"
          },
          "502": {
            "description": "Failed to fetch data from Chainlink"
          }
        },
        "summary": "Get oracle candlesticks",
        "tags": [
          "Markets"
        ]
      }
    },
    "/markets/{slug}/get-feed-events": {
      "get": {
        "description": "Retrieves the latest feed events related to a specific market with pagination support",
        "operationId": "MarketController_getFeedEvent",
        "parameters": [
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Page number for pagination",
            "schema": {
              "example": 1,
              "type": "number"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Number of events per page",
            "schema": {
              "example": 10,
              "type": "number"
            }
          },
          {
            "name": "slug",
            "required": false,
            "in": "path",
            "description": "Slug of the market",
            "schema": {
              "example": "my-market-slug-123"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of feed events for the market",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FeedEventsResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Server error when retrieving feed events"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "summary": "Get feed events for a market",
        "tags": [
          "Markets"
        ]
      }
    },
    "/markets/{slug}/historical-price": {
      "get": {
        "description": "Retrieve historical price data for a specific market with configurable time intervals",
        "operationId": "MarketOrderbookController_getHistoricalPrice",
        "parameters": [
          {
            "name": "to",
            "required": false,
            "in": "query",
            "description": "End date for historical data",
            "schema": {
              "example": "2024-01-31T23:59:59Z"
            }
          },
          {
            "name": "from",
            "required": false,
            "in": "query",
            "description": "Start date for historical data",
            "schema": {
              "example": "2024-01-01T00:00:00Z"
            }
          },
          {
            "name": "interval",
            "required": false,
            "in": "query",
            "description": "Time interval for data points",
            "schema": {
              "enum": [
                "1h",
                "6h",
                "1d",
                "1w",
                "1m",
                "all"
              ],
              "type": "string"
            }
          },
          {
            "name": "slug",
            "required": true,
            "in": "path",
            "description": "Market slug identifier",
            "schema": {
              "example": "presidential-election-2024"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Historical price data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string",
                        "example": "YES Token"
                      },
                      "prices": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "price": {
                              "type": "number",
                              "example": 0.75
                            },
                            "timestamp": {
                              "type": "string",
                              "example": "2024-01-15T10:30:00Z"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "summary": "Get Historical Prices",
        "tags": [
          "Trading"
        ]
      }
    },
    "/markets/{slug}/orderbook": {
      "get": {
        "description": "Retrieve the current orderbook for a market showing all open buy and sell orders",
        "operationId": "MarketOrderbookController_getOrderbook",
        "parameters": [
          {
            "name": "slug",
            "required": true,
            "in": "path",
            "description": "Market slug identifier",
            "schema": {
              "example": "presidential-election-2024"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current orderbook with bids and asks",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "adjustedMidpoint": {
                      "type": "number",
                      "example": 0.75
                    },
                    "asks": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "price": {
                            "type": "number",
                            "example": 0.76
                          },
                          "size": {
                            "type": "number",
                            "example": 100
                          }
                        }
                      }
                    },
                    "bids": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "price": {
                            "type": "number",
                            "example": 0.74
                          },
                          "size": {
                            "type": "number",
                            "example": 150
                          }
                        }
                      }
                    },
                    "lastTradePrice": {
                      "type": "number",
                      "example": 0.75
                    },
                    "maxSpread": {
                      "type": "number",
                      "example": 0.05
                    },
                    "minSize": {
                      "type": "number",
                      "example": 1
                    },
                    "tokenId": {
                      "type": "string",
                      "example": "19633204485790857949828516737993423758628930235371629943999544859324645414627"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Market does not support orderbook (AMM market)"
          },
          "404": {
            "description": "Market not found"
          }
        },
        "summary": "Get Orderbook",
        "tags": [
          "Trading"
        ]
      }
    },
    "/markets/{slug}/locked-balance": {
      "get": {
        "description": "Get the amount of funds locked in open orders for the authenticated user",
        "operationId": "MarketOrderbookController_getLockedBalance",
        "parameters": [
          {
            "name": "slug",
            "required": true,
            "in": "path",
            "description": "Market slug identifier",
            "schema": {
              "example": "presidential-election-2024"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "User's locked balance details",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "lockedBalance": {
                      "type": "string",
                      "example": "250.50"
                    },
                    "lockedBalanceFormatted": {
                      "type": "string",
                      "example": "250.50 USDC"
                    },
                    "currency": {
                      "type": "string",
                      "example": "USDC"
                    },
                    "orderCount": {
                      "type": "number",
                      "example": 3
                    }
                  }
                }
              }
            }
          }
        },
        "summary": "Get Locked Balance",
        "tags": [
          "Trading"
        ]
      }
    },
    "/markets/{slug}/user-orders": {
      "get": {
        "description": "Get all orders placed by the authenticated user for a specific market",
        "operationId": "MarketOrderbookController_getUserOrders",
        "parameters": [
          {
            "name": "statuses",
            "required": false,
            "in": "query",
            "description": "Order status(es) to filter by. Defaults to [LIVE] if not provided",
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "LIVE",
                  "MATCHED",
                  "CANCELED",
                  "UNMATCHED"
                ]
              }
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of orders to return",
            "schema": {
              "minimum": 1,
              "example": 100,
              "type": "number"
            }
          },
          {
            "name": "slug",
            "required": true,
            "in": "path",
            "description": "Market slug identifier",
            "schema": {
              "example": "presidential-election-2024"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of user orders for the market",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orders": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "example": "12345"
                          },
                          "side": {
                            "type": "string",
                            "example": "BUY"
                          },
                          "price": {
                            "type": "string",
                            "example": "0.75"
                          },
                          "quantity": {
                            "type": "string",
                            "example": "100"
                          },
                          "status": {
                            "type": "string",
                            "example": "LIVE"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "summary": "User Orders",
        "tags": [
          "Trading"
        ]
      }
    },
    "/markets/{slug}/events": {
      "get": {
        "description": "Get recent events for a specific market including trades, orders, and liquidity changes",
        "operationId": "MarketOrderbookController_getMarketEvents",
        "parameters": [
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Page number for pagination",
            "schema": {
              "example": 1,
              "type": "number"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Number of events per page",
            "schema": {
              "example": 20,
              "type": "number"
            }
          },
          {
            "name": "slug",
            "required": true,
            "in": "path",
            "description": "Market slug identifier",
            "schema": {
              "example": "presidential-election-2024"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of market events",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "example": "event-123"
                          },
                          "type": {
                            "type": "string",
                            "example": "ORDER_PLACED"
                          },
                          "timestamp": {
                            "type": "string",
                            "example": "2024-01-15T10:30:00Z"
                          },
                          "data": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "summary": "Market Events",
        "tags": [
          "Trading"
        ]
      }
    },
    "/markets/search": {
      "get": {
        "operationId": "MarketSearchController_search",
        "parameters": [
          {
            "name": "query",
            "required": true,
            "in": "query",
            "description": "Search query text",
            "schema": {
              "example": "Sports betting markets with high odds",
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of results to return",
            "schema": {
              "default": 10,
              "example": 10,
              "type": "number"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Number of page",
            "schema": {
              "default": 1,
              "example": 0,
              "type": "number"
            }
          },
          {
            "name": "similarityThreshold",
            "required": false,
            "in": "query",
            "description": "Minimum similarity score (0-1)",
            "schema": {
              "default": 0.5,
              "example": 0.5,
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns markets matching the search query"
          },
          "400": {
            "description": "Invalid request parameters"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "summary": "Search for markets based on semantic similarity",
        "tags": [
          "Markets"
        ]
      }
    },
    "/portfolio/trades": {
      "get": {
        "description": "Retrieve all AMM trades executed by the authenticated user",
        "operationId": "PortfolioController_getTrades",
        "parameters": [],
        "responses": {
          "200": {
            "description": "List of user trades with details",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/HistoryTradeDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "summary": "Get Trades",
        "tags": [
          "Portfolio"
        ]
      }
    },
    "/portfolio/positions": {
      "get": {
        "description": "Retrieve all active positions with P&L calculations and market values",
        "operationId": "PortfolioController_getPositions",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Complete portfolio positions with summary",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortfolioPositionsDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "summary": "Get Positions",
        "tags": [
          "Portfolio"
        ]
      }
    },
    "/portfolio/pnl-chart": {
      "get": {
        "description": "Hybrid PnL: realised series + current total snapshot",
        "operationId": "PortfolioController_getPnlChart",
        "parameters": [
          {
            "name": "timeframe",
            "required": false,
            "in": "query",
            "description": "Timeframe window for percent change and chart series",
            "schema": {
              "example": "7d",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "PnL chart data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortfolioPnlChartDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "summary": "Get portfolio PnL chart",
        "tags": [
          "Portfolio"
        ]
      }
    },
    "/portfolio/history": {
      "get": {
        "description": "Paginated history including AMM, CLOB trades, splits/merges, NegRisk conversions. Partner API tokens with `delegated_signing` scope may read a sub-account by sending the `x-on-behalf-of: <profileId>` header.",
        "operationId": "PortfolioController_getHistory",
        "parameters": [
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Opaque cursor for cursor-based pagination. Omit for first page. For subsequent pages, pass the `nextCursor` value from the previous response.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Number of items per page (1-100).",
            "schema": {
              "example": 20,
              "default": 20,
              "minimum": 1,
              "maximum": 100,
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated history of all user actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HistoryResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid pagination parameters"
          },
          "401": {
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "summary": "Get History",
        "tags": [
          "Portfolio"
        ]
      }
    },
    "/portfolio/points": {
      "get": {
        "operationId": "PortfolioController_getPointsBreakdown",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Points breakdown"
          },
          "401": {
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "summary": "Get points breakdown",
        "tags": [
          "Portfolio"
        ]
      }
    },
    "/portfolio/{account}/traded-volume": {
      "get": {
        "description": "Get total traded volume for a specific user. Returns combined CLOB and AMM volume (both taker and maker sides) in whole USDC. This is the all-time cumulative trading volume, not the current portfolio value.",
        "operationId": "PublicPortfolioController_tradedVolume",
        "parameters": [
          {
            "name": "account",
            "required": true,
            "in": "path",
            "description": "User Ethereum address",
            "schema": {
              "example": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "User trading volume",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "string",
                      "description": "Total traded volume in whole USDC (no decimal divisor needed). Includes both taker and maker volume across CLOB and AMM trades.",
                      "example": "9702853"
                    }
                  }
                }
              }
            }
          }
        },
        "summary": "User Total Volume",
        "tags": [
          "Public Portfolio"
        ]
      }
    },
    "/portfolio/{account}/positions": {
      "get": {
        "description": "Retrieve all positions for a specific user address",
        "operationId": "PublicPortfolioController_getPositions",
        "parameters": [
          {
            "name": "account",
            "required": true,
            "in": "path",
            "description": "User Ethereum address",
            "schema": {
              "example": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Complete list of user positions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortfolioPositionsDto"
                }
              }
            }
          }
        },
        "summary": "Get All User Positions",
        "tags": [
          "Public Portfolio"
        ]
      }
    },
    "/portfolio/{account}/pnl-chart": {
      "get": {
        "description": "Hybrid PnL: realised series + current total snapshot",
        "operationId": "PublicPortfolioController_getPnlChart",
        "parameters": [
          {
            "name": "account",
            "required": true,
            "in": "path",
            "description": "User Ethereum address",
            "schema": {
              "example": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
              "type": "string"
            }
          },
          {
            "name": "timeframe",
            "required": false,
            "in": "query",
            "description": "Timeframe window for percent change and chart series",
            "schema": {
              "example": "7d",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "PnL chart data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortfolioPnlChartDto"
                }
              }
            }
          }
        },
        "summary": "Get portfolio PnL chart (public)",
        "tags": [
          "Public Portfolio"
        ]
      }
    },
    "/portfolio/trading/allowance": {
      "get": {
        "description": "Check USDC allowance for CLOB or NegRisk trading contracts",
        "operationId": "TradingPortfolioController_getAllowance",
        "parameters": [
          {
            "name": "type",
            "required": true,
            "in": "query",
            "description": "Trading type: CLOB or NegRisk",
            "schema": {
              "enum": [
                "clob",
                "negrisk"
              ],
              "type": "string"
            }
          },
          {
            "name": "spender",
            "required": false,
            "in": "query",
            "description": "Optional spender address override (e.g., venue exchange address)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "User allowance information",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "allowance": {
                      "type": "string",
                      "example": "1000000000000"
                    },
                    "hasMinimumAllowance": {
                      "type": "boolean",
                      "example": true
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "clob",
                        "negrisk"
                      ],
                      "example": "clob"
                    },
                    "spender": {
                      "type": "string",
                      "example": "0x..."
                    },
                    "checkedAddress": {
                      "type": "string",
                      "example": "0x..."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid type parameter"
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Profile not found"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "summary": "Get User Trading Allowance",
        "tags": [
          "Portfolio"
        ]
      }
    },
    "/navigation": {
      "get": {
        "description": "Returns the hierarchical navigation structure for market pages",
        "operationId": "MarketNavigationController_getNavigationTree",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Navigation tree retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/NavigationNodeDto"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "summary": "Get navigation tree",
        "tags": [
          "Market Navigation"
        ]
      }
    },
    "/market-pages/by-path": {
      "get": {
        "description": "Resolves a URL path to a market page with its configuration, filters, and breadcrumb",
        "operationId": "MarketNavigationController_byPath",
        "parameters": [
          {
            "name": "path",
            "required": true,
            "in": "query",
            "description": "URL path to resolve (e.g., \"/sports/football\")",
            "schema": {
              "example": "/sports/football",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Market page resolved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MarketPageByPathResponseDto"
                }
              }
            }
          },
          "301": {
            "description": "Path has been redirected to a new location"
          },
          "400": {
            "description": "Invalid or missing path",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "404": {
            "description": "Market page not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "summary": "Get market page by path",
        "tags": [
          "Market Navigation"
        ]
      }
    },
    "/market-pages/{id}/markets": {
      "get": {
        "description": "Returns paginated list of markets for a specific market page with filtering and sorting",
        "operationId": "MarketNavigationController_listMarkets",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Market page ID",
            "schema": {
              "example": "123e4567-e89b-12d3-a456-426614174000",
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "Cursor token for cursor-based pagination (cannot be used with page)",
            "schema": {}
          },
          {
            "name": "sort",
            "required": false,
            "in": "query",
            "description": "Sort field with optional - prefix for descending (e.g., -updatedAt, createdAt, deadline)",
            "schema": {
              "example": "-updatedAt"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Number of items per page (max 100)",
            "schema": {
              "example": 20
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "description": "Page number for offset pagination (cannot be used with cursor)",
            "schema": {
              "example": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Markets retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListMarketsResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or pagination mode conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "summary": "List markets for a page",
        "tags": [
          "Market Navigation"
        ]
      }
    },
    "/property-keys": {
      "get": {
        "description": "Returns all property keys with their options, sorted by slug",
        "operationId": "MarketNavigationController_listPropertyKeys",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Property keys retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PropertyKeyResponseDto"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "summary": "List property keys",
        "tags": [
          "Market Navigation"
        ]
      }
    },
    "/property-keys/{id}": {
      "get": {
        "description": "Returns a specific property key with its options",
        "operationId": "MarketNavigationController_getPropertyKey",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Property key ID",
            "schema": {
              "example": "123e4567-e89b-12d3-a456-426614174000",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Property key retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PropertyKeyResponseDto"
                }
              }
            }
          },
          "404": {
            "description": "Property key not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "summary": "Get property key by ID",
        "tags": [
          "Market Navigation"
        ]
      }
    },
    "/property-keys/{id}/options": {
      "get": {
        "description": "Returns options for a specific property key, optionally filtered by parent option",
        "operationId": "MarketNavigationController_listPropertyOptions",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Property key ID",
            "schema": {
              "example": "123e4567-e89b-12d3-a456-426614174000",
              "type": "string"
            }
          },
          {
            "name": "parentId",
            "required": false,
            "in": "query",
            "description": "Parent option ID for hierarchical filtering",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Property options retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PropertyOptionResponseDto"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid property key ID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          }
        },
        "summary": "List property options",
        "tags": [
          "Market Navigation"
        ]
      }
    },
    "/orders": {
      "post": {
        "description": "Creates a buy/sell order for prediction market positions. Requires signed order data.",
        "operationId": "OrderController_createOrder",
        "parameters": [],
        "requestBody": {
          "required": true,
          "description": "Order creation data including signature and order parameters",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOrderDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Order successfully created and matched",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid order data, insufficient balance/allowance, or market deadline passed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "User not authenticated"
          },
          "425": {
            "description": "Receive-window check failed, or order creation is temporarily limited by maintenance mode. Receive-window responses do not include a trading-mode `code`; maintenance responses do.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponseDto"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "example": "cancel_only_mode"
                        },
                        "message": {
                          "type": "string",
                          "example": "Trading is currently cancel-only. New orders are not accepted, but cancels are allowed."
                        },
                        "mode": {
                          "type": "string",
                          "enum": [
                            "post_only",
                            "cancel_only",
                            "disabled"
                          ],
                          "example": "cancel_only"
                        },
                        "resumeAt": {
                          "type": "string",
                          "format": "date-time",
                          "nullable": true,
                          "example": "2026-06-22T18:00:00.000Z"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "mode"
                      ]
                    }
                  ]
                },
                "examples": {
                  "receiveWindowExpired": {
                    "summary": "Signed order payload is stale",
                    "value": {
                      "message": "order receive window expired: elapsed=2500ms, window=1500ms"
                    }
                  },
                  "postOnlyMode": {
                    "summary": "Regular order blocked during post-only mode",
                    "value": {
                      "code": "post_only_mode",
                      "message": "Trading is currently post-only. Only post-only orders and cancels are allowed.",
                      "mode": "post_only",
                      "resumeAt": "2026-06-22T18:00:00.000Z"
                    }
                  },
                  "cancelOnlyMode": {
                    "summary": "New order blocked during cancel-only mode",
                    "value": {
                      "code": "cancel_only_mode",
                      "message": "Trading is currently cancel-only. New orders are not accepted, but cancels are allowed.",
                      "mode": "cancel_only",
                      "resumeAt": "2026-06-22T18:00:00.000Z"
                    }
                  },
                  "tradingDisabled": {
                    "summary": "Order creation blocked while trading is disabled",
                    "value": {
                      "code": "trading_disabled",
                      "message": "Trading is currently disabled.",
                      "mode": "disabled",
                      "resumeAt": "2026-06-22T18:00:00.000Z"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Server error during order creation"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "summary": "Create Order",
        "tags": [
          "Trading"
        ]
      }
    },
    "/orders/cancel-replace": {
      "post": {
        "summary": "Cancel an order and place a replacement non-atomically",
        "description": "Cancels one order and conditionally submits a replacement. Cancellation and replacement have independent outcomes.",
        "operationId": "OrderController_cancelReplace",
        "tags": [
          "Trading"
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelReplaceDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Cancellation and replacement both succeeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelReplaceResponseDto"
                },
                "example": {
                  "cancel": {
                    "status": "SUCCESS",
                    "orderId": "6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203",
                    "clientOrderId": "old-order-001"
                  },
                  "replacement": {
                    "status": "SUCCESS",
                    "data": {
                      "order": {
                        "id": "9e31c452-8a2b-42d1-b327-65f18d07dc96",
                        "salt": "1778155025318314496",
                        "maker": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
                        "signer": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
                        "taker": "0x0000000000000000000000000000000000000000",
                        "tokenId": "19633204485790857949828516737993423758628930235371629943999544859324645414627",
                        "makerAmount": "5000000",
                        "takerAmount": "10000000",
                        "expiration": "0",
                        "signatureType": 0,
                        "nonce": "0",
                        "feeRateBps": 0,
                        "signature": "0x1234",
                        "orderType": "GTC",
                        "price": "0.5",
                        "side": 0,
                        "marketId": "7348",
                        "ownerId": 12345,
                        "createdAt": "2026-08-05T12:00:00.000Z",
                        "updatedAt": "2026-08-05T12:00:00.000Z",
                        "market": {
                          "id": 7348,
                          "slug": "btc-100k",
                          "title": "Will Bitcoin reach $100k?",
                          "status": "FUNDED",
                          "yesPositionId": "19633204485790857949828516737993423758628930235371629943999544859324645414627",
                          "noPositionId": "34633204485790857949828516737993423758628930235371629943999544859324645414627"
                        }
                      },
                      "makerMatches": [],
                      "execution": {
                        "matched": false,
                        "settlementStatus": "UNMATCHED",
                        "clientOrderId": "replacement-001",
                        "feeRateBps": 0,
                        "effectiveFeeBps": 0,
                        "totalsRaw": {
                          "contractsGross": "0",
                          "contractsFee": "0",
                          "contractsNet": "0",
                          "usdGross": "0",
                          "usdFee": "0",
                          "usdNet": "0"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or replacement preflight failed"
          },
          "401": {
            "description": "Authentication failed or caller is not authorized to cancel the order"
          },
          "403": {
            "description": "Required scope or delegated-owner authorization is missing"
          },
          "404": {
            "description": "A required preflight resource was not found"
          },
          "409": {
            "description": "Cancellation or replacement did not succeed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelReplaceResponseDto"
                },
                "examples": {
                  "stopOnFailure": {
                    "summary": "Cancellation failed and replacement was not attempted",
                    "value": {
                      "cancel": {
                        "status": "FAILURE",
                        "error": {
                          "code": "ORDER_NOT_FOUND",
                          "message": "Order not found"
                        }
                      },
                      "replacement": {
                        "status": "NOT_ATTEMPTED"
                      }
                    }
                  },
                  "allowFailure": {
                    "summary": "Cancellation failed but replacement was accepted",
                    "value": {
                      "cancel": {
                        "status": "FAILURE",
                        "error": {
                          "code": "ORDER_NOT_FOUND",
                          "message": "Order not found"
                        }
                      },
                      "replacement": {
                        "status": "SUCCESS",
                        "data": {
                          "order": {
                            "id": "9e31c452-8a2b-42d1-b327-65f18d07dc96",
                            "salt": "1778155025318314496",
                            "maker": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
                            "signer": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
                            "taker": "0x0000000000000000000000000000000000000000",
                            "tokenId": "19633204485790857949828516737993423758628930235371629943999544859324645414627",
                            "makerAmount": "5000000",
                            "takerAmount": "10000000",
                            "expiration": "0",
                            "signatureType": 0,
                            "nonce": "0",
                            "feeRateBps": 0,
                            "signature": "0x1234",
                            "orderType": "GTC",
                            "price": "0.5",
                            "side": 0,
                            "marketId": "7348",
                            "ownerId": 12345,
                            "createdAt": "2026-08-05T12:00:00.000Z",
                            "updatedAt": "2026-08-05T12:00:00.000Z",
                            "market": {
                              "id": 7348,
                              "slug": "btc-100k",
                              "title": "Will Bitcoin reach $100k?",
                              "status": "FUNDED",
                              "yesPositionId": "19633204485790857949828516737993423758628930235371629943999544859324645414627",
                              "noPositionId": "34633204485790857949828516737993423758628930235371629943999544859324645414627"
                            }
                          },
                          "makerMatches": [],
                          "execution": {
                            "matched": false,
                            "settlementStatus": "UNMATCHED",
                            "clientOrderId": "replacement-001",
                            "feeRateBps": 0,
                            "effectiveFeeBps": 0,
                            "totalsRaw": {
                              "contractsGross": "0",
                              "contractsFee": "0",
                              "contractsNet": "0",
                              "usdGross": "0",
                              "usdFee": "0",
                              "usdNet": "0"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "425": {
            "description": "Replacement receive-window check failed or trading mode blocks the replacement"
          },
          "500": {
            "description": "Unexpected server error"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ]
      }
    },
    "/orders/cancel-replace/batch": {
      "post": {
        "summary": "Cancel and replace orders sequentially and non-atomically",
        "description": "After request-wide preflight, processes cancel-and-replace operations with independent results and preserves their input indexes.",
        "operationId": "OrderController_cancelReplaceBatch",
        "tags": [
          "Trading"
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelReplaceBatchDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Every operation has successful cancellation and replacement statuses",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelReplaceBatchResponseDto"
                },
                "example": {
                  "results": [
                    {
                      "index": 0,
                      "cancel": {
                        "status": "SUCCESS",
                        "orderId": "6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203"
                      },
                      "replacement": {
                        "status": "SUCCESS",
                        "data": {
                          "order": {
                            "id": "9e31c452-8a2b-42d1-b327-65f18d07dc96",
                            "salt": "1778155025318314496",
                            "maker": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
                            "signer": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
                            "taker": "0x0000000000000000000000000000000000000000",
                            "tokenId": "19633204485790857949828516737993423758628930235371629943999544859324645414627",
                            "makerAmount": "5000000",
                            "takerAmount": "10000000",
                            "expiration": "0",
                            "signatureType": 0,
                            "nonce": "0",
                            "feeRateBps": 0,
                            "signature": "0x1234",
                            "orderType": "GTC",
                            "price": "0.5",
                            "side": 0,
                            "marketId": "7348",
                            "ownerId": 12345,
                            "createdAt": "2026-08-05T12:00:00.000Z",
                            "updatedAt": "2026-08-05T12:00:00.000Z",
                            "market": {
                              "id": 7348,
                              "slug": "btc-100k",
                              "title": "Will Bitcoin reach $100k?",
                              "status": "FUNDED",
                              "yesPositionId": "19633204485790857949828516737993423758628930235371629943999544859324645414627",
                              "noPositionId": "34633204485790857949828516737993423758628930235371629943999544859324645414627"
                            }
                          },
                          "makerMatches": [],
                          "execution": {
                            "matched": false,
                            "settlementStatus": "UNMATCHED",
                            "clientOrderId": "replacement-101",
                            "feeRateBps": 0,
                            "effectiveFeeBps": 0,
                            "totalsRaw": {
                              "contractsGross": "0",
                              "contractsFee": "0",
                              "contractsNet": "0",
                              "usdGross": "0",
                              "usdFee": "0",
                              "usdNet": "0"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "207": {
            "description": "At least one operation has a non-success cancellation or replacement status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelReplaceBatchResponseDto"
                },
                "example": {
                  "results": [
                    {
                      "index": 0,
                      "cancel": {
                        "status": "SUCCESS",
                        "orderId": "6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203"
                      },
                      "replacement": {
                        "status": "SUCCESS",
                        "data": {
                          "order": {
                            "id": "9e31c452-8a2b-42d1-b327-65f18d07dc96",
                            "salt": "1778155025318314496",
                            "maker": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
                            "signer": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
                            "taker": "0x0000000000000000000000000000000000000000",
                            "tokenId": "19633204485790857949828516737993423758628930235371629943999544859324645414627",
                            "makerAmount": "5000000",
                            "takerAmount": "10000000",
                            "expiration": "0",
                            "signatureType": 0,
                            "nonce": "0",
                            "feeRateBps": 0,
                            "signature": "0x1234",
                            "orderType": "GTC",
                            "price": "0.5",
                            "side": 0,
                            "marketId": "7348",
                            "ownerId": 12345,
                            "createdAt": "2026-08-05T12:00:00.000Z",
                            "updatedAt": "2026-08-05T12:00:00.000Z",
                            "market": {
                              "id": 7348,
                              "slug": "btc-100k",
                              "title": "Will Bitcoin reach $100k?",
                              "status": "FUNDED",
                              "yesPositionId": "19633204485790857949828516737993423758628930235371629943999544859324645414627",
                              "noPositionId": "34633204485790857949828516737993423758628930235371629943999544859324645414627"
                            }
                          },
                          "makerMatches": [],
                          "execution": {
                            "matched": false,
                            "settlementStatus": "UNMATCHED",
                            "clientOrderId": "replacement-101",
                            "feeRateBps": 0,
                            "effectiveFeeBps": 0,
                            "totalsRaw": {
                              "contractsGross": "0",
                              "contractsFee": "0",
                              "contractsNet": "0",
                              "usdGross": "0",
                              "usdFee": "0",
                              "usdNet": "0"
                            }
                          }
                        }
                      }
                    },
                    {
                      "index": 1,
                      "cancel": {
                        "status": "FAILURE",
                        "error": {
                          "code": "ORDER_NOT_FOUND",
                          "message": "Order not found"
                        }
                      },
                      "replacement": {
                        "status": "FAILURE",
                        "error": {
                          "code": "400",
                          "message": "Insufficient balance"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid batch, duplicate target or replacement clientOrderId, or replacement preflight failed"
          },
          "401": {
            "description": "Authentication failed or caller is not authorized to cancel an order"
          },
          "403": {
            "description": "Required scope or delegated-owner authorization is missing"
          },
          "404": {
            "description": "A required preflight resource was not found"
          },
          "425": {
            "description": "A replacement receive-window check failed or trading mode blocks a replacement"
          },
          "500": {
            "description": "Unexpected server error"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ]
      }
    },
    "/orders/status/batch": {
      "post": {
        "description": "Fetches historical order statuses for multiple orders by internal order IDs and/or client-provided order IDs. Returns execution details, settlement status, and maker match data for each order.",
        "operationId": "OrderController_getOrderStatusBatch",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchOrderStatusRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Batch order statuses",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchOrderStatusResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request body"
          },
          "401": {
            "description": "User not authenticated"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "summary": "Get order statuses in batch",
        "tags": [
          "Trading"
        ]
      }
    },
    "/orders/{orderId}": {
      "delete": {
        "description": "Cancel an open order and return locked funds",
        "operationId": "OrderController_cancelOrder",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "description": "Unique identifier of the order to be cancelled",
            "schema": {
              "example": "6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Order successfully cancelled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelOrderResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Order cannot be cancelled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "User not authenticated or not the order owner"
          },
          "425": {
            "description": "Cancellation is temporarily blocked because trading is disabled by maintenance mode",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string",
                      "example": "trading_disabled"
                    },
                    "message": {
                      "type": "string",
                      "example": "Trading is currently disabled."
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "disabled"
                      ],
                      "example": "disabled"
                    },
                    "resumeAt": {
                      "type": "string",
                      "format": "date-time",
                      "nullable": true,
                      "example": "2026-06-22T18:00:00.000Z"
                    }
                  },
                  "required": [
                    "code",
                    "message",
                    "mode"
                  ]
                },
                "example": {
                  "code": "trading_disabled",
                  "message": "Trading is currently disabled.",
                  "mode": "disabled",
                  "resumeAt": "2026-06-22T18:00:00.000Z"
                }
              }
            }
          },
          "500": {
            "description": "Server error during cancellation"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "summary": "Cancel Order",
        "tags": [
          "Trading"
        ]
      }
    },
    "/orders/cancel-batch": {
      "post": {
        "operationId": "OrderController_cancelOrderBatch",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteOrderBatchDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "All orders successfully cancelled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelOrderBatchResponseDto"
                }
              }
            }
          },
          "207": {
            "description": "Partial success - some orders cancelled, some failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelOrderBatchResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Orders from different markets, invalid order data, or no orders could be cancelled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "User not authenticated or not the owner of all orders",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "425": {
            "description": "Cancellation is temporarily blocked because trading is disabled by maintenance mode",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string",
                      "example": "trading_disabled"
                    },
                    "message": {
                      "type": "string",
                      "example": "Trading is currently disabled."
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "disabled"
                      ],
                      "example": "disabled"
                    },
                    "resumeAt": {
                      "type": "string",
                      "format": "date-time",
                      "nullable": true,
                      "example": "2026-06-22T18:00:00.000Z"
                    }
                  },
                  "required": [
                    "code",
                    "message",
                    "mode"
                  ]
                },
                "example": {
                  "code": "trading_disabled",
                  "message": "Trading is currently disabled.",
                  "mode": "disabled",
                  "resumeAt": "2026-06-22T18:00:00.000Z"
                }
              }
            }
          },
          "500": {
            "description": "Server error during batch cancellation"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "summary": "Cancel multiple orders in batch",
        "tags": [
          "Trading"
        ]
      }
    },
    "/orders/all/{slug}": {
      "delete": {
        "operationId": "OrderController_cancelAllOrders",
        "parameters": [],
        "responses": {
          "200": {
            "description": "All orders successfully cancelled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelAllOrdersResponseDto"
                }
              }
            }
          },
          "207": {
            "description": "Partial success - some orders cancelled, some failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelAllOrdersResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid market slug or no orders could be cancelled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "User not authenticated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "425": {
            "description": "Cancellation is temporarily blocked because trading is disabled by maintenance mode",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string",
                      "example": "trading_disabled"
                    },
                    "message": {
                      "type": "string",
                      "example": "Trading is currently disabled."
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "disabled"
                      ],
                      "example": "disabled"
                    },
                    "resumeAt": {
                      "type": "string",
                      "format": "date-time",
                      "nullable": true,
                      "example": "2026-06-22T18:00:00.000Z"
                    }
                  },
                  "required": [
                    "code",
                    "message",
                    "mode"
                  ]
                },
                "example": {
                  "code": "trading_disabled",
                  "message": "Trading is currently disabled.",
                  "mode": "disabled",
                  "resumeAt": "2026-06-22T18:00:00.000Z"
                }
              }
            }
          },
          "500": {
            "description": "Server error during cancellation"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "summary": "Cancel all of a user's orders in a specific market",
        "tags": [
          "Trading"
        ]
      }
    },
    "/profiles/me": {
      "get": {
        "summary": "Get current profile",
        "description": "Retrieve the authenticated caller's private profile without passing an address. Returns the same private profile shape as `GET /profiles/{account}`, including internal profile ID and fee rate.",
        "operationId": "ProfileController_findMe",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Authenticated user profile with fee rate and rank information",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileResponse"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, invalid, or did not resolve to an account"
          },
          "404": {
            "description": "Profile not found for the authenticated account"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "tags": [
          "Portfolio"
        ]
      }
    },
    "/profiles/{account}": {
      "get": {
        "description": "Retrieve the authenticated user's profile by address, including their internal user ID and fee rate. This is useful for API users who need their `feeRateBps` (for order signing) or numeric `id` (used as `ownerId` in other flows). You can only access your own profile — requesting another user's address returns 403. If you do not want to pass an address, use `GET /profiles/me`.",
        "operationId": "ProfileController_findOne",
        "parameters": [
          {
            "name": "account",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Your wallet address (the address associated with your API key)",
            "example": "0x27b4afBD88fE7c88c6897BB0b4ADE338D0401E37"
          }
        ],
        "responses": {
          "200": {
            "description": "User profile with fee rate and rank information",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — missing or invalid API key"
          },
          "403": {
            "description": "Forbidden — cannot access another user's private profile. Use the public profile endpoint instead."
          },
          "404": {
            "description": "Profile not found for the given address"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "summary": "Get your profile",
        "tags": [
          "Portfolio"
        ]
      }
    },
    "/auth/api-tokens/capabilities": {
      "get": {
        "summary": "Get partner capabilities",
        "description": "Returns the partner capability configuration for the authenticated user, including whether token management is enabled and which scopes are allowed for self-service token derivation. Requires Privy authentication (Bearer token).",
        "operationId": "ApiTokenController_getCapabilities",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Partner capability configuration",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerCapabilitiesResponse"
                }
              }
            }
          },
          "401": {
            "description": "Requires Privy authentication"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "tags": [
          "API Tokens"
        ]
      }
    },
    "/auth/api-tokens/derive": {
      "post": {
        "summary": "Derive scoped API token",
        "description": "Creates a new scoped API token for the authenticated partner. Requires Privy authentication (Bearer token). The token secret is returned once at creation — store it securely. Requested scopes must be a subset of the partner's allowed scopes.",
        "operationId": "ApiTokenController_deriveToken",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeriveApiTokenRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Token created successfully. The secret is only returned once.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeriveApiTokenResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid scopes or profile not found"
          },
          "401": {
            "description": "Requires Privy authentication"
          },
          "403": {
            "description": "Token management not enabled or requested scopes not allowed for this partner"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "tags": [
          "API Tokens"
        ]
      }
    },
    "/auth/api-tokens": {
      "get": {
        "summary": "List active tokens",
        "description": "Lists all active (non-revoked) API tokens for the authenticated partner. Requires token management to be enabled for the partner.",
        "operationId": "ApiTokenController_listTokens",
        "parameters": [],
        "responses": {
          "200": {
            "description": "List of active tokens",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ApiTokenListItem"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated"
          },
          "403": {
            "description": "Token management not enabled for this partner"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "tags": [
          "API Tokens"
        ]
      }
    },
    "/auth/api-tokens/{tokenId}": {
      "delete": {
        "summary": "Revoke token",
        "description": "Revokes an active API token. The token becomes immediately unusable. Requires token management to be enabled for the partner.",
        "operationId": "ApiTokenController_revokeToken",
        "parameters": [
          {
            "name": "tokenId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The token ID to revoke"
          }
        ],
        "responses": {
          "200": {
            "description": "Token revoked successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "API token revoked successfully"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Token not found or already revoked"
          },
          "401": {
            "description": "Not authenticated"
          },
          "403": {
            "description": "Token management not enabled for this partner"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "tags": [
          "API Tokens"
        ]
      }
    },
    "/profiles/partner-accounts": {
      "get": {
        "summary": "List partner sub-accounts",
        "description": "Lists partner-owned sub-accounts created under the authenticated partner profile, or recovers a specific sub-account by account address. Requires HMAC authentication with the `account_creation` scope. Do not send `x-on-behalf-of`; results are always scoped to the authenticated partner.",
        "operationId": "ProfileController_listPartnerAccounts",
        "parameters": [
          {
            "name": "account",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Optional EVM address filter. Matching is exact and case-insensitive.",
            "example": "0x1676716Ef7F19B5C5d690631CB57cf0bFD900A3d"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 25
            },
            "description": "Page size. Values above 25 are capped to 25."
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            },
            "description": "Page number."
          }
        ],
        "responses": {
          "200": {
            "description": "Partner sub-account list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListPartnerAccountsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid account, limit, or page query parameter"
          },
          "401": {
            "description": "Missing or invalid authentication"
          },
          "403": {
            "description": "Requires apiToken auth with account_creation scope"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "tags": [
          "Partner Accounts"
        ]
      },
      "post": {
        "summary": "Create partner sub-account",
        "description": "Creates a new sub-account linked to the authenticated partner. Requires HMAC authentication with the `account_creation` scope.\n\n**Server wallet mode** (`createServerWallet: true`): Creates a Privy server wallet and profile. The partner can then submit orders on behalf of this account using delegated signing.\n\n**EOA mode** (default): Requires wallet ownership verification via `x-account`, `x-signing-message`, and `x-signature` headers. The end user signs their own orders.",
        "operationId": "ProfileController_createPartnerAccount",
        "parameters": [
          {
            "name": "x-account",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "EOA mode only. Checksummed Ethereum address of the sub-account wallet."
          },
          {
            "name": "x-signing-message",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "EOA mode only. Hex-encoded signing message."
          },
          {
            "name": "x-signature",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "EOA mode only. Hex-encoded signature from the sub-account wallet."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePartnerAccountRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sub-account created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatePartnerAccountResponse"
                }
              }
            }
          },
          "400": {
            "description": "Cannot create a partner account for the partner's own address, or profile creation failed"
          },
          "401": {
            "description": "Wallet ownership verification failed (EOA mode)"
          },
          "403": {
            "description": "Requires apiToken auth with account_creation scope"
          },
          "409": {
            "description": "A profile already exists for this address"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "tags": [
          "Partner Accounts"
        ]
      }
    },
    "/profiles/partner-accounts/{profileId}/allowances": {
      "get": {
        "summary": "Check partner account allowances",
        "description": "Checks delegated-trading allowance readiness for a partner-created server-wallet sub-account. Requires HMAC authentication with `account_creation` and `delegated_signing` scopes. Status is based on live chain reads.",
        "operationId": "ProfileController_checkPartnerAccountAllowances",
        "parameters": [
          {
            "name": "profileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Partner sub-account profile ID for the server-wallet child account."
          }
        ],
        "responses": {
          "200": {
            "description": "Live allowance state for the server-wallet child profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerAccountAllowanceResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid profile ID or non-server-wallet child profile"
          },
          "401": {
            "description": "Missing or invalid HMAC authentication"
          },
          "403": {
            "description": "Requires account_creation and delegated_signing scopes, and profileId must belong to the authenticated partner"
          },
          "404": {
            "description": "Partner sub-account profile not found"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "tags": [
          "Partner Accounts"
        ]
      }
    },
    "/profiles/partner-accounts/{profileId}/allowances/retry": {
      "post": {
        "summary": "Retry partner account allowances",
        "description": "Retries delegated-trading allowance recovery for a partner-created server-wallet sub-account. The retry takes a short wallet lock, re-checks live chain state, and submits only targets still missing. A `submitted` target means this retry request submitted a sponsored transaction or user operation.",
        "operationId": "ProfileController_retryPartnerAccountAllowances",
        "parameters": [
          {
            "name": "profileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Partner sub-account profile ID for the server-wallet child account."
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Allowance state after retry submission attempts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerAccountAllowanceResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid profile ID or non-server-wallet child profile"
          },
          "401": {
            "description": "Missing or invalid HMAC authentication"
          },
          "403": {
            "description": "Requires account_creation and delegated_signing scopes, and profileId must belong to the authenticated partner"
          },
          "404": {
            "description": "Partner sub-account profile not found"
          },
          "409": {
            "description": "Another retry is already running for this wallet"
          },
          "429": {
            "description": "Retry is rate limited; response includes retryAfterSeconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerAllowanceRetryRateLimitError"
                }
              }
            }
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "tags": [
          "Partner Accounts"
        ]
      }
    },
    "/orders/cancel": {
      "post": {
        "description": "Cancel one open order by either internal orderId or client-provided clientOrderId.",
        "operationId": "OrderController_cancelOrderCombined",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelOrderCombinedDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Order successfully cancelled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelOrderResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid identifier input or order cannot be cancelled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "User not authenticated or not the order owner"
          },
          "404": {
            "description": "Order not found"
          },
          "500": {
            "description": "Server error during cancellation"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "summary": "Cancel Order (Combined)",
        "tags": [
          "Trading"
        ]
      }
    },
    "/orders/batch-cancel": {
      "post": {
        "description": "Cancel open orders by either internal orderIds or client-provided clientOrderIds.",
        "operationId": "OrderController_batchCancelOrders",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelOrderBatchCombinedDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "All orders successfully cancelled",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/CancelOrderBatchResponseDto"
                    },
                    {
                      "$ref": "#/components/schemas/CancelOrderBatchCombinedResponseDto"
                    }
                  ]
                }
              }
            }
          },
          "207": {
            "description": "Partial success - some orders cancelled, some failed",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/CancelOrderBatchResponseDto"
                    },
                    {
                      "$ref": "#/components/schemas/CancelOrderBatchCombinedResponseDto"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid identifier input, invalid order data, or no orders could be cancelled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "User not authenticated or not the owner of all orders",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Server error during batch cancellation"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "summary": "Batch Cancel Orders (Combined)",
        "tags": [
          "Trading"
        ]
      }
    },
    "/markets/stable/{slug}": {
      "get": {
        "description": "Resolves a stable recurring URL slug to the current active market or ladder group",
        "operationId": "MarketController_findByStableSlug",
        "parameters": [
          {
            "name": "slug",
            "required": true,
            "in": "path",
            "description": "Stable slug identifier (e.g. btc-hourly-price)",
            "schema": {
              "example": "btc-hourly-price",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Resolved market or group data (single market or ladder group)"
          },
          "404": {
            "description": "No market or group found for the given stable slug"
          }
        },
        "summary": "Resolve Stable Slug",
        "tags": [
          "Markets"
        ]
      }
    },
    "/markets/timeline": {
      "get": {
        "description": "Returns past/future market slots for a symbol+frequency combo, anchored on current time",
        "operationId": "MarketController_getTimelineBySymbol",
        "parameters": [
          {
            "name": "symbol",
            "required": true,
            "in": "query",
            "schema": {
              "example": "BTC",
              "type": "string"
            }
          },
          {
            "name": "frequency",
            "required": true,
            "in": "query",
            "schema": {
              "enum": [
                "daily",
                "hourly",
                "minutely",
                "weekly"
              ],
              "type": "string"
            }
          },
          {
            "name": "subFrequency",
            "required": false,
            "in": "query",
            "schema": {
              "enum": [
                "hours_1",
                "hours_2",
                "hours_3",
                "hours_4",
                "hours_5",
                "hours_6",
                "minutes_1",
                "minutes_10",
                "minutes_15",
                "minutes_20",
                "minutes_25",
                "minutes_30",
                "minutes_35",
                "minutes_40",
                "minutes_45",
                "minutes_5",
                "minutes_50",
                "minutes_55"
              ],
              "type": "string"
            }
          },
          {
            "name": "before",
            "required": false,
            "in": "query",
            "schema": {
              "example": 10,
              "type": "number"
            }
          },
          {
            "name": "after",
            "required": false,
            "in": "query",
            "schema": {
              "example": 10,
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "summary": "Get market timeline by ticker and duration",
        "tags": [
          "Markets"
        ]
      }
    },
    "/markets/{slug}/timeline": {
      "get": {
        "description": "Returns anchor/current/next/batch timeline slots for a market slug",
        "operationId": "MarketController_getTimeline",
        "parameters": [
          {
            "name": "before",
            "required": false,
            "in": "query",
            "schema": {
              "example": 1,
              "type": "number"
            }
          },
          {
            "name": "after",
            "required": false,
            "in": "query",
            "schema": {
              "example": 24,
              "type": "number"
            }
          },
          {
            "name": "slug",
            "required": true,
            "in": "path",
            "description": "Market slug",
            "schema": {
              "example": "btc-5m-1771934700"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "summary": "Get market timeline",
        "tags": [
          "Markets"
        ]
      }
    },
    "/portfolio/redeem": {
      "post": {
        "description": "Submit an on-chain redeemPositions transaction for a resolved market. Server-managed wallets only. Use onBehalfOf for partner sub-accounts.",
        "operationId": "PortfolioServerWalletController_redeemPositions",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RedeemPositionsDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Redemption transaction submitted"
          },
          "400": {
            "description": "Market not resolved or no balance"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "No server wallet or insufficient scopes"
          },
          "404": {
            "description": "Market not found"
          },
          "409": {
            "description": "Operation already in progress"
          }
        },
        "security": [
          {
            "limitless_session": []
          }
        ],
        "summary": "Redeem resolved positions",
        "tags": [
          "Portfolio"
        ]
      }
    },
    "/portfolio/withdraw": {
      "post": {
        "description": "Transfer ERC20 tokens from a managed sub-account server wallet to the partner's own address. Requires \"withdrawal\" scope. Destination must be the authenticated account, smart wallet, or a whitelisted withdrawal address. When destination is omitted, Etherspot profiles withdraw to their smart wallet if one exists. When onBehalfOf is set, the whitelist used is the authenticated caller's whitelist, not the target sub-account's.",
        "operationId": "PortfolioServerWalletController_withdraw",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WithdrawDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Withdrawal transaction submitted"
          },
          "400": {
            "description": "Insufficient balance or invalid amount"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "No server wallet, missing scope, or unauthorized"
          },
          "409": {
            "description": "Operation already in progress"
          }
        },
        "security": [
          {
            "limitless_session": []
          }
        ],
        "summary": "Withdraw tokens from server wallet",
        "tags": [
          "Portfolio"
        ]
      }
    },
    "/portfolio/withdrawal-addresses": {
      "post": {
        "description": "Add an external withdrawal destination address. Only Privy-authenticated users can manage this list.",
        "operationId": "PortfolioServerWalletController_addWithdrawalAddress",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWithdrawalAddressDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Withdrawal address added"
          },
          "400": {
            "description": "Invalid destination address"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Privy authentication required"
          }
        },
        "security": [
          {
            "limitless_session": []
          }
        ],
        "summary": "Add withdrawal address",
        "tags": [
          "Portfolio"
        ]
      }
    },
    "/portfolio/withdrawal-addresses/{address}": {
      "delete": {
        "description": "Soft-delete an external withdrawal destination address by address. Only Privy-authenticated users can manage this list.",
        "operationId": "PortfolioServerWalletController_deleteWithdrawalAddress",
        "parameters": [
          {
            "name": "address",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Withdrawal address deleted"
          },
          "400": {
            "description": "Invalid withdrawal address"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Privy authentication required"
          },
          "404": {
            "description": "Withdrawal address not found"
          }
        },
        "security": [
          {
            "limitless_session": []
          }
        ],
        "summary": "Delete withdrawal address",
        "tags": [
          "Portfolio"
        ]
      }
    },
    "/referral/usdc/me": {
      "get": {
        "summary": "Get My Referral Stats",
        "description": "Your own referral standing: cumulative CLOB trading volume (the tier basis), total USDC earned from the referral program, and the active tier ladder. The current tier is not sent - resolve it as the highest ladder entry whose minBasisRaw your totalBasisRaw clears.",
        "operationId": "ReferralUsdcController_getMe",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Referral stats for the authenticated user",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReferralUsdcMeResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Profile not found"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "tags": [
          "Referral"
        ]
      }
    },
    "/referral/usdc/referrals": {
      "get": {
        "summary": "Get My Referred Users",
        "description": "Your own referred users, paginated, filtered, and sorted server-side. `counts` covers all your referred users regardless of the active filter; `total` counts only rows matching the current `status` filter.",
        "operationId": "ReferralUsdcController_getReferrals",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Number of items per page (1-100).",
            "schema": {
              "type": "number",
              "minimum": 1,
              "maximum": 100,
              "default": 10
            }
          },
          {
            "name": "offset",
            "required": false,
            "in": "query",
            "description": "Offset into the result set.",
            "schema": {
              "type": "number",
              "minimum": 0,
              "default": 0
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "description": "Filter by activity: `awaiting` = has not traded yet, `earning` = has traded.",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "awaiting",
                "earning"
              ],
              "default": "all"
            }
          },
          {
            "name": "sortBy",
            "required": false,
            "in": "query",
            "description": "Sort column.",
            "schema": {
              "type": "string",
              "enum": [
                "createdAt",
                "earned",
                "fees",
                "volume"
              ],
              "default": "earned"
            }
          },
          {
            "name": "sortOrder",
            "required": false,
            "in": "query",
            "description": "Sort direction.",
            "schema": {
              "type": "string",
              "enum": [
                "ASC",
                "DESC"
              ],
              "default": "DESC"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated referred users with filter counts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReferralUsdcReferralsResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query parameters"
          },
          "401": {
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "tags": [
          "Referral"
        ]
      }
    },
    "/referral/usdc/leaderboard": {
      "get": {
        "summary": "Get Referral Leaderboard",
        "description": "The global referral leaderboard. Public - no authentication required. When the request is authenticated, the response additionally carries a `me` block pinning your own rank and entry even when outside the returned page.",
        "operationId": "ReferralUsdcController_getLeaderboard",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Number of items per page (1-100).",
            "schema": {
              "type": "number",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          },
          {
            "name": "offset",
            "required": false,
            "in": "query",
            "description": "Offset into the result set.",
            "schema": {
              "type": "number",
              "minimum": 0,
              "default": 0,
              "maximum": 10000
            }
          },
          {
            "name": "sortBy",
            "required": false,
            "in": "query",
            "description": "Sort column.",
            "schema": {
              "type": "string",
              "enum": [
                "earned",
                "fees",
                "referred"
              ],
              "default": "earned"
            }
          },
          {
            "name": "sortOrder",
            "required": false,
            "in": "query",
            "description": "Sort direction.",
            "schema": {
              "type": "string",
              "enum": [
                "ASC",
                "DESC"
              ],
              "default": "DESC"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ranked referral leaderboard page",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReferralUsdcLeaderboardResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query parameters"
          }
        },
        "security": [
          {},
          {
            "HmacAuth": []
          }
        ],
        "tags": [
          "Referral"
        ]
      }
    },
    "/referral/usdc/leaderboard/friends": {
      "get": {
        "summary": "Get Friends Leaderboard",
        "description": "The global leaderboard scoped to your own referred users: each row is that user's own referral standing (their referred count and referral earnings), keeping the global ranking. Only referred users who are themselves earning referrers appear. The response never carries a `me` block.",
        "operationId": "ReferralUsdcController_getFriendsLeaderboard",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Number of items per page (1-100).",
            "schema": {
              "type": "number",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          },
          {
            "name": "offset",
            "required": false,
            "in": "query",
            "description": "Offset into the result set.",
            "schema": {
              "type": "number",
              "minimum": 0,
              "default": 0,
              "maximum": 10000
            }
          },
          {
            "name": "sortBy",
            "required": false,
            "in": "query",
            "description": "Sort column.",
            "schema": {
              "type": "string",
              "enum": [
                "earned",
                "fees",
                "referred"
              ],
              "default": "earned"
            }
          },
          {
            "name": "sortOrder",
            "required": false,
            "in": "query",
            "description": "Sort direction.",
            "schema": {
              "type": "string",
              "enum": [
                "ASC",
                "DESC"
              ],
              "default": "DESC"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ranked page of your referred users who are earning referrers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReferralUsdcLeaderboardResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query parameters"
          },
          "401": {
            "description": "Unauthorized"
          }
        },
        "security": [
          {
            "HmacAuth": []
          }
        ],
        "tags": [
          "Referral"
        ]
      }
    },
    "/leaderboard/pnl/unrealized/markets/{marketId}": {
      "get": {
        "summary": "Get Unrealized PnL leaderboard for a market",
        "description": "Live leaderboard of open positions for one market, ranked by Unrealized PnL or ROI. Public - no authentication required. Ranks are absolute across pages, so page 2 with `limit=10` returns ranks 11-20.\n\nResults are paginated with `limit` (1-100, default 100) and `page` (1-100, default 1). The response also includes `totalRows` and `totalPages` describing the committed Top-100 generation for the market. `ETag` values are page-specific, so a validator returned for one page will not match another.\n\nResponses are served from a live Redis projection maintained by a dedicated worker. When the projection is warm the response is a `READY` snapshot with a strong `ETag` and short client cache. When the projection is still being rebuilt, callers may receive a `BUILDING`, `STALE`, or `DEGRADED` snapshot with `Cache-Control: no-store` and (for `BUILDING`) an empty `data` array - retry after a short delay. If the market is not open (`RESOLVED`, hidden, or otherwise ineligible), the endpoint returns `404`.",
        "operationId": "UnrealizedPnlLeaderboardController_getMarket",
        "parameters": [
          {
            "name": "marketId",
            "in": "path",
            "required": true,
            "description": "Numeric market id.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "metric",
            "in": "query",
            "required": false,
            "description": "Metric to rank by.",
            "schema": {
              "type": "string",
              "enum": [
                "pnl",
                "roi"
              ],
              "default": "pnl"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Number of leaderboard entries to return per page (1-100).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number to return (1-100). Ranks stay absolute across pages, so page 2 with `limit=10` returns ranks 11-20. Omitting `page` returns page 1.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ranked Unrealized PnL leaderboard for the market",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnrealizedPnlMarketResponseDto"
                }
              }
            }
          },
          "304": {
            "description": "Snapshot matches the caller's `If-None-Match` ETag"
          },
          "400": {
            "description": "Invalid market id or query parameters"
          },
          "404": {
            "description": "Market is not open for Unrealized PnL"
          }
        },
        "tags": [
          "Leaderboard"
        ]
      }
    },
    "/leaderboard/pnl/unrealized/biggest-positions": {
      "get": {
        "summary": "Get biggest open positions leaderboard",
        "description": "Live leaderboard of the largest currently open position lines across all markets, ranked by position size. Public - no authentication required.\n\nResponses are served from a live Redis projection with `ETag` support and short client cache. When the projection is still being rebuilt, callers may receive a `BUILDING`, `STALE`, or `DEGRADED` snapshot with `Cache-Control: no-store` and (for `BUILDING`) an empty `data` array - retry after a short delay.",
        "operationId": "UnrealizedPnlLeaderboardController_getBiggestPositions",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Number of position lines to return (1-50).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ranked biggest open positions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnrealizedPnlBiggestPositionsResponseDto"
                }
              }
            }
          },
          "304": {
            "description": "Snapshot matches the caller's `If-None-Match` ETag"
          },
          "400": {
            "description": "Invalid query parameters"
          }
        },
        "tags": [
          "Leaderboard"
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "HmacAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "lmts-api-key",
        "description": "Scoped API token with HMAC-SHA256 signing. Requires three headers: lmts-api-key (token ID), lmts-timestamp (ISO-8601), lmts-signature (Base64-encoded HMAC). See Authentication docs for details."
      }
    },
    "schemas": {
      "MaintenanceStatus": {
        "type": "object",
        "description": "Current and scheduled maintenance information.",
        "properties": {
          "active": {
            "type": "array",
            "description": "Maintenance effects currently in force.",
            "items": {
              "$ref": "#/components/schemas/MaintenanceWindow"
            }
          },
          "scheduled": {
            "type": "array",
            "description": "Future maintenance notices.",
            "items": {
              "$ref": "#/components/schemas/MaintenanceWindow"
            }
          }
        },
        "required": [
          "active",
          "scheduled"
        ]
      },
      "MaintenanceWindow": {
        "type": "object",
        "description": "A maintenance window or notice.",
        "properties": {
          "startsAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the maintenance window starts."
          },
          "endsAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the maintenance window ends, if known."
          },
          "publicMessage": {
            "type": "string",
            "description": "Human-readable message intended for users or integration operators."
          },
          "effects": {
            "type": "array",
            "description": "Public effects clients should apply for this maintenance window.",
            "items": {
              "$ref": "#/components/schemas/MaintenanceEffect"
            }
          }
        },
        "required": [
          "startsAt",
          "effects"
        ]
      },
      "MaintenanceEffect": {
        "type": "object",
        "description": "An effect applied during maintenance.",
        "properties": {
          "target": {
            "type": "string",
            "enum": [
              "trading"
            ],
            "description": "The public API surface affected by this maintenance effect."
          },
          "mode": {
            "type": "string",
            "enum": [
              "post_only",
              "cancel_only",
              "disabled"
            ],
            "description": "The trading restriction mode. No active trading effect means normal trading behavior."
          }
        },
        "required": [
          "target",
          "mode"
        ]
      },
      "ProfileResponse": {
        "type": "object",
        "description": "User profile including trading rank and fee rate",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Internal user ID (used as ownerId in other API flows)",
            "example": 42
          },
          "account": {
            "type": "string",
            "description": "Ethereum wallet address",
            "example": "0x27b4afBD88fE7c88c6897BB0b4ADE338D0401E37"
          },
          "username": {
            "type": "string",
            "description": "Unique username",
            "example": "trader123"
          },
          "displayName": {
            "type": "string",
            "description": "Display name shown in the UI",
            "example": "Trader 123"
          },
          "bio": {
            "type": "string",
            "nullable": true,
            "description": "User biography"
          },
          "client": {
            "type": "string",
            "description": "Client type used during registration",
            "example": "eoa"
          },
          "pfpUrl": {
            "type": "string",
            "nullable": true,
            "description": "Profile picture URL"
          },
          "smartWallet": {
            "type": "string",
            "nullable": true,
            "description": "Smart wallet address, if configured"
          },
          "isCreator": {
            "type": "boolean",
            "description": "Whether the user is a market creator"
          },
          "isOnboarded": {
            "type": "boolean",
            "description": "Whether the user has completed onboarding"
          },
          "socialUrl": {
            "type": "string",
            "nullable": true,
            "description": "URL to the user's social media profile"
          },
          "hasTraded": {
            "type": "boolean",
            "description": "Whether the user has executed at least one trade"
          },
          "tradeWalletOption": {
            "type": "string",
            "nullable": true,
            "enum": [
              "eoa",
              "smartWallet"
            ],
            "description": "Which wallet is used for trading"
          },
          "tradeWalletChoosen": {
            "type": "boolean",
            "description": "Whether the user has selected a trade wallet"
          },
          "embeddedAccount": {
            "type": "string",
            "nullable": true,
            "description": "Embedded wallet address (Privy)"
          },
          "mode": {
            "type": "string",
            "enum": [
              "simple",
              "advanced"
            ],
            "description": "Trading UI mode"
          },
          "referralCode": {
            "type": "string",
            "nullable": true,
            "description": "User's referral code"
          },
          "points": {
            "type": "number",
            "description": "Current points balance",
            "example": 15000
          },
          "accumulativePoints": {
            "type": "number",
            "description": "Total accumulated points (all-time)",
            "example": 50000
          },
          "rank": {
            "type": "object",
            "description": "User's trading rank, which determines the fee rate applied to orders",
            "properties": {
              "id": {
                "type": "integer",
                "description": "Rank ID"
              },
              "name": {
                "type": "string",
                "enum": [
                  "Bronze",
                  "Silver",
                  "Gold",
                  "Platinum",
                  "Diamond"
                ],
                "description": "Rank tier name",
                "example": "Gold"
              },
              "feeRateBps": {
                "type": "integer",
                "description": "Fee rate in basis points applied to this user's orders. Use this value when constructing signed orders.",
                "example": 200
              }
            }
          },
          "referralData": {
            "type": "array",
            "description": "Users referred by this user",
            "items": {
              "type": "object",
              "properties": {
                "createdAt": {
                  "type": "string",
                  "description": "When the referral was created"
                },
                "id": {
                  "type": "integer",
                  "description": "Referral record ID"
                },
                "referredProfileId": {
                  "type": "integer",
                  "description": "Profile ID of the referred user"
                },
                "pfpUrl": {
                  "type": "string",
                  "nullable": true,
                  "description": "Profile picture of the referred user"
                },
                "displayName": {
                  "type": "string",
                  "description": "Display name of the referred user"
                }
              }
            }
          },
          "referredUsersCount": {
            "type": "integer",
            "description": "Number of users referred"
          },
          "enrolledInPointsProgram": {
            "type": "boolean",
            "nullable": true,
            "description": "Whether the user is enrolled in the points program"
          },
          "leaderboardPosition": {
            "type": "integer",
            "description": "Position on the leaderboard"
          },
          "isTop100": {
            "type": "boolean",
            "description": "Whether the user is in the top 100 on the leaderboard"
          },
          "isCaptain": {
            "type": "boolean",
            "description": "Whether the user is a competition team captain"
          }
        }
      },
      "CreateUserDto": {
        "type": "object",
        "properties": {
          "client": {
            "type": "string",
            "description": "Client type for authentication",
            "enum": [
              "eoa",
              "etherspot",
              "base"
            ],
            "example": "eoa"
          },
          "smartWallet": {
            "type": "string",
            "description": "Smart wallet address (required for Smart Wallet client)",
            "example": "0x1234567890123456789012345678901234567890"
          },
          "r": {
            "type": "string",
            "description": "Referral code associated with the user who referred (invited) this user"
          }
        },
        "required": [
          "client"
        ]
      },
      "BrowseActiveMarketsResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "description": "Array of active markets with complete trading data including volume, liquidity, and recent feed events",
            "example": [
              {
                "id": 7495,
                "address": "0x76d3e2098Be66Aa7E15138F467390f0Eb7349B9b",
                "conditionId": "0x812f578437dc536def1412e4e593ef310884262c22868b30c1e58582e5f3e9bf",
                "title": "$DOGE above $0.21652 on Sep 1, 12:00 UTC?",
                "description": "This market will resolve to \"YES\" if the price of $DOGE is above $0.21652...",
                "collateralToken": {
                  "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
                  "decimals": 6,
                  "symbol": "USDC"
                },
                "creator": {
                  "name": "Limitless",
                  "imageURI": "https://limitless.exchange/assets/images/logo.svg",
                  "link": "https://x.com/trylimitless"
                },
                "prices": [
                  42.8,
                  57.2
                ],
                "categories": [
                  "Hourly"
                ],
                "tags": [
                  "Lumy",
                  "Recurring",
                  "Hourly",
                  "Simple Mode"
                ],
                "status": "FUNDED",
                "expired": false,
                "expirationDate": "Sep 1, 2025",
                "expirationTimestamp": 1756728000000,
                "volume": "164109293",
                "volumeFormatted": "164.109293",
                "openInterest": "48310707",
                "openInterestFormatted": "48.310707",
                "liquidity": "50000000",
                "liquidityFormatted": "50.000000",
                "tradeType": "amm",
                "marketType": "single",
                "slug": "dollardoge-above-dollar021652-on-sep-1-1200-utc-1756724413009",
                "feedEvents": [
                  {
                    "eventType": "NEW_TRADE",
                    "timestamp": "2025-09-01T11:30:31.000Z",
                    "user": {
                      "id": 7080,
                      "account": "0xea27f6788F083e6070961d3E52A2e596367E04CC",
                      "name": "GG",
                      "rankName": "Bronze",
                      "points": "0.00000000"
                    },
                    "data": {
                      "title": "$DOGE above $0.21652 on Sep 1, 12:00 UTC?",
                      "address": "0x76d3e2098Be66Aa7E15138F467390f0Eb7349B9b",
                      "strategy": "Buy",
                      "outcome": "NO",
                      "contracts": "9.071313",
                      "tradeAmount": "5",
                      "tradeAmountUSD": "4.999525",
                      "marketId": 7495
                    }
                  }
                ]
              }
            ],
            "items": {
              "type": "object",
              "description": "Market object with complete trading data (FEMarket type)",
              "additionalProperties": true
            }
          },
          "totalMarketsCount": {
            "type": "number",
            "description": "Total number of active markets available for pagination",
            "example": 150
          }
        },
        "required": [
          "data",
          "totalMarketsCount"
        ]
      },
      "CategoryCountResponseDto": {
        "type": "object",
        "properties": {
          "category": {
            "type": "object",
            "description": "Number of active markets per category",
            "example": {
              "1": 10,
              "2": 5,
              "3": 8
            },
            "additionalProperties": {
              "type": "number"
            }
          },
          "totalCount": {
            "type": "number",
            "description": "Total number of active markets",
            "example": 23
          }
        },
        "required": [
          "category",
          "totalCount"
        ]
      },
      "FeedEventsResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "description": "Array of feed events with pagination (FEFeedEvents type)",
            "example": {
              "data": [
                {
                  "eventType": "NEW_TRADE",
                  "timestamp": "2025-09-01T11:30:31.000Z",
                  "user": {
                    "name": "GG",
                    "rankName": "Bronze"
                  },
                  "data": {
                    "title": "Market Title",
                    "strategy": "Buy",
                    "outcome": "YES"
                  }
                }
              ],
              "totalPages": 5
            },
            "additionalProperties": true
          }
        },
        "required": [
          "data"
        ]
      },
      "PortfolioRewardsChartEntryDto": {
        "type": "object",
        "properties": {
          "timestamp": {
            "type": "number",
            "description": "Timestamp of the rewards entry",
            "example": 1672531200000
          },
          "userRewards": {
            "type": "string",
            "description": "User rewards for this timestamp in token decimals",
            "example": "25000000"
          },
          "totalRewards": {
            "type": "string",
            "description": "Total rewards for this timestamp in token decimals",
            "example": "60000000"
          }
        },
        "required": [
          "timestamp",
          "userRewards",
          "totalRewards"
        ]
      },
      "EpochRewardDataDto": {
        "type": "object",
        "properties": {
          "epochId": {
            "type": "number",
            "description": "Unique identifier of the epoch",
            "example": 1
          },
          "timestamp": {
            "format": "date-time",
            "type": "string",
            "description": "Timestamp when the epoch occurred",
            "example": "2024-01-01T00:00:00.000Z"
          },
          "totalRewards": {
            "type": "string",
            "description": "Total rewards distributed in this epoch in token decimals",
            "example": "1500000"
          },
          "userRewards": {
            "type": "string",
            "description": "User rewards earned in this epoch in token decimals",
            "example": "150000"
          },
          "earnedPercent": {
            "type": "number",
            "description": "Part of total rewards earned by the user - [0; 1]",
            "example": 0.1
          }
        },
        "required": [
          "epochId",
          "timestamp",
          "totalRewards",
          "userRewards",
          "earnedPercent"
        ]
      },
      "PortfolioRewardsDto": {
        "type": "object",
        "properties": {
          "todaysRewards": {
            "type": "string",
            "description": "Rewards earned today in token decimals",
            "example": "50250000"
          },
          "totalUnpaidRewards": {
            "type": "string",
            "description": "Total unpaid rewards in token decimals",
            "example": "200750000"
          },
          "totalUserRewardsLastEpoch": {
            "type": "string",
            "description": "Total user rewards from the last epoch in token decimals",
            "example": "150500000"
          },
          "rewardsChartData": {
            "description": "Chart data showing rewards over time",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PortfolioRewardsChartEntryDto"
            }
          },
          "rewardsByEpoch": {
            "description": "Rewards data by epoch",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EpochRewardDataDto"
            }
          }
        },
        "required": [
          "todaysRewards",
          "totalUnpaidRewards",
          "totalUserRewardsLastEpoch",
          "rewardsByEpoch"
        ]
      },
      "AmmPositionDto": {
        "type": "object",
        "properties": {
          "collateralAmount": {
            "type": "string",
            "description": "Amount of collateral invested in token decimals",
            "example": "100500000"
          },
          "latestTrade": {
            "type": "object",
            "description": "Latest trade associated with this position"
          },
          "market": {
            "type": "object",
            "description": "Market information for this position"
          },
          "outcomeIndex": {
            "type": "number",
            "description": "Index of the outcome token",
            "example": 0
          },
          "outcomeTokenAmount": {
            "type": "string",
            "description": "Amount of outcome tokens held in token decimals",
            "example": "50250000"
          },
          "account": {
            "type": "string",
            "description": "Wallet address that was used to create this position",
            "example": "0x1234567890123456789012345678901234567890"
          }
        },
        "required": [
          "market",
          "outcomeIndex"
        ]
      },
      "Market": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string",
            "description": "The address of the FixedProductMarketMaker contract.",
            "minLength": 42,
            "maxLength": 42,
            "nullable": true,
            "uniqueItems": true
          },
          "title": {
            "type": "string",
            "description": "Represents the question of the market, the title metadata of the market.",
            "maxLength": 70,
            "nullable": false,
            "uniqueItems": true
          },
          "proxyTitle": {
            "type": "string",
            "maxLength": 70,
            "default": null,
            "nullable": true,
            "uniqueItems": true
          },
          "description": {
            "type": "string",
            "description": "The description of the market.",
            "uniqueItems": false,
            "nullable": false
          },
          "question_id": {
            "type": "object",
            "description": "The bytes32 parsed title of the market.",
            "minLength": 66,
            "maxLength": 66,
            "uniqueItems": true,
            "nullable": true
          },
          "condition_id": {
            "type": "object",
            "description": "The bytes32 conditionId of the market, representing the conditions defined on condition preparation.",
            "minLength": 66,
            "maxLength": 66,
            "nullable": true,
            "uniqueItems": true
          },
          "position_ids": {
            "description": "Array of position IDs (max 2 elements)",
            "maxItems": 2,
            "nullable": true,
            "items": {
              "type": "array"
            },
            "type": "array"
          },
          "outcome_slot_count": {
            "type": "number",
            "description": "The number of outcomes in the market.",
            "minimum": 2,
            "maximum": 2,
            "nullable": false,
            "default": 2
          },
          "winning_index": {
            "type": "number",
            "description": "The outcome index reported by the oracle. Indexes into the fixed `['Yes', 'No']` outcome array: `0` = YES resolved, `1` = NO resolved, `null` = not yet resolved.",
            "minimum": 0,
            "maximum": 1,
            "nullable": true
          },
          "payout_numerators": {
            "description": "The oracle payout numerators that the oracle reported.",
            "nullable": true,
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "status": {
            "type": "string",
            "description": "Indicates the status of the market.",
            "nullable": false
          },
          "og_url": {
            "type": "string",
            "description": "The URL of the market OG image for SEO.",
            "nullable": true
          },
          "image_url": {
            "type": "string",
            "description": "The URL of the market logo image for SEO.",
            "nullable": true
          },
          "deadline": {
            "type": "string",
            "description": "The deadline of the market.",
            "nullable": false
          },
          "startAt": {
            "type": "string",
            "format": "date-time",
            "description": "The start time of the market.",
            "nullable": true
          },
          "hidden": {
            "type": "boolean",
            "default": false
          },
          "txHash": {
            "type": "string",
            "default": null
          },
          "resolutionTxHash": {
            "type": "string",
            "default": null
          },
          "priority_index": {
            "type": "number",
            "default": null
          }
        },
        "required": [
          "address",
          "title",
          "proxyTitle",
          "description",
          "question_id",
          "condition_id",
          "position_ids",
          "outcome_slot_count",
          "winning_index",
          "payout_numerators",
          "status",
          "og_url",
          "image_url",
          "deadline",
          "startAt",
          "hidden",
          "txHash",
          "resolutionTxHash",
          "priority_index"
        ]
      },
      "PositionDataDto": {
        "type": "object",
        "properties": {
          "cost": {
            "type": "string",
            "description": "Cost basis of the position in token decimals (e.g. 1 USDC = 1000000)",
            "example": "75000000"
          },
          "fillPrice": {
            "type": "string",
            "description": "Average fill price of the position (price per share in token decimals)",
            "example": "750000"
          },
          "realisedPnl": {
            "type": "string",
            "description": "Realized profit/loss from closed positions in token decimals",
            "example": "0"
          },
          "unrealizedPnl": {
            "type": "string",
            "description": "Unrealized profit/loss based on current market price in token decimals",
            "example": "25000000"
          },
          "marketValue": {
            "type": "string",
            "description": "Current market value of the position in token decimals",
            "example": "100000000"
          }
        },
        "required": [
          "cost",
          "fillPrice",
          "realisedPnl",
          "unrealizedPnl",
          "marketValue"
        ]
      },
      "MarketPositionDataDto": {
        "type": "object",
        "properties": {
          "yes": {
            "description": "Position data for YES outcome",
            "example": {
              "cost": "75000000",
              "fillPrice": "750000",
              "realisedPnl": "0",
              "unrealizedPnl": "25000000",
              "marketValue": "100000000"
            },
            "allOf": [
              {
                "$ref": "#/components/schemas/PositionDataDto"
              }
            ]
          },
          "no": {
            "description": "Position data for NO outcome",
            "example": {
              "cost": "25000000",
              "fillPrice": "250000",
              "realisedPnl": "0",
              "unrealizedPnl": "-5000000",
              "marketValue": "20000000"
            },
            "allOf": [
              {
                "$ref": "#/components/schemas/PositionDataDto"
              }
            ]
          }
        },
        "required": [
          "yes",
          "no"
        ]
      },
      "ClobPositionDto": {
        "type": "object",
        "properties": {
          "market": {
            "description": "Market information",
            "allOf": [
              {
                "$ref": "#/components/schemas/Market"
              }
            ]
          },
          "positions": {
            "description": "Position data for the market",
            "allOf": [
              {
                "$ref": "#/components/schemas/MarketPositionDataDto"
              }
            ]
          },
          "latestTrade": {
            "type": "object",
            "description": "Latest trade prices"
          },
          "tokensBalance": {
            "type": "object",
            "description": "Token balances in token decimals"
          },
          "orders": {
            "type": "object",
            "description": "Order information"
          },
          "rewards": {
            "type": "object",
            "description": "Rewards information for this position"
          }
        },
        "required": [
          "market",
          "positions",
          "tokensBalance",
          "orders"
        ]
      },
      "HistoryTradeDto": {
        "type": "object",
        "description": "An AMM trade executed by the user",
        "properties": {
          "blockTimestamp": {
            "type": "string",
            "description": "Timestamp of the block containing the trade",
            "example": "2025-09-01T11:30:31.000Z"
          },
          "collateralAmount": {
            "type": "string",
            "description": "Collateral amount traded (in token decimals)",
            "example": "5000000"
          },
          "market": {
            "type": "object",
            "description": "Market details for the trade",
            "properties": {
              "conditionId": {
                "type": "string",
                "example": "0x812f578437dc..."
              },
              "expirationDate": {
                "type": "string",
                "example": "Sep 1, 2025"
              },
              "id": {
                "type": "string",
                "example": "0x76d3e2098Be6..."
              },
              "slug": {
                "type": "string",
                "example": "doge-above-021-sep-1"
              },
              "title": {
                "type": "string",
                "example": "$DOGE above $0.21652 on Sep 1?"
              }
            }
          },
          "outcomeIndex": {
            "type": "number",
            "description": "Index of the outcome traded (0 = YES, 1 = NO)",
            "example": 0
          },
          "outcomeTokenAmount": {
            "type": "string",
            "description": "Amount of outcome tokens traded",
            "example": "10000000"
          },
          "outcomeTokenAmounts": {
            "type": "array",
            "description": "Collateral per outcome token",
            "items": {
              "type": "string"
            },
            "example": [
              "5000000",
              "0"
            ]
          },
          "outcomeTokenNetCost": {
            "type": "string",
            "description": "Net cost of the outcome tokens",
            "example": "4950000"
          },
          "outcomeTokenPrice": {
            "type": "string",
            "description": "Price of the outcome token at trade time",
            "example": "0.50"
          },
          "strategy": {
            "type": "string",
            "description": "Trade direction",
            "enum": [
              "Buy",
              "Sell"
            ],
            "example": "Buy"
          },
          "transactionHash": {
            "type": "string",
            "description": "On-chain transaction hash",
            "example": "0xabc123..."
          }
        },
        "required": [
          "blockTimestamp",
          "market",
          "outcomeIndex",
          "outcomeTokenAmounts",
          "outcomeTokenNetCost",
          "transactionHash"
        ]
      },
      "PortfolioPositionsDto": {
        "type": "object",
        "properties": {
          "rewards": {
            "description": "Rewards information for the portfolio",
            "allOf": [
              {
                "$ref": "#/components/schemas/PortfolioRewardsDto"
              }
            ]
          },
          "points": {
            "type": "number",
            "description": "User points",
            "example": 123
          },
          "accumulativePoints": {
            "type": "number",
            "description": "User accumulative points",
            "example": 456
          },
          "amm": {
            "description": "List of AMM positions",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AmmPositionDto"
            }
          },
          "clob": {
            "description": "List of CLOB positions",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ClobPositionDto"
            }
          },
          "group": {
            "description": "Grouped CLOB positions (if enabled)",
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        },
        "required": [
          "rewards",
          "points",
          "accumulativePoints",
          "amm",
          "clob"
        ]
      },
      "PortfolioPnlChartPointDto": {
        "type": "object",
        "properties": {
          "timestamp": {
            "type": "number",
            "description": "Point timestamp (ms)",
            "example": 1700000000000
          },
          "value": {
            "type": "number",
            "description": "Series value in USD (realised PnL)",
            "example": 123.45
          }
        },
        "required": [
          "timestamp",
          "value"
        ]
      },
      "PortfolioPnlChartDto": {
        "type": "object",
        "properties": {
          "timeframe": {
            "type": "string",
            "description": "Timeframe window used for previous/current comparison",
            "example": "7d"
          },
          "data": {
            "description": "Realised PnL series (USD) for the selected timeframe",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PortfolioPnlChartPointDto"
            }
          },
          "currentValue": {
            "type": "number",
            "description": "Current realised PnL (USD)",
            "example": -7.04
          },
          "previousValue": {
            "type": "number",
            "description": "Previous realised PnL (USD) at timeframe start",
            "example": -6.5
          },
          "percentChange": {
            "type": "number",
            "description": "Percent change between previousValue and currentValue (realised PnL)",
            "example": 8.24
          },
          "current": {
            "type": "object",
            "description": "Current PnL snapshot (hybrid: realised + unrealized + total)",
            "nullable": true
          }
        },
        "required": [
          "timeframe",
          "data",
          "currentValue",
          "previousValue",
          "percentChange"
        ]
      },
      "HistoryMarketGroupDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "number",
            "description": "Unique identifier of the group",
            "example": 10000037
          },
          "slug": {
            "type": "string",
            "description": "Slug identifier of the group",
            "example": "positionconverted-test-1744046422596"
          },
          "title": {
            "type": "string",
            "description": "Title of the group",
            "example": "PositionConverted test"
          },
          "status": {
            "type": "string",
            "description": "Status of the group",
            "example": "FUNDED"
          },
          "deadline": {
            "type": "string",
            "description": "Deadline for the group",
            "example": "2025-04-11T22:34:56.000Z"
          },
          "hidden": {
            "type": "boolean",
            "description": "Whether the group is hidden",
            "example": false
          },
          "txHash": {
            "type": "string",
            "description": "Transaction hash for the group",
            "example": null
          },
          "resolutionTxHash": {
            "type": "string",
            "description": "Resolution transaction hash",
            "example": null
          },
          "priorityIndex": {
            "type": "number",
            "description": "Priority index of the group",
            "example": 0
          },
          "metadata": {
            "type": "object",
            "description": "Group metadata",
            "example": {
              "isBannered": false
            }
          },
          "negRiskMarketId": {
            "type": "string",
            "description": "Onchain NegRisk market ID as identified by the NegriskAdapter smart-contract",
            "example": "0xe103633b40e9b664f8acc89e8cf7b7916475961ae1708a249fa5d6c933168c00"
          },
          "createdAt": {
            "type": "string",
            "description": "Creation timestamp",
            "example": "2025-04-07T17:20:22.135Z"
          },
          "updatedAt": {
            "type": "string",
            "description": "Last update timestamp",
            "example": "2025-04-07T17:22:08.464Z"
          }
        },
        "required": [
          "id",
          "slug",
          "title",
          "status",
          "deadline",
          "hidden",
          "priorityIndex",
          "metadata",
          "negRiskMarketId",
          "createdAt",
          "updatedAt"
        ]
      },
      "HistoryMarketDto": {
        "type": "object",
        "properties": {
          "closed": {
            "type": "boolean",
            "description": "Whether the market is closed",
            "example": false
          },
          "collateral": {
            "type": "object",
            "description": "Collateral token information",
            "example": {
              "symbol": "USDC",
              "id": 7,
              "decimals": 6
            }
          },
          "group": {
            "description": "Market group information",
            "allOf": [
              {
                "$ref": "#/components/schemas/HistoryMarketGroupDto"
              }
            ]
          },
          "condition_id": {
            "type": "string",
            "description": "Condition ID of the market",
            "example": "0x08518bc4bb8a3dbb89aac4425ace0876b94a5dfa77dee47a20737a19cf67e325"
          },
          "funding": {
            "type": "number",
            "description": "Market funding amount",
            "example": 0
          },
          "id": {
            "type": "number",
            "description": "Market ID",
            "example": 980
          },
          "slug": {
            "type": "string",
            "description": "Market slug",
            "example": "btc-above-100k-jul-4"
          },
          "title": {
            "type": "string",
            "description": "Market title",
            "example": "$BTC above $100k on Jul 4?"
          },
          "deadline": {
            "type": "string",
            "description": "Market deadline",
            "example": "2025-07-04T23:59:59.000Z"
          }
        },
        "required": [
          "closed",
          "collateral",
          "group",
          "condition_id",
          "funding",
          "id",
          "slug",
          "title",
          "deadline"
        ]
      },
      "HistoryEntryDto": {
        "type": "object",
        "properties": {
          "blockTimestamp": {
            "type": "number",
            "description": "Block timestamp of the operation (unix seconds)",
            "example": 1744115608
          },
          "collateralAmount": {
            "type": "string",
            "description": "Collateral amount involved (human-readable, after dividing by token decimals)",
            "example": "25.5"
          },
          "market": {
            "description": "Market information",
            "allOf": [
              {
                "$ref": "#/components/schemas/HistoryMarketDto"
              }
            ]
          },
          "outcomeTokenAmount": {
            "type": "string",
            "description": "Amount of outcome tokens involved (human-readable)",
            "example": "50"
          },
          "outcomeTokenAmounts": {
            "description": "Amounts of outcome tokens for each outcome [YES, NO]",
            "example": [
              "50",
              "0"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "outcomeIndex": {
            "type": "number",
            "description": "Index of the outcome (0 = YES, 1 = NO)",
            "example": 0
          },
          "outcomeTokenPrice": {
            "type": "number",
            "description": "Effective price per outcome token for this fill",
            "example": 0.51
          },
          "strategy": {
            "type": "string",
            "description": "Type of operation. `Buy`/`Sell` = AMM trades, `Limit Buy`/`Limit Sell` = CLOB maker fills, `Market Buy`/`Market Sell` = CLOB taker fills, `Split`/`Merge` = position split/merge, `Convert` = NegRisk conversion, `Claim` = winnings redemption.",
            "example": "Limit Buy",
            "enum": [
              "Buy",
              "Sell",
              "Limit Buy",
              "Limit Sell",
              "Market Buy",
              "Market Sell",
              "Split",
              "Merge",
              "Convert",
              "Claim"
            ]
          },
          "transactionHash": {
            "type": "string",
            "description": "On-chain transaction hash (present for settled trades, splits, merges, conversions, and claims)",
            "example": "0x992f36465f938b21a6a5fe3c417c98c3268a616a05479d2dc53870c6cd1a0761"
          }
        },
        "required": [
          "blockTimestamp",
          "collateralAmount",
          "market",
          "outcomeTokenAmount",
          "outcomeTokenAmounts",
          "outcomeIndex",
          "outcomeTokenPrice",
          "strategy"
        ]
      },
      "HistoryResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "description": "List of history entries",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/HistoryEntryDto"
            }
          },
          "nextCursor": {
            "type": "string",
            "description": "Opaque cursor for the next page. `null` when there are no more pages. Pass this value back as the `cursor` query parameter to fetch the next page.",
            "nullable": true,
            "example": "eyJ0Ijoi..."
          },
          "totalCount": {
            "type": "number",
            "description": "Total count of entries (`null` in cursor mode)",
            "example": 8,
            "nullable": true
          }
        },
        "required": [
          "data",
          "totalCount"
        ]
      },
      "NavigationNodeDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the navigation node"
          },
          "name": {
            "type": "string",
            "description": "Display name of the navigation item"
          },
          "slug": {
            "type": "string",
            "description": "URL slug for the navigation item"
          },
          "path": {
            "type": "string",
            "description": "Full path to this navigation item",
            "example": "/sports/football"
          },
          "icon": {
            "type": "string",
            "description": "Icon identifier for the navigation item"
          },
          "children": {
            "description": "Child navigation nodes",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NavigationNodeDto"
            }
          },
          "count": {
            "type": "number",
            "description": "Number of active markets in this navigation node"
          }
        },
        "required": [
          "id",
          "name",
          "slug",
          "path",
          "children"
        ]
      },
      "ErrorResponseDto": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "Error message",
            "example": "Invalid order data"
          }
        },
        "required": [
          "message"
        ]
      },
      "FilterGroupOptionDto": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "description": "Display label for the option"
          },
          "value": {
            "type": "string",
            "description": "Value identifier for the option"
          },
          "metadata": {
            "type": "object",
            "description": "Optional metadata for the option (color, icon)"
          },
          "count": {
            "type": "number",
            "description": "Number of active markets matching this option"
          }
        },
        "required": [
          "label",
          "value"
        ]
      },
      "FilterGroupDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Display name of the filter group"
          },
          "slug": {
            "type": "string",
            "description": "URL slug for the filter group"
          },
          "allowMultiple": {
            "type": "boolean",
            "description": "Whether multiple options can be selected"
          },
          "presentation": {
            "type": "string",
            "description": "Presentation style for the filter group"
          },
          "options": {
            "description": "Available filter options",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FilterGroupOptionDto"
            }
          },
          "expanded": {
            "type": "boolean",
            "description": "Whether the filter group is expanded by default"
          },
          "tabs": {
            "type": "object",
            "description": "Tab configuration for sub-filtering within this filter group"
          }
        }
      },
      "BreadcrumbItemDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Display name of the breadcrumb item"
          },
          "slug": {
            "type": "string",
            "description": "URL slug of the breadcrumb item"
          },
          "path": {
            "type": "string",
            "description": "Full path to this breadcrumb item"
          }
        },
        "required": [
          "name",
          "slug",
          "path"
        ]
      },
      "MarketPageByPathResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier of the market page"
          },
          "name": {
            "type": "string",
            "description": "Display name of the market page"
          },
          "slug": {
            "type": "string",
            "description": "URL slug of the market page"
          },
          "description": {
            "type": "string",
            "description": "Description of the market page",
            "nullable": true
          },
          "fullPath": {
            "type": "string",
            "description": "Full URL path to this market page"
          },
          "baseFilter": {
            "type": "object",
            "description": "Base filter configuration for the page"
          },
          "filterGroups": {
            "description": "Available filter groups for the page",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FilterGroupDto"
            }
          },
          "metadata": {
            "type": "object",
            "description": "Additional metadata for the page"
          },
          "breadcrumb": {
            "description": "Breadcrumb trail to this page",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BreadcrumbItemDto"
            }
          },
          "totalCount": {
            "type": "number",
            "description": "Total number of active markets on this page"
          }
        },
        "required": [
          "id",
          "name",
          "slug",
          "fullPath",
          "baseFilter",
          "filterGroups",
          "metadata",
          "breadcrumb"
        ]
      },
      "CursorPaginationDto": {
        "type": "object",
        "properties": {
          "nextCursor": {
            "type": "string",
            "description": "Cursor for the next page of results",
            "nullable": true
          }
        }
      },
      "OffsetPaginationDto": {
        "type": "object",
        "properties": {
          "page": {
            "type": "number",
            "description": "Current page number"
          },
          "limit": {
            "type": "number",
            "description": "Number of items per page"
          },
          "total": {
            "type": "number",
            "description": "Total number of items"
          },
          "totalPages": {
            "type": "number",
            "description": "Total number of pages"
          }
        },
        "required": [
          "page",
          "limit",
          "total",
          "totalPages"
        ]
      },
      "ListMarketsResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "description": "Array of market/group data",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "cursor": {
            "description": "Cursor pagination info (when using cursor parameter)",
            "allOf": [
              {
                "$ref": "#/components/schemas/CursorPaginationDto"
              }
            ]
          },
          "pagination": {
            "description": "Offset pagination info (when using page parameter)",
            "allOf": [
              {
                "$ref": "#/components/schemas/OffsetPaginationDto"
              }
            ]
          },
          "counts": {
            "type": "object",
            "description": "Counts per tab option for the active filter context",
            "example": {
              "matches": 45,
              "props": 3
            }
          }
        },
        "required": [
          "data"
        ]
      },
      "PropertyOptionResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier of the property option"
          },
          "propertyKeyId": {
            "type": "string",
            "description": "Property key ID this option belongs to"
          },
          "value": {
            "type": "string",
            "description": "Value identifier for the option"
          },
          "label": {
            "type": "string",
            "description": "Display label for the option"
          },
          "sortOrder": {
            "type": "number",
            "description": "Sort order for the option"
          },
          "parentOptionId": {
            "type": "string",
            "description": "Parent option ID for hierarchical options",
            "nullable": true
          },
          "metadata": {
            "type": "object",
            "description": "Additional metadata for the option"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string",
            "description": "Creation timestamp"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string",
            "description": "Last update timestamp"
          }
        },
        "required": [
          "id",
          "propertyKeyId",
          "value",
          "label",
          "sortOrder",
          "metadata",
          "createdAt",
          "updatedAt"
        ]
      },
      "PropertyKeyResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier of the property key"
          },
          "name": {
            "type": "string",
            "description": "Display name of the property key"
          },
          "slug": {
            "type": "string",
            "description": "URL slug of the property key"
          },
          "type": {
            "type": "string",
            "description": "Type of property key",
            "enum": [
              "select",
              "multi-select"
            ]
          },
          "metadata": {
            "type": "object",
            "description": "Additional metadata for the property key"
          },
          "isSystem": {
            "type": "boolean",
            "description": "Whether this is a system-defined property key"
          },
          "sortOrder": {
            "type": "number",
            "description": "Sort order for the property key"
          },
          "hidden": {
            "type": "boolean",
            "description": "Whether this property key is hidden from public views"
          },
          "options": {
            "description": "Available options for this property key",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PropertyOptionResponseDto"
            }
          },
          "createdAt": {
            "format": "date-time",
            "type": "string",
            "description": "Creation timestamp"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string",
            "description": "Last update timestamp"
          }
        },
        "required": [
          "id",
          "name",
          "slug",
          "type",
          "metadata",
          "isSystem",
          "sortOrder",
          "hidden",
          "createdAt",
          "updatedAt"
        ]
      },
      "Order": {
        "type": "object",
        "properties": {
          "salt": {
            "description": "Unique random value for signature uniqueness. Send unsafe integers as decimal strings to preserve EIP-712 bytes.",
            "oneOf": [
              {
                "type": "string",
                "pattern": "^\\d+$",
                "example": "1778155025318314496"
              },
              {
                "type": "number",
                "example": 1234567890
              }
            ]
          },
          "maker": {
            "type": "string",
            "description": "Ethereum address of the maker (order creator)",
            "example": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
            "pattern": "^0x[a-fA-F0-9]{40}$"
          },
          "signer": {
            "type": "string",
            "description": "Address that signed the order",
            "example": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
            "pattern": "^0x[a-fA-F0-9]{40}$"
          },
          "taker": {
            "type": "string",
            "description": "Specific taker address (optional for open orders)",
            "example": "0x0000000000000000000000000000000000000000",
            "pattern": "^0x[a-fA-F0-9]{40}$"
          },
          "tokenId": {
            "type": "string",
            "description": "Token ID being traded (YES or NO position ID from conditional token)",
            "example": "19633204485790857949828516737993423758628930235371629943999544859324645414627"
          },
          "makerAmount": {
            "type": "number",
            "description": "Amount the maker is offering, scaled by 1e6. For GTC orders: price * size * 1e6 (BUY) or size * 1e6 (SELL). For FOK orders: USDC to spend * 1e6 (BUY) or shares to sell * 1e6 (SELL).",
            "example": 5000000,
            "minimum": 0
          },
          "takerAmount": {
            "type": "number",
            "description": "Amount the maker wants in return, scaled by 1e6. For GTC orders: size * 1e6 (BUY) or price * size * 1e6 (SELL). For FOK orders: always 1.",
            "example": 10000000,
            "minimum": 0
          },
          "expiration": {
            "type": "string",
            "description": "Order expiration. Must be \"0\". Non-zero expiration is not currently supported and orders signed with a non-zero value are rejected.",
            "example": "0"
          },
          "nonce": {
            "type": "number",
            "description": "Must be 0. Non-zero nonce is not currently supported and is rejected.",
            "example": 0
          },
          "price": {
            "type": "number",
            "description": "Order price as decimal (0.01-0.99, required for limit-like GTC/FAK orders)",
            "example": 0.75,
            "minimum": 0.01,
            "maximum": 0.99
          },
          "feeRateBps": {
            "type": "number",
            "description": "Fee rate in basis points (1% = 100)",
            "example": 0
          },
          "side": {
            "type": "number",
            "description": "Order side: 0 = BUY, 1 = SELL",
            "enum": [
              0,
              1
            ],
            "example": 0
          },
          "signature": {
            "type": "string",
            "description": "EIP-712 signature of order details as a 0x-prefixed hex string with full-byte (even) length. Optional when using delegated signing.",
            "pattern": "^0x([a-fA-F0-9]{2})*$",
            "example": "0x123abc456def789ghi0123abc456def789ghi0123abc456def789ghi0123456789012345678901"
          },
          "signatureType": {
            "type": "number",
            "description": "Signature type (0-3). Optional when using delegated signing.",
            "enum": [
              0,
              1,
              2,
              3
            ],
            "example": 2
          }
        },
        "required": [
          "salt",
          "maker",
          "signer",
          "tokenId",
          "makerAmount",
          "takerAmount",
          "feeRateBps",
          "side",
          "signature",
          "signatureType"
        ]
      },
      "CreateOrderDto": {
        "type": "object",
        "properties": {
          "order": {
            "description": "Order details including signature and amounts",
            "allOf": [
              {
                "$ref": "#/components/schemas/Order"
              }
            ]
          },
          "ownerId": {
            "type": "number",
            "description": "Profile ID of the order owner",
            "example": 12345
          },
          "orderType": {
            "type": "string",
            "description": "Order type (GTC=Good Till Cancelled, FAK=Fill And Kill, FOK=Fill Or Kill)",
            "enum": [
              "FAK",
              "FOK",
              "GTC"
            ],
            "example": "GTC"
          },
          "marketSlug": {
            "type": "string",
            "description": "Market identifier slug",
            "example": "biden-vs-trump-2024"
          },
          "postOnly": {
            "type": "boolean",
            "description": "Reject the order if it would match immediately. Supported only for GTC orders.",
            "example": true
          },
          "clientOrderId": {
            "type": "string",
            "description": "Client-provided idempotency key for order placement. If a duplicate is submitted, the server returns 409 Conflict.",
            "example": "client-order-001",
            "maxLength": 128
          },
          "onBehalfOf": {
            "type": "number",
            "description": "Profile ID to place order on behalf of (partner flow). Requires an API token with trading scope and a partner relationship with the target profile.",
            "example": 12345
          },
          "timestamp": {
            "type": "number",
            "description": "Optional client-stamped order creation time, Unix ms epoch. Top-level request field; not part of the EIP-712 signed order payload.",
            "example": 1735689600000,
            "minimum": 0
          },
          "recvWindow": {
            "type": "number",
            "description": "Optional maximum accepted order age in milliseconds. Valid range: 1 to 10000. If omitted, no receive-window check is applied. Top-level request field; not part of the EIP-712 signed order payload.",
            "example": 1500,
            "minimum": 1,
            "maximum": 10000
          },
          "stpPolicy": {
            "type": "string",
            "description": "Self-trade prevention policy. Top-level request field; not part of the EIP-712 signed order payload. Defaults to cancel_maker when omitted.",
            "enum": [
              "cancel_both",
              "cancel_maker",
              "cancel_taker"
            ],
            "example": "cancel_maker"
          }
        },
        "required": [
          "order",
          "ownerId",
          "orderType",
          "marketSlug"
        ]
      },
      "MakerMatch": {
        "type": "object",
        "properties": {}
      },
      "OrderExecutionTotalsRawDto": {
        "type": "object",
        "description": "Raw execution totals in contract units (strings to preserve precision)",
        "properties": {
          "contractsGross": {
            "type": "string",
            "example": "1000000"
          },
          "contractsFee": {
            "type": "string",
            "example": "1000"
          },
          "contractsNet": {
            "type": "string",
            "example": "999000"
          },
          "usdGross": {
            "type": "string",
            "example": "500000"
          },
          "usdFee": {
            "type": "string",
            "example": "500"
          },
          "usdNet": {
            "type": "string",
            "example": "499500"
          }
        },
        "required": [
          "contractsGross",
          "contractsFee",
          "contractsNet",
          "usdGross",
          "usdFee",
          "usdNet"
        ]
      },
      "OrderExecutionDto": {
        "type": "object",
        "description": "Execution and settlement summary for a created order",
        "properties": {
          "matched": {
            "type": "boolean",
            "description": "Whether the order was matched immediately",
            "example": true
          },
          "settlementStatus": {
            "type": "string",
            "description": "Current settlement status of the order. DELAYED means the order was accepted but is held by a per-market taker delay before being released to the matching engine. CANCELED with reason STP_TAKER_REJECTED means self-trade prevention (cancel_taker / cancel_both) rejected the incoming order.",
            "enum": [
              "UNMATCHED",
              "MATCHED",
              "MINED",
              "CONFIRMED",
              "RETRYING",
              "FAILED",
              "DELAYED",
              "CANCELED"
            ],
            "example": "MINED"
          },
          "reason": {
            "type": "string",
            "nullable": true,
            "description": "Reason the order was canceled. STP_TAKER_REJECTED when self-trade prevention rejected the incoming order. Present only when settlementStatus is CANCELED.",
            "enum": [
              "STP_TAKER_REJECTED"
            ],
            "example": "STP_TAKER_REJECTED"
          },
          "eligibleAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "ISO-8601 time a delayed (taker-delay) order is released to the matching engine. Present only when settlementStatus is DELAYED.",
            "example": "2026-06-08T10:15:30.000Z"
          },
          "tradeEventId": {
            "type": "string",
            "description": "Trade event ID (present when matched)",
            "example": "4aa706dd-6c57-4f3c-945a-99818dfd95f1"
          },
          "txHash": {
            "type": "string",
            "description": "On-chain transaction hash (present when mined)",
            "example": "0xabc123",
            "nullable": true
          },
          "clientOrderId": {
            "type": "string",
            "description": "Echo of client-provided idempotency key",
            "example": "client-order-001"
          },
          "stpMakerCancels": {
            "type": "array",
            "description": "Resting order IDs canceled by self-trade prevention (cancel_maker / cancel_both)",
            "items": {
              "type": "string"
            },
            "example": [
              "4aa706dd-6c57-4f3c-945a-99818dfd95f1"
            ]
          },
          "feeRateBps": {
            "type": "number",
            "description": "Fee rate in basis points applied to this order",
            "example": 25
          },
          "effectiveFeeBps": {
            "type": "number",
            "description": "Effective fee rate in basis points after any rebates",
            "example": 26
          },
          "totalsRaw": {
            "$ref": "#/components/schemas/OrderExecutionTotalsRawDto"
          }
        },
        "required": [
          "matched",
          "settlementStatus",
          "feeRateBps",
          "effectiveFeeBps",
          "totalsRaw"
        ]
      },
      "CreatedOrderDto": {
        "type": "object",
        "description": "Created order as returned by the API. Large numeric fields (`salt`, `makerAmount`, `takerAmount`, `nonce`, `price`) are serialized as decimal strings to preserve precision.",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Internal order ID"
          },
          "salt": {
            "type": "string",
            "description": "Order salt as decimal string",
            "example": "1778155025318314496"
          },
          "maker": {
            "type": "string",
            "example": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
          },
          "signer": {
            "type": "string",
            "example": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
          },
          "taker": {
            "type": "string",
            "nullable": true,
            "example": "0x0000000000000000000000000000000000000000"
          },
          "tokenId": {
            "type": "string",
            "example": "19633204485790857949828516737993423758628930235371629943999544859324645414627"
          },
          "makerAmount": {
            "type": "string",
            "description": "Maker amount as decimal string (scaled by 1e6)",
            "example": "5000000"
          },
          "takerAmount": {
            "type": "string",
            "description": "Taker amount as decimal string (scaled by 1e6)",
            "example": "10000000"
          },
          "expiration": {
            "type": "string",
            "nullable": true,
            "description": "Always \"0\". Non-zero expiration is not currently supported.",
            "example": "0"
          },
          "signatureType": {
            "type": "integer",
            "enum": [
              0,
              1,
              2,
              3
            ],
            "example": 2
          },
          "nonce": {
            "type": "string",
            "nullable": true,
            "description": "Always \"0\". Non-zero nonce is not currently supported.",
            "example": "0"
          },
          "feeRateBps": {
            "type": "integer",
            "nullable": true,
            "example": 0
          },
          "signature": {
            "type": "string",
            "pattern": "^0x([a-fA-F0-9]{2})*$"
          },
          "orderType": {
            "type": "string",
            "enum": [
              "GTC",
              "FAK",
              "FOK"
            ],
            "example": "GTC"
          },
          "price": {
            "type": "string",
            "nullable": true,
            "description": "Order price as decimal string (0.01-0.99)",
            "example": "0.75"
          },
          "side": {
            "type": "integer",
            "enum": [
              0,
              1
            ],
            "description": "0 = BUY, 1 = SELL",
            "example": 0
          },
          "marketId": {
            "type": "string",
            "description": "Internal market identifier"
          },
          "ownerId": {
            "type": "integer",
            "description": "Profile ID of the order owner",
            "example": 12345
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "market": {
            "type": "object",
            "description": "Slim market info",
            "properties": {
              "id": {
                "type": "integer",
                "example": 7348
              },
              "slug": {
                "type": "string",
                "example": "btc-up-or-down-1-hour"
              },
              "title": {
                "type": "string",
                "example": "BTC Up or Down - Hourly"
              },
              "status": {
                "type": "string",
                "enum": [
                  "FUNDED",
                  "RESOLVED",
                  "LOCKED",
                  "DRAFT",
                  "FUNDED_FLAGGED"
                ]
              },
              "yesPositionId": {
                "type": "string",
                "nullable": true
              },
              "noPositionId": {
                "type": "string",
                "nullable": true
              },
              "group": {
                "type": "object",
                "nullable": true,
                "properties": {
                  "id": {
                    "type": "integer"
                  },
                  "slug": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "owner": {
            "type": "object",
            "nullable": true,
            "description": "Public profile of the order owner",
            "properties": {
              "id": {
                "type": "integer"
              },
              "account": {
                "type": "string",
                "description": "Checksummed wallet address"
              },
              "displayName": {
                "type": "string",
                "nullable": true
              },
              "username": {
                "type": "string",
                "nullable": true
              },
              "imageURI": {
                "type": "string",
                "nullable": true
              }
            }
          }
        },
        "required": [
          "id",
          "salt",
          "maker",
          "signer",
          "tokenId",
          "makerAmount",
          "takerAmount",
          "signatureType",
          "signature",
          "orderType",
          "side",
          "marketId",
          "ownerId",
          "createdAt",
          "market"
        ]
      },
      "OrderResponseDto": {
        "type": "object",
        "properties": {
          "order": {
            "description": "Order details including slim market and owner",
            "$ref": "#/components/schemas/CreatedOrderDto"
          },
          "makerMatches": {
            "description": "Maker matches if order was matched immediately",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MakerMatch"
            }
          },
          "execution": {
            "description": "Execution and settlement summary",
            "$ref": "#/components/schemas/OrderExecutionDto"
          }
        },
        "required": [
          "order",
          "execution"
        ]
      },
      "CancelReplaceOrderDto": {
        "type": "object",
        "description": "Replacement order fields. This is the POST /orders request shape without onBehalfOf; delegation is set on the enclosing cancel-replace operation.",
        "properties": {
          "order": {
            "description": "Order details including signature and amounts",
            "allOf": [
              {
                "$ref": "#/components/schemas/Order"
              }
            ]
          },
          "ownerId": {
            "type": "number",
            "description": "Profile ID that owns both the canceled order and its replacement",
            "example": 12345
          },
          "orderType": {
            "type": "string",
            "description": "Replacement order type",
            "enum": [
              "FAK",
              "FOK",
              "GTC"
            ],
            "example": "GTC"
          },
          "marketSlug": {
            "type": "string",
            "description": "Market identifier slug",
            "example": "btc-100k"
          },
          "postOnly": {
            "type": "boolean",
            "description": "Reject the replacement if it would match immediately. Supported only for GTC orders.",
            "example": true
          },
          "clientOrderId": {
            "type": "string",
            "description": "Client-provided idempotency key for the replacement",
            "example": "replacement-order-001",
            "maxLength": 128
          },
          "timestamp": {
            "type": "number",
            "description": "Optional client-stamped replacement creation time as Unix milliseconds",
            "example": 1735689600000,
            "minimum": 0
          },
          "recvWindow": {
            "type": "number",
            "description": "Optional maximum accepted replacement age in milliseconds",
            "example": 1500,
            "minimum": 1,
            "maximum": 10000
          },
          "stpPolicy": {
            "type": "string",
            "description": "Self-trade prevention policy for the replacement",
            "enum": [
              "cancel_both",
              "cancel_maker",
              "cancel_taker"
            ],
            "example": "cancel_maker"
          }
        },
        "required": [
          "order",
          "ownerId",
          "orderType",
          "marketSlug"
        ]
      },
      "CancelReplaceDto": {
        "type": "object",
        "properties": {
          "cancel": {
            "description": "Order to cancel; provide exactly one identifier",
            "allOf": [
              {
                "$ref": "#/components/schemas/CancelOrderCombinedDto"
              }
            ]
          },
          "replacement": {
            "$ref": "#/components/schemas/CancelReplaceOrderDto"
          },
          "mode": {
            "type": "string",
            "description": "Whether to stop this operation or attempt replacement after cancellation failure",
            "enum": [
              "ALLOW_FAILURE",
              "STOP_ON_FAILURE"
            ],
            "example": "STOP_ON_FAILURE"
          },
          "onBehalfOf": {
            "type": "integer",
            "minimum": 1,
            "description": "Authorized partner sub-account profile ID. Applies to both cancellation and replacement.",
            "example": 12345
          }
        },
        "required": [
          "cancel",
          "replacement",
          "mode"
        ]
      },
      "CancelReplaceBatchDto": {
        "type": "object",
        "properties": {
          "operations": {
            "type": "array",
            "description": "Independent cancel-and-replace operations",
            "minItems": 1,
            "maxItems": 4,
            "items": {
              "$ref": "#/components/schemas/CancelReplaceDto"
            }
          }
        },
        "required": [
          "operations"
        ]
      },
      "CancelReplaceError": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "example": "ORDER_NOT_FOUND"
          },
          "message": {
            "type": "string",
            "example": "Order not found"
          }
        },
        "required": [
          "code",
          "message"
        ]
      },
      "CancelReplaceCancelSuccess": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "SUCCESS"
            ]
          },
          "orderId": {
            "type": "string",
            "format": "uuid"
          },
          "clientOrderId": {
            "type": "string"
          }
        },
        "required": [
          "status",
          "orderId"
        ]
      },
      "CancelReplaceCancelError": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "FAILURE",
              "UNKNOWN"
            ]
          },
          "error": {
            "$ref": "#/components/schemas/CancelReplaceError"
          }
        },
        "required": [
          "status",
          "error"
        ]
      },
      "CancelReplaceCancelResult": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/CancelReplaceCancelSuccess"
          },
          {
            "$ref": "#/components/schemas/CancelReplaceCancelError"
          }
        ]
      },
      "CancelReplacePlacementSuccess": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "SUCCESS"
            ]
          },
          "data": {
            "$ref": "#/components/schemas/OrderResponseDto"
          }
        },
        "required": [
          "status",
          "data"
        ]
      },
      "CancelReplacePlacementError": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "FAILURE",
              "UNKNOWN"
            ]
          },
          "error": {
            "$ref": "#/components/schemas/CancelReplaceError"
          }
        },
        "required": [
          "status",
          "error"
        ]
      },
      "CancelReplacePlacementNotAttempted": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "NOT_ATTEMPTED"
            ]
          }
        },
        "required": [
          "status"
        ]
      },
      "CancelReplacePlacementResult": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/CancelReplacePlacementSuccess"
          },
          {
            "$ref": "#/components/schemas/CancelReplacePlacementError"
          },
          {
            "$ref": "#/components/schemas/CancelReplacePlacementNotAttempted"
          }
        ]
      },
      "CancelReplaceResponseDto": {
        "type": "object",
        "description": "Independent cancellation and replacement outcomes.",
        "properties": {
          "cancel": {
            "$ref": "#/components/schemas/CancelReplaceCancelResult"
          },
          "replacement": {
            "$ref": "#/components/schemas/CancelReplacePlacementResult"
          }
        },
        "required": [
          "cancel",
          "replacement"
        ]
      },
      "CancelReplaceBatchResponseDto": {
        "type": "object",
        "properties": {
          "results": {
            "type": "array",
            "description": "Outcomes in input order. Each item includes its zero-based input index.",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/CancelReplaceResponseDto"
                },
                {
                  "type": "object",
                  "properties": {
                    "index": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Zero-based input operation index"
                    }
                  },
                  "required": [
                    "index"
                  ]
                }
              ]
            }
          }
        },
        "required": [
          "results"
        ]
      },
      "CancelOrderCombinedDto": {
        "type": "object",
        "properties": {
          "orderId": {
            "type": "string",
            "format": "uuid",
            "description": "Internal order ID. Provide exactly one of orderId or clientOrderId.",
            "example": "6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203"
          },
          "clientOrderId": {
            "type": "string",
            "maxLength": 128,
            "description": "Client-provided order ID from order creation. Provide exactly one of orderId or clientOrderId.",
            "example": "partner-order-001"
          }
        },
        "oneOf": [
          {
            "required": [
              "orderId"
            ]
          },
          {
            "required": [
              "clientOrderId"
            ]
          }
        ]
      },
      "CancelOrderBatchCombinedDto": {
        "type": "object",
        "properties": {
          "orderIds": {
            "type": "array",
            "description": "Internal order IDs. Provide exactly one of orderIds or clientOrderIds.",
            "maxItems": 50,
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "example": [
              "6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203"
            ]
          },
          "clientOrderIds": {
            "type": "array",
            "description": "Client-provided order IDs from order creation. Provide exactly one of orderIds or clientOrderIds.",
            "maxItems": 50,
            "items": {
              "type": "string",
              "maxLength": 128
            },
            "example": [
              "partner-order-001",
              "partner-order-002"
            ]
          }
        },
        "oneOf": [
          {
            "required": [
              "orderIds"
            ]
          },
          {
            "required": [
              "clientOrderIds"
            ]
          }
        ]
      },
      "ClientOrderCancelSuccess": {
        "type": "object",
        "properties": {
          "clientOrderId": {
            "type": "string",
            "description": "Client-provided order ID from order creation",
            "example": "partner-order-001"
          },
          "orderId": {
            "type": "string",
            "format": "uuid",
            "description": "Internal order ID",
            "example": "6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203"
          }
        },
        "required": [
          "clientOrderId",
          "orderId"
        ]
      },
      "ClientOrderCancelFailure": {
        "type": "object",
        "properties": {
          "clientOrderId": {
            "type": "string",
            "description": "Client-provided order ID from order creation",
            "example": "partner-order-002"
          },
          "orderId": {
            "type": "string",
            "format": "uuid",
            "description": "Internal order ID, when resolution succeeded before cancellation failed",
            "example": "6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203"
          },
          "reason": {
            "type": "string",
            "description": "Failure reason",
            "example": "ORDER_NOT_FOUND"
          },
          "message": {
            "type": "string",
            "description": "Human-readable failure message",
            "example": "Order not found"
          }
        },
        "required": [
          "clientOrderId",
          "reason",
          "message"
        ]
      },
      "CancelOrderBatchCombinedResponseDto": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "example": "Orders canceled successfully"
          },
          "canceled": {
            "description": "Canceled client-order-id records",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ClientOrderCancelSuccess"
            }
          },
          "failed": {
            "description": "Client-order-id cancel failures",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ClientOrderCancelFailure"
            }
          }
        },
        "required": [
          "message"
        ]
      },
      "CancelOrderResponseDto": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "Confirmation message for the cancelled order",
            "example": "Order canceled successfully"
          }
        },
        "required": [
          "message"
        ]
      },
      "DeleteOrderBatchDto": {
        "type": "object",
        "properties": {
          "orderIds": {
            "description": "Array of order IDs to be cancelled in a single batch operation",
            "example": [
              "6f52b6d2-6c9e-4a5c-8a4f-28ab4b7ff203",
              "9e31c452-8a2b-42d1-b327-65f18d07dc96"
            ],
            "items": {
              "type": "array"
            },
            "type": "array"
          }
        },
        "required": [
          "orderIds"
        ]
      },
      "CancelOrderFailure": {
        "type": "object",
        "properties": {
          "orderId": {
            "type": "string",
            "description": "Order ID that failed to cancel",
            "example": "b53f0e4b-1529-45cc-ad39-e27f4c6eab5a"
          },
          "reason": {
            "type": "string",
            "description": "Error code indicating the reason for failure",
            "example": "ORDER_NOT_FOUND",
            "enum": [
              "ORDER_NOT_FOUND",
              "UNKNOWN_ERROR"
            ]
          },
          "message": {
            "type": "string",
            "description": "User-friendly error message",
            "example": "Order not found or already canceled"
          }
        },
        "required": [
          "orderId",
          "reason",
          "message"
        ]
      },
      "CancelOrderBatchResponseDto": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "Confirmation message for the cancelled orders",
            "example": "Orders canceled successfully"
          },
          "canceled": {
            "description": "Array of successfully cancelled order IDs",
            "example": [
              "611badac-8dfc-48a0-b09e-59654adea1c5"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "failed": {
            "description": "Array of orders that failed to cancel with reasons",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CancelOrderFailure"
            }
          }
        },
        "required": [
          "message"
        ]
      },
      "CancelAllOrdersResponseDto": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "Confirmation message for cancelling all orders",
            "example": "Orders canceled successfully"
          },
          "canceled": {
            "description": "Array of successfully cancelled order IDs",
            "example": [
              "611badac-8dfc-48a0-b09e-59654adea1c5"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "failed": {
            "description": "Array of orders that failed to cancel with reasons",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CancelOrderFailure"
            }
          }
        },
        "required": [
          "message"
        ]
      },
      "BatchOrderStatusItemDto": {
        "type": "object",
        "properties": {
          "orderId": {
            "type": "string",
            "format": "uuid",
            "description": "Internal order ID. Provide either orderId or clientOrderId, not both.",
            "example": "4aa706dd-6c57-4f3c-945a-99818dfd95f1"
          },
          "clientOrderId": {
            "type": "string",
            "maxLength": 128,
            "description": "Client-provided order ID. Provide either orderId or clientOrderId, not both.",
            "example": "client-order-001"
          }
        }
      },
      "BatchOrderStatusRequestDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "description": "List of status lookup queries (1-50 items)",
            "minItems": 1,
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/BatchOrderStatusItemDto"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "OrderExecutionSummary": {
        "type": "object",
        "properties": {
          "clientOrderId": {
            "type": "string",
            "nullable": true,
            "description": "Client-provided order ID if one was set"
          },
          "feeRateBps": {
            "type": "number",
            "description": "Fee rate in basis points",
            "example": 0
          },
          "effectiveFeeBps": {
            "type": "number",
            "description": "Effective fee rate after rebates",
            "example": 0
          },
          "matched": {
            "type": "boolean",
            "description": "Whether the order was matched with a counterparty"
          },
          "settlementStatus": {
            "type": "string",
            "description": "On-chain settlement status. DELAYED means the order was accepted but is held by a per-market taker delay before being released to the matching engine. CANCELED with reason STP_TAKER_REJECTED means self-trade prevention rejected the order.",
            "enum": [
              "UNMATCHED",
              "PENDING",
              "MINED",
              "CONFIRMED",
              "FAILED",
              "DELAYED",
              "CANCELED"
            ]
          },
          "eligibleAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "ISO-8601 time a delayed (taker-delay) order is released to the matching engine. Present only when settlementStatus is DELAYED."
          },
          "tradeEventId": {
            "type": "string",
            "nullable": true,
            "description": "Trade event ID if matched"
          },
          "txHash": {
            "type": "string",
            "nullable": true,
            "description": "Transaction hash on Base L2"
          },
          "totalsRaw": {
            "type": "object",
            "description": "Raw execution totals as strings (to preserve precision)",
            "properties": {
              "contractsGross": {
                "type": "string"
              },
              "contractsFee": {
                "type": "string"
              },
              "contractsNet": {
                "type": "string"
              },
              "usdGross": {
                "type": "string"
              },
              "usdFee": {
                "type": "string"
              },
              "usdNet": {
                "type": "string"
              }
            }
          }
        }
      },
      "BatchOrderStatusResultDto": {
        "type": "object",
        "properties": {
          "index": {
            "type": "number",
            "description": "Index of this item in the request array",
            "example": 0
          },
          "status": {
            "type": "string",
            "enum": [
              "found",
              "not_found",
              "invalid"
            ],
            "description": "Lookup result status",
            "example": "found"
          },
          "error": {
            "type": "string",
            "nullable": true,
            "description": "Error message if status is 'invalid'",
            "example": "Exactly one of orderId or clientOrderId is required"
          },
          "orderId": {
            "type": "string",
            "nullable": true,
            "description": "Resolved internal order ID"
          },
          "clientOrderId": {
            "type": "string",
            "nullable": true,
            "description": "Client-provided order ID"
          },
          "data": {
            "type": "object",
            "nullable": true,
            "description": "Order data if found",
            "properties": {
              "order": {
                "$ref": "#/components/schemas/OrderResponseDto"
              },
              "makerMatches": {
                "type": "array",
                "description": "Maker orders matched against this order",
                "items": {
                  "$ref": "#/components/schemas/MakerMatch"
                }
              },
              "execution": {
                "$ref": "#/components/schemas/OrderExecutionSummary"
              }
            }
          }
        },
        "required": [
          "index",
          "status"
        ]
      },
      "BatchOrderStatusResponseDto": {
        "type": "object",
        "properties": {
          "results": {
            "type": "array",
            "description": "Array of status results corresponding to request items",
            "items": {
              "$ref": "#/components/schemas/BatchOrderStatusResultDto"
            }
          }
        },
        "required": [
          "results"
        ]
      },
      "DeriveApiTokenRequest": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "maxLength": 128,
            "description": "Human-readable label for the token",
            "example": "production-trading-bot"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "trading",
                "account_creation",
                "delegated_signing"
              ]
            },
            "description": "Scopes to grant. Defaults to [\"trading\"] if omitted. Must be a subset of the partner's allowed scopes. `delegated_signing` requires `trading`.",
            "example": [
              "trading",
              "account_creation"
            ]
          }
        }
      },
      "DeriveApiTokenResponse": {
        "type": "object",
        "properties": {
          "apiKey": {
            "type": "string",
            "description": "The token ID, used as the `lmts-api-key` header value for HMAC requests",
            "example": "dGVzdC10b2tlbi0x"
          },
          "secret": {
            "type": "string",
            "description": "Base64-encoded secret for HMAC signing. Returned once — store securely.",
            "example": "c2VjcmV0LWtleS1leGFtcGxlLWJhc2U2NC1lbmNvZGVk"
          },
          "tokenId": {
            "type": "string",
            "description": "Same as apiKey. The unique token identifier.",
            "example": "dGVzdC10b2tlbi0x"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Token creation timestamp"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Granted scopes",
            "example": [
              "trading",
              "account_creation"
            ]
          },
          "profile": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer",
                "description": "Partner profile ID",
                "example": 42
              },
              "account": {
                "type": "string",
                "description": "Partner wallet address",
                "example": "0x27b4afBD88fE7c88c6897BB0b4ADE338D0401E37"
              }
            }
          }
        },
        "required": [
          "apiKey",
          "secret",
          "tokenId",
          "createdAt",
          "scopes",
          "profile"
        ]
      },
      "ApiTokenListItem": {
        "type": "object",
        "properties": {
          "tokenId": {
            "type": "string",
            "description": "Unique token identifier"
          },
          "label": {
            "type": "string",
            "nullable": true,
            "description": "Human-readable label"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Granted scopes"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Token creation timestamp"
          },
          "lastUsedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Last time the token was used for authentication"
          }
        },
        "required": [
          "tokenId",
          "label",
          "scopes",
          "createdAt",
          "lastUsedAt"
        ]
      },
      "PartnerCapabilitiesResponse": {
        "type": "object",
        "properties": {
          "partnerProfileId": {
            "type": "integer",
            "description": "Partner profile ID",
            "example": 42
          },
          "tokenManagementEnabled": {
            "type": "boolean",
            "description": "Whether the partner can manage tokens via self-service endpoints",
            "example": true
          },
          "allowedScopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "trading",
                "account_creation",
                "delegated_signing"
              ]
            },
            "description": "Scopes the partner is allowed to request when deriving tokens",
            "example": [
              "trading",
              "account_creation",
              "delegated_signing"
            ]
          }
        },
        "required": [
          "partnerProfileId",
          "tokenManagementEnabled",
          "allowedScopes"
        ]
      },
      "CreatePartnerAccountRequest": {
        "type": "object",
        "properties": {
          "displayName": {
            "type": "string",
            "maxLength": 44,
            "description": "Public display name for the sub-account. Defaults to the wallet address if omitted.",
            "example": "user-alice"
          },
          "createServerWallet": {
            "type": "boolean",
            "description": "If true, creates a Privy server wallet for the sub-account (enables delegated signing). If false or omitted, requires EOA wallet ownership headers.",
            "default": false
          }
        }
      },
      "CreatePartnerAccountResponse": {
        "type": "object",
        "properties": {
          "profileId": {
            "type": "integer",
            "description": "Profile ID of the created sub-account",
            "example": 789
          },
          "account": {
            "type": "string",
            "description": "Wallet address of the created sub-account",
            "example": "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed"
          }
        },
        "required": [
          "profileId",
          "account"
        ]
      },
      "PartnerAccountListItem": {
        "type": "object",
        "properties": {
          "profileId": {
            "type": "integer",
            "description": "Profile ID of the partner-owned sub-account",
            "example": 294
          },
          "account": {
            "type": "string",
            "description": "Wallet address of the sub-account",
            "example": "0x1676716Ef7F19B5C5d690631CB57cf0bFD900A3d"
          },
          "displayName": {
            "type": "string",
            "description": "Public display name of the sub-account",
            "example": "user-bob"
          }
        },
        "required": [
          "profileId",
          "account",
          "displayName"
        ]
      },
      "ListPartnerAccountsResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PartnerAccountListItem"
            }
          },
          "limit": {
            "type": "integer",
            "description": "Page size used by the server. Maximum is 25.",
            "example": 25
          },
          "page": {
            "type": "integer",
            "description": "Current page number",
            "example": 1
          },
          "hasMore": {
            "type": "boolean",
            "description": "Whether another page is available",
            "example": false
          }
        },
        "required": [
          "data",
          "limit",
          "page",
          "hasMore"
        ]
      },
      "PartnerAccountAllowanceSummary": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer",
            "description": "Total allowance target count",
            "example": 10
          },
          "confirmed": {
            "type": "integer",
            "description": "Targets confirmed on chain",
            "example": 2
          },
          "missing": {
            "type": "integer",
            "description": "Targets still missing",
            "example": 0
          },
          "submitted": {
            "type": "integer",
            "description": "Targets submitted by the current retry response",
            "example": 8
          },
          "failed": {
            "type": "integer",
            "description": "Targets whose latest live read or retry state failed",
            "example": 0
          }
        },
        "required": [
          "total",
          "confirmed",
          "missing",
          "submitted",
          "failed"
        ]
      },
      "PartnerAccountAllowanceTarget": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "USDC_ALLOWANCE",
              "CTF_APPROVAL"
            ],
            "description": "Allowance target category",
            "example": "USDC_ALLOWANCE"
          },
          "tokenAddress": {
            "type": "string",
            "description": "ERC20 or conditional-token contract address",
            "example": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
          },
          "spenderOrOperator": {
            "type": "string",
            "description": "Allowance spender or operator address",
            "example": "0x54d696A602343063000B25a51734E3BbE0Ec80a2"
          },
          "label": {
            "type": "string",
            "description": "Human-readable target label",
            "example": "ctf-exchange"
          },
          "requiredFor": {
            "type": "string",
            "enum": [
              "BUY",
              "SELL"
            ],
            "description": "Trading side that requires this target",
            "example": "BUY"
          },
          "confirmed": {
            "type": "boolean",
            "description": "Whether this target is confirmed on chain",
            "example": false
          },
          "status": {
            "type": "string",
            "enum": [
              "confirmed",
              "missing",
              "submitted",
              "failed"
            ],
            "description": "Current target status",
            "example": "submitted"
          },
          "transactionId": {
            "type": "string",
            "nullable": true,
            "description": "Sponsored transaction ID when submitted",
            "example": "tx_abc123"
          },
          "txHash": {
            "type": "string",
            "nullable": true,
            "description": "Transaction hash when available",
            "example": "0xabc123..."
          },
          "userOperationHash": {
            "type": "string",
            "nullable": true,
            "description": "User operation hash when available",
            "example": "0xdef456..."
          },
          "retryable": {
            "type": "boolean",
            "description": "Whether a retry request may attempt this target",
            "example": true
          },
          "errorCode": {
            "type": "string",
            "nullable": true,
            "description": "Machine-readable failure code",
            "example": "RPC_READ_FAILED"
          },
          "errorMessage": {
            "type": "string",
            "nullable": true,
            "description": "Human-readable failure message"
          }
        },
        "required": [
          "type",
          "tokenAddress",
          "spenderOrOperator",
          "label",
          "requiredFor",
          "confirmed",
          "status",
          "retryable"
        ]
      },
      "PartnerAccountAllowanceResponse": {
        "type": "object",
        "properties": {
          "profileId": {
            "type": "integer",
            "description": "Child/server-wallet profile ID being checked",
            "example": 4543
          },
          "partnerProfileId": {
            "type": "integer",
            "description": "Authenticated parent partner profile ID",
            "example": 4430
          },
          "chainId": {
            "type": "integer",
            "description": "Chain where allowance targets were checked",
            "example": 84532
          },
          "walletAddress": {
            "type": "string",
            "description": "Managed server-wallet address for the child profile",
            "example": "0x1a665817f063Ee15C6C2c05D4315982145825C3D"
          },
          "ready": {
            "type": "boolean",
            "description": "True when every target is confirmed on chain",
            "example": false
          },
          "summary": {
            "$ref": "#/components/schemas/PartnerAccountAllowanceSummary"
          },
          "targets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PartnerAccountAllowanceTarget"
            }
          }
        },
        "required": [
          "profileId",
          "partnerProfileId",
          "chainId",
          "walletAddress",
          "ready",
          "summary",
          "targets"
        ]
      },
      "PartnerAllowanceRetryRateLimitError": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "example": "Allowance retry rate limited"
          },
          "retryAfterSeconds": {
            "type": "integer",
            "description": "Seconds to wait before retrying",
            "example": 30
          }
        },
        "required": [
          "message",
          "retryAfterSeconds"
        ]
      },
      "CreateWithdrawalAddressDto": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string",
            "description": "External withdrawal destination address. The API validates and stores the checksummed address.",
            "example": "0x0F3262730c909408042F9Da345a916dc0e1F9787"
          },
          "label": {
            "type": "string",
            "description": "Optional label for operators and clients.",
            "example": "treasury"
          }
        },
        "required": [
          "address"
        ]
      },
      "RedeemPositionsDto": {
        "type": "object",
        "properties": {
          "conditionId": {
            "type": "string",
            "description": "The bytes32 conditionId of the resolved market to redeem",
            "example": "0xa0ba8fd0acc2b86585734c07eb3bef4133f584d5abde78a558a6b8bfc3bbdec0"
          },
          "onBehalfOf": {
            "type": "number",
            "description": "Profile ID of the managed sub-account (partner flow). Must be a child of the authenticated partner."
          }
        },
        "required": [
          "conditionId"
        ]
      },
      "WithdrawDto": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "string",
            "description": "Amount to withdraw in the smallest token unit (e.g. 1000000 = 1 USDC)",
            "example": "1000000"
          },
          "token": {
            "type": "string",
            "description": "ERC20 token address to withdraw. Defaults to USDC if omitted."
          },
          "destination": {
            "type": "string",
            "description": "Destination address for the withdrawal. Must be the authenticated account, smart wallet, or an active whitelisted withdrawal address. Defaults to the Etherspot smart wallet when available, otherwise the authenticated account. When onBehalfOf is set, the whitelist used is the authenticated caller's whitelist, not the target sub-account's."
          },
          "onBehalfOf": {
            "type": "number",
            "description": "Profile ID of the managed sub-account (partner flow). Must be a child of the authenticated partner."
          }
        },
        "required": [
          "amount"
        ]
      },
      "CollateralTokenDto": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string",
            "description": "Token contract address",
            "example": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
          },
          "decimals": {
            "type": "number",
            "description": "Token decimal places",
            "example": 6
          },
          "symbol": {
            "type": "string",
            "description": "Token symbol",
            "example": "USDC"
          }
        },
        "required": [
          "address",
          "decimals",
          "symbol"
        ]
      },
      "CreatorDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Creator display name",
            "example": "Limitless"
          },
          "imageURI": {
            "type": "string",
            "description": "Creator profile image URI",
            "example": "https://limitless.exchange/assets/images/logo.svg",
            "nullable": true
          },
          "link": {
            "type": "string",
            "description": "Creator social media link",
            "example": "https://x.com/trylimitless",
            "nullable": true
          },
          "address": {
            "type": "string",
            "description": "Creator wallet address",
            "example": "0x55257A9a03601B0587Ab4752FD42A87c4Bad2e1e"
          }
        },
        "required": [
          "name",
          "imageURI",
          "link",
          "address"
        ]
      },
      "MetadataDto": {
        "type": "object",
        "properties": {
          "fee": {
            "type": "boolean",
            "description": "Whether market has fees enabled",
            "example": true
          },
          "isBannered": {
            "type": "boolean",
            "description": "Whether market is featured in banner",
            "example": false
          },
          "isPolyArbitrage": {
            "type": "boolean",
            "description": "Whether market supports Polygon arbitrage",
            "example": false
          },
          "shouldMarketMake": {
            "type": "boolean",
            "description": "Whether market should be market made",
            "example": false
          }
        },
        "required": [
          "fee",
          "isBannered",
          "isPolyArbitrage"
        ]
      },
      "MarketSettingsDto": {
        "type": "object",
        "properties": {
          "minSize": {
            "type": "string",
            "description": "Minimum trade size in wei",
            "example": "50000000"
          },
          "maxSpread": {
            "type": "number",
            "description": "Maximum spread allowed",
            "example": 0.035
          },
          "dailyReward": {
            "type": "string",
            "description": "Daily reward amount",
            "example": "20"
          },
          "rewardsEpoch": {
            "type": "string",
            "description": "Rewards epoch in decimal format",
            "example": "0.013888888888888888"
          },
          "c": {
            "type": "string",
            "description": "C parameter",
            "example": "3"
          }
        },
        "required": [
          "minSize",
          "maxSpread",
          "dailyReward",
          "rewardsEpoch",
          "c"
        ]
      },
      "TokenPairDto": {
        "type": "object",
        "properties": {
          "yes": {
            "type": "string",
            "description": "YES token ID",
            "example": "78695809706775235377718830617502491971378663350108823320552375535762230401980"
          },
          "no": {
            "type": "string",
            "description": "NO token ID",
            "example": "8642544735724967665477930445154251213223700833624811358896571351781151616445"
          }
        },
        "required": [
          "yes",
          "no"
        ]
      },
      "TradePricesDto": {
        "type": "object",
        "properties": {
          "buy": {
            "type": "object",
            "description": "Buy prices for market and limit orders",
            "properties": {
              "market": {
                "type": "array",
                "items": {
                  "type": "number"
                },
                "example": [
                  0.997,
                  0.997
                ]
              },
              "limit": {
                "type": "array",
                "items": {
                  "type": "number"
                },
                "example": [
                  0.003,
                  0.003
                ]
              }
            }
          },
          "sell": {
            "type": "object",
            "description": "Sell prices for market and limit orders",
            "properties": {
              "market": {
                "type": "array",
                "items": {
                  "type": "number"
                },
                "example": [
                  0.003,
                  0.003
                ]
              },
              "limit": {
                "type": "array",
                "items": {
                  "type": "number"
                },
                "example": [
                  0.997,
                  0.997
                ]
              }
            }
          }
        },
        "required": [
          "buy",
          "sell"
        ]
      },
      "FeedEventUserDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "number",
            "description": "User ID",
            "example": 7080
          },
          "account": {
            "type": "string",
            "description": "User wallet address",
            "example": "0xea27f6788F083e6070961d3E52A2e596367E04CC"
          },
          "username": {
            "type": "string",
            "description": "Username",
            "example": null,
            "nullable": true
          },
          "displayName": {
            "type": "string",
            "description": "Display name",
            "example": "GG",
            "nullable": true
          },
          "rankName": {
            "type": "string",
            "description": "User ranking name",
            "example": "Bronze"
          },
          "points": {
            "type": "string",
            "description": "User points balance",
            "example": "0.00000000"
          },
          "name": {
            "type": "string",
            "description": "User display name for feed events",
            "example": "GG"
          },
          "imageURI": {
            "type": "string",
            "description": "User profile image URI",
            "example": null,
            "nullable": true
          }
        },
        "required": [
          "account",
          "username",
          "displayName",
          "imageURI"
        ]
      },
      "FeedEventDataDto": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "description": "Market title",
            "example": "DOGE Up or Down - Hourly"
          },
          "address": {
            "type": "string",
            "description": "Market contract address",
            "example": "0x76d3e2098Be66Aa7E15138F467390f0Eb7349B9b"
          },
          "slug": {
            "type": "string",
            "description": "Market slug",
            "example": "doge-up-or-down-1-hour-1756136880125"
          },
          "strategy": {
            "type": "string",
            "description": "Trading strategy",
            "example": "Buy",
            "enum": [
              "Buy",
              "Sell"
            ]
          },
          "outcome": {
            "type": "string",
            "description": "Market outcome",
            "example": "Down",
            "enum": [
              "YES",
              "NO",
              "Up",
              "Down"
            ]
          },
          "contracts": {
            "type": "string",
            "description": "Number of contracts traded",
            "example": "9.071313"
          },
          "txHash": {
            "type": "string",
            "description": "Transaction hash",
            "example": "0xe8a4464daf3561f6be5fef4d1bc64184c4f6fe9d6306ab7297fe7ed63a24df1c"
          },
          "symbol": {
            "type": "string",
            "description": "Collateral token symbol",
            "example": "USDC"
          },
          "tradeAmount": {
            "type": "string",
            "description": "Trade amount in collateral token",
            "example": "5"
          },
          "tradeAmountUSD": {
            "type": "string",
            "description": "Trade amount in USD",
            "example": "4.999525"
          },
          "marketId": {
            "type": "number",
            "description": "Market ID",
            "example": 7495
          }
        },
        "required": [
          "title",
          "address",
          "strategy",
          "outcome",
          "contracts",
          "txHash",
          "symbol",
          "tradeAmount",
          "tradeAmountUSD",
          "marketId"
        ]
      },
      "FeedEventDto": {
        "type": "object",
        "properties": {
          "eventType": {
            "type": "string",
            "description": "Type of feed event",
            "example": "NEW_TRADE",
            "enum": [
              "NEW_TRADE",
              "MARKET_CREATED",
              "MARKET_RESOLVED"
            ]
          },
          "timestamp": {
            "type": "string",
            "description": "Event timestamp in ISO format",
            "example": "2025-09-01T11:30:31.000Z"
          },
          "user": {
            "description": "User who triggered the event",
            "allOf": [
              {
                "$ref": "#/components/schemas/FeedEventUserDto"
              }
            ]
          },
          "data": {
            "description": "Event-specific data",
            "allOf": [
              {
                "$ref": "#/components/schemas/FeedEventDataDto"
              }
            ]
          },
          "bodyHash": {
            "type": "string",
            "description": "Unique hash for the event",
            "example": "01100995"
          }
        },
        "required": [
          "eventType",
          "timestamp",
          "user",
          "data",
          "bodyHash"
        ]
      },
      "ClobMarketResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "number",
            "description": "Market ID",
            "example": 7494
          },
          "conditionId": {
            "type": "string",
            "description": "Condition ID",
            "example": "0x947b8e6812bf8ac27687fa25b642d6a25bf5c7292068e5aef129d9d26e9780b8"
          },
          "negRiskRequestId": {
            "type": "string",
            "description": "NegRisk request ID",
            "example": null,
            "nullable": true
          },
          "description": {
            "type": "string",
            "description": "Market description"
          },
          "collateralToken": {
            "$ref": "#/components/schemas/CollateralTokenDto"
          },
          "title": {
            "type": "string",
            "description": "Market title"
          },
          "proxyTitle": {
            "type": "string",
            "description": "Proxy title",
            "nullable": true
          },
          "expirationDate": {
            "type": "string",
            "description": "Expiration date"
          },
          "expirationTimestamp": {
            "type": "number",
            "description": "Expiration timestamp"
          },
          "createdAt": {
            "type": "string",
            "description": "Created timestamp"
          },
          "updatedAt": {
            "type": "string",
            "description": "Updated timestamp"
          },
          "categories": {
            "description": "Categories",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "status": {
            "type": "string",
            "description": "Market status"
          },
          "expired": {
            "type": "boolean",
            "description": "Is expired"
          },
          "creator": {
            "$ref": "#/components/schemas/CreatorDto"
          },
          "tags": {
            "description": "Tags",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "frequency": {
            "type": "string",
            "description": "Schedule frequency for timeline",
            "example": "minutely"
          },
          "subFrequency": {
            "type": "string",
            "description": "Schedule sub-frequency for timeline",
            "nullable": true,
            "example": "minutes_5"
          },
          "volume": {
            "type": "string",
            "description": "Volume"
          },
          "volumeFormatted": {
            "type": "string",
            "description": "Formatted volume"
          },
          "tokens": {
            "$ref": "#/components/schemas/TokenPairDto"
          },
          "prices": {
            "description": "Prices",
            "type": "array",
            "items": {
              "type": "number"
            }
          },
          "tradePrices": {
            "$ref": "#/components/schemas/TradePricesDto"
          },
          "isRewardable": {
            "type": "boolean",
            "description": "Is rewardable"
          },
          "slug": {
            "type": "string",
            "description": "Market slug"
          },
          "tradeType": {
            "type": "string",
            "description": "Trade type",
            "example": "clob"
          },
          "marketType": {
            "type": "string",
            "description": "Market type",
            "example": "single"
          },
          "priorityIndex": {
            "type": "number",
            "description": "Priority index"
          },
          "winningOutcomeIndex": {
            "type": "number",
            "description": "Winning outcome index",
            "nullable": true
          },
          "metadata": {
            "$ref": "#/components/schemas/MetadataDto"
          },
          "settings": {
            "$ref": "#/components/schemas/MarketSettingsDto"
          },
          "logo": {
            "type": "string",
            "description": "Market logo",
            "nullable": true
          },
          "source": {
            "type": "string",
            "description": "Market source (e.g. ugm:crypto, ugm:sports)",
            "nullable": true
          },
          "feedEvents": {
            "description": "Feed events",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FeedEventDto"
            }
          }
        },
        "required": [
          "id",
          "conditionId",
          "negRiskRequestId",
          "description",
          "collateralToken",
          "title",
          "proxyTitle",
          "expirationDate",
          "expirationTimestamp",
          "createdAt",
          "updatedAt",
          "categories",
          "status",
          "expired",
          "creator",
          "tags",
          "volume",
          "volumeFormatted",
          "tokens",
          "prices",
          "tradePrices",
          "isRewardable",
          "slug",
          "tradeType",
          "marketType",
          "priorityIndex",
          "winningOutcomeIndex",
          "metadata",
          "settings",
          "logo",
          "source"
        ]
      },
      "GroupMarketDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "number",
            "description": "Market ID",
            "example": 7494
          },
          "conditionId": {
            "type": "string",
            "description": "Condition ID",
            "example": "0x947b8e6812bf8ac27687fa25b642d6a25bf5c7292068e5aef129d9d26e9780b8"
          },
          "negRiskRequestId": {
            "type": "string",
            "description": "NegRisk request ID",
            "example": null,
            "nullable": true
          },
          "description": {
            "type": "string",
            "description": "Market description"
          },
          "collateralToken": {
            "$ref": "#/components/schemas/CollateralTokenDto"
          },
          "title": {
            "type": "string",
            "description": "Market title"
          },
          "proxyTitle": {
            "type": "string",
            "description": "Proxy title",
            "nullable": true
          },
          "expirationDate": {
            "type": "string",
            "description": "Expiration date"
          },
          "expirationTimestamp": {
            "type": "number",
            "description": "Expiration timestamp"
          },
          "createdAt": {
            "type": "string",
            "description": "Created timestamp"
          },
          "updatedAt": {
            "type": "string",
            "description": "Updated timestamp"
          },
          "categories": {
            "description": "Categories",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "status": {
            "type": "string",
            "description": "Market status"
          },
          "expired": {
            "type": "boolean",
            "description": "Is expired"
          },
          "creator": {
            "$ref": "#/components/schemas/CreatorDto"
          },
          "tags": {
            "description": "Tags",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "frequency": {
            "type": "string",
            "description": "Schedule frequency for timeline",
            "example": "minutely"
          },
          "subFrequency": {
            "type": "string",
            "description": "Schedule sub-frequency for timeline",
            "nullable": true,
            "example": "minutes_5"
          },
          "volume": {
            "type": "string",
            "description": "Volume"
          },
          "volumeFormatted": {
            "type": "string",
            "description": "Formatted volume"
          },
          "tokens": {
            "$ref": "#/components/schemas/TokenPairDto"
          },
          "prices": {
            "description": "Prices",
            "type": "array",
            "items": {
              "type": "number"
            }
          },
          "tradePrices": {
            "$ref": "#/components/schemas/TradePricesDto"
          },
          "isRewardable": {
            "type": "boolean",
            "description": "Is rewardable"
          },
          "slug": {
            "type": "string",
            "description": "Market slug"
          },
          "tradeType": {
            "type": "string",
            "description": "Trade type",
            "example": "clob"
          },
          "marketType": {
            "type": "string",
            "description": "Market type",
            "example": "single"
          },
          "priorityIndex": {
            "type": "number",
            "description": "Priority index"
          },
          "winningOutcomeIndex": {
            "type": "number",
            "description": "Winning outcome index",
            "nullable": true
          },
          "metadata": {
            "$ref": "#/components/schemas/MetadataDto"
          },
          "settings": {
            "$ref": "#/components/schemas/MarketSettingsDto"
          },
          "logo": {
            "type": "string",
            "description": "Market logo",
            "nullable": true
          },
          "source": {
            "type": "string",
            "description": "Market source (e.g. ugm:crypto, ugm:sports)",
            "nullable": true
          },
          "feedEvents": {
            "description": "Feed events",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FeedEventDto"
            }
          },
          "orderInGroup": {
            "type": "number",
            "description": "Order in group"
          }
        },
        "required": [
          "id",
          "conditionId",
          "negRiskRequestId",
          "description",
          "collateralToken",
          "title",
          "proxyTitle",
          "expirationDate",
          "expirationTimestamp",
          "createdAt",
          "updatedAt",
          "categories",
          "status",
          "expired",
          "creator",
          "tags",
          "volume",
          "volumeFormatted",
          "tokens",
          "prices",
          "tradePrices",
          "isRewardable",
          "slug",
          "tradeType",
          "marketType",
          "priorityIndex",
          "winningOutcomeIndex",
          "metadata",
          "settings",
          "logo",
          "source"
        ]
      },
      "NegRiskGroupResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "number",
            "description": "Group ID",
            "example": 10000078
          },
          "slug": {
            "type": "string",
            "description": "Group slug"
          },
          "outcomeTokens": {
            "description": "Outcome tokens",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "title": {
            "type": "string",
            "description": "Group title"
          },
          "ogImageURI": {
            "type": "string",
            "description": "OG image URI"
          },
          "imageUrl": {
            "type": "string",
            "description": "Group image URL",
            "nullable": true
          },
          "expirationDate": {
            "type": "string",
            "description": "Expiration date"
          },
          "expirationTimestamp": {
            "type": "number",
            "description": "Expiration timestamp"
          },
          "expired": {
            "type": "boolean",
            "description": "Is expired"
          },
          "creator": {
            "$ref": "#/components/schemas/CreatorDto"
          },
          "collateralToken": {
            "$ref": "#/components/schemas/CollateralTokenDto"
          },
          "tags": {
            "description": "Tags",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "frequency": {
            "type": "string",
            "description": "Schedule frequency for timeline",
            "example": "minutely"
          },
          "subFrequency": {
            "type": "string",
            "description": "Schedule sub-frequency for timeline",
            "nullable": true,
            "example": "minutes_5"
          },
          "tradeType": {
            "type": "string",
            "description": "Trade type",
            "example": "clob"
          },
          "marketType": {
            "type": "string",
            "description": "Market type",
            "example": "group"
          },
          "createdAt": {
            "type": "string",
            "description": "Created timestamp"
          },
          "updatedAt": {
            "type": "string",
            "description": "Updated timestamp"
          },
          "categories": {
            "description": "Categories",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "status": {
            "type": "string",
            "description": "Status"
          },
          "priorityIndex": {
            "type": "number",
            "description": "Priority index"
          },
          "negRiskMarketId": {
            "type": "string",
            "description": "NegRisk market ID"
          },
          "markets": {
            "description": "Markets in the group",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GroupMarketDto"
            }
          },
          "metadata": {
            "$ref": "#/components/schemas/MetadataDto"
          },
          "volume": {
            "type": "string",
            "description": "Volume"
          },
          "volumeFormatted": {
            "type": "string",
            "description": "Formatted volume"
          },
          "dailyReward": {
            "type": "string",
            "description": "Daily reward"
          },
          "source": {
            "type": "string",
            "description": "Market source (e.g. ugm:crypto, ugm:sports)",
            "nullable": true
          },
          "feedEvents": {
            "description": "Feed events",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FeedEventDto"
            }
          }
        },
        "required": [
          "id",
          "slug",
          "outcomeTokens",
          "title",
          "ogImageURI",
          "imageUrl",
          "expirationDate",
          "expirationTimestamp",
          "expired",
          "creator",
          "collateralToken",
          "tags",
          "tradeType",
          "marketType",
          "createdAt",
          "updatedAt",
          "categories",
          "status",
          "priorityIndex",
          "negRiskMarketId",
          "markets",
          "metadata",
          "volume",
          "volumeFormatted",
          "dailyReward",
          "source",
          "feedEvents"
        ]
      },
      "AmmMarketResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "number",
            "description": "Market ID",
            "example": 7497
          },
          "address": {
            "type": "string",
            "description": "Market address"
          },
          "conditionId": {
            "type": "string",
            "description": "Condition ID"
          },
          "description": {
            "type": "string",
            "description": "Market description"
          },
          "collateralToken": {
            "$ref": "#/components/schemas/CollateralTokenDto"
          },
          "title": {
            "type": "string",
            "description": "Market title"
          },
          "proxyTitle": {
            "type": "string",
            "description": "Proxy title",
            "nullable": true
          },
          "positionIds": {
            "description": "Position IDs",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "ogImageURI": {
            "type": "string",
            "description": "OG image URI",
            "nullable": true
          },
          "expirationDate": {
            "type": "string",
            "description": "Expiration date"
          },
          "expirationTimestamp": {
            "type": "number",
            "description": "Expiration timestamp"
          },
          "createdAt": {
            "type": "string",
            "description": "Created timestamp"
          },
          "updatedAt": {
            "type": "string",
            "description": "Updated timestamp"
          },
          "categories": {
            "description": "Categories",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "winningOutcomeIndex": {
            "type": "number",
            "description": "Winning outcome index",
            "nullable": true
          },
          "status": {
            "type": "string",
            "description": "Market status"
          },
          "expired": {
            "type": "boolean",
            "description": "Is expired"
          },
          "creator": {
            "$ref": "#/components/schemas/CreatorDto"
          },
          "tags": {
            "description": "Tags",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "openInterest": {
            "type": "string",
            "description": "Open interest"
          },
          "openInterestFormatted": {
            "type": "string",
            "description": "Formatted open interest"
          },
          "volume": {
            "type": "string",
            "description": "Volume"
          },
          "volumeFormatted": {
            "type": "string",
            "description": "Formatted volume"
          },
          "liquidity": {
            "type": "string",
            "description": "Liquidity"
          },
          "liquidityFormatted": {
            "type": "string",
            "description": "Formatted liquidity"
          },
          "slug": {
            "type": "string",
            "description": "Market slug"
          },
          "tradeType": {
            "type": "string",
            "description": "Trade type",
            "example": "amm"
          },
          "marketType": {
            "type": "string",
            "description": "Market type",
            "example": "single"
          },
          "priorityIndex": {
            "type": "number",
            "description": "Priority index"
          },
          "metadata": {
            "$ref": "#/components/schemas/MetadataDto"
          },
          "logo": {
            "type": "string",
            "description": "Market logo",
            "nullable": true
          },
          "source": {
            "type": "string",
            "description": "Market source (e.g. ugm:crypto, ugm:sports)",
            "nullable": true
          },
          "feedEvents": {
            "description": "Feed events",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FeedEventDto"
            }
          }
        },
        "required": [
          "id",
          "address",
          "conditionId",
          "description",
          "collateralToken",
          "title",
          "proxyTitle",
          "positionIds",
          "ogImageURI",
          "expirationDate",
          "expirationTimestamp",
          "createdAt",
          "updatedAt",
          "categories",
          "winningOutcomeIndex",
          "status",
          "expired",
          "creator",
          "tags",
          "openInterest",
          "openInterestFormatted",
          "volume",
          "volumeFormatted",
          "liquidity",
          "liquidityFormatted",
          "slug",
          "tradeType",
          "marketType",
          "priorityIndex",
          "metadata",
          "logo",
          "source",
          "feedEvents"
        ]
      },
      "ReferralUsdcTierLadderEntryDto": {
        "type": "object",
        "properties": {
          "minBasisRaw": {
            "type": "string",
            "example": "25000000000",
            "description": "Your own CLOB trading volume required to reach this tier. Raw USDC with 6 decimals, returned as a string. Divide by 1e6 for the dollar amount."
          },
          "name": {
            "type": "string",
            "example": "Bronze",
            "description": "Tier name."
          },
          "rate": {
            "type": "string",
            "example": "0.18",
            "description": "Referral rate at this tier as a decimal fraction (0.18 = 18% of the taker fees your referred users pay)."
          }
        },
        "required": [
          "minBasisRaw",
          "name",
          "rate"
        ]
      },
      "ReferralUsdcMeResponseDto": {
        "type": "object",
        "properties": {
          "customTier": {
            "type": "string",
            "example": "Gold",
            "description": "Pinned minimum tier name. Present only when a manual tier pin exists (for example a partner arrangement). The pin is a floor: the effective tier is the higher of this and the volume-derived tier."
          },
          "tiers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReferralUsdcTierLadderEntryDto"
            },
            "description": "The active tier ladder, ascending. Render tier progress from this instead of hardcoding thresholds."
          },
          "totalBasisRaw": {
            "type": "string",
            "example": "31500000000",
            "description": "Your own CLOB trading volume (maker + taker fills) accrued since the program start - the tier basis. Raw USDC with 6 decimals, returned as a string. Divide by 1e6 for the dollar amount."
          },
          "totalEarnedRaw": {
            "type": "string",
            "example": "184250000",
            "description": "Total USDC earned from the referral program across your referred users' eligible fills. Raw USDC with 6 decimals, returned as a string. Divide by 1e6 for the dollar amount."
          }
        },
        "required": [
          "tiers",
          "totalBasisRaw",
          "totalEarnedRaw"
        ]
      },
      "ReferralUsdcReferralEntryDto": {
        "type": "object",
        "properties": {
          "account": {
            "type": "string",
            "description": "The referred user's account address."
          },
          "avatarAccount": {
            "type": "string",
            "description": "Address used to derive the fallback avatar."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the referral was credited."
          },
          "displayName": {
            "type": "string",
            "nullable": true
          },
          "earnedRaw": {
            "type": "string",
            "description": "USDC you have earned from this user's fills. Raw USDC with 6 decimals, returned as a string. Divide by 1e6 for the dollar amount."
          },
          "feesGeneratedRaw": {
            "type": "string",
            "description": "Taker fees this user has generated. Raw USDC with 6 decimals, returned as a string. Divide by 1e6 for the dollar amount."
          },
          "pfpUrl": {
            "type": "string",
            "nullable": true
          },
          "referredProfileId": {
            "type": "number"
          },
          "volumeRaw": {
            "type": "string",
            "description": "The referred user's trading volume. Raw USDC with 6 decimals, returned as a string. Divide by 1e6 for the dollar amount."
          }
        },
        "required": [
          "account",
          "avatarAccount",
          "createdAt",
          "displayName",
          "earnedRaw",
          "feesGeneratedRaw",
          "pfpUrl",
          "referredProfileId",
          "volumeRaw"
        ]
      },
      "ReferralUsdcReferralsCountsDto": {
        "type": "object",
        "properties": {
          "all": {
            "type": "number",
            "description": "Every credited referred user."
          },
          "awaiting": {
            "type": "number",
            "description": "Referred users who have not traded yet."
          },
          "earning": {
            "type": "number",
            "description": "Referred users who have traded."
          }
        },
        "required": [
          "all",
          "awaiting",
          "earning"
        ]
      },
      "ReferralUsdcReferralsResponseDto": {
        "type": "object",
        "properties": {
          "counts": {
            "$ref": "#/components/schemas/ReferralUsdcReferralsCountsDto"
          },
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReferralUsdcReferralEntryDto"
            }
          },
          "limit": {
            "type": "number"
          },
          "offset": {
            "type": "number"
          },
          "total": {
            "type": "number",
            "description": "Rows matching the current status filter (drives pagination of the current view)."
          }
        },
        "required": [
          "counts",
          "entries",
          "limit",
          "offset",
          "total"
        ]
      },
      "ReferralUsdcLeaderboardEntryDto": {
        "type": "object",
        "properties": {
          "account": {
            "type": "string",
            "description": "The referrer's account address."
          },
          "avatarAccount": {
            "type": "string",
            "description": "Address used to derive the fallback avatar."
          },
          "displayName": {
            "type": "string",
            "nullable": true
          },
          "earnedRaw": {
            "type": "string",
            "description": "Total USDC this referrer has earned from the program. Raw USDC with 6 decimals, returned as a string. Divide by 1e6 for the dollar amount."
          },
          "feesGeneratedRaw": {
            "type": "string",
            "description": "Total taker fees this referrer's referred users have generated. Raw USDC with 6 decimals, returned as a string. Divide by 1e6 for the dollar amount."
          },
          "pfpUrl": {
            "type": "string",
            "nullable": true
          },
          "rank": {
            "type": "number",
            "description": "Absolute rank under the active sort. Ranks stay absolute across pages."
          },
          "referredCount": {
            "type": "number",
            "description": "Number of credited referred users."
          },
          "referrerProfileId": {
            "type": "number"
          }
        },
        "required": [
          "account",
          "avatarAccount",
          "displayName",
          "earnedRaw",
          "feesGeneratedRaw",
          "pfpUrl",
          "rank",
          "referredCount",
          "referrerProfileId"
        ]
      },
      "ReferralUsdcLeaderboardMeDto": {
        "type": "object",
        "properties": {
          "entry": {
            "$ref": "#/components/schemas/ReferralUsdcLeaderboardEntryDto"
          },
          "rank": {
            "type": "number",
            "description": "Your absolute rank under the active sort."
          }
        },
        "required": [
          "entry",
          "rank"
        ]
      },
      "ReferralUsdcLeaderboardResponseDto": {
        "type": "object",
        "properties": {
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReferralUsdcLeaderboardEntryDto"
            }
          },
          "limit": {
            "type": "number"
          },
          "me": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/ReferralUsdcLeaderboardMeDto"
              }
            ],
            "description": "Your own rank and entry, pinned even when outside the returned page. Present on the global board when the request is authenticated; null when you have no ranked position; omitted on the friends board."
          },
          "offset": {
            "type": "number"
          },
          "total": {
            "type": "number",
            "description": "Total ranked referrers on the board."
          }
        },
        "required": [
          "entries",
          "limit",
          "offset",
          "total"
        ]
      },
      "UnrealizedPnlAmountValueDto": {
        "type": "object",
        "description": "Numeric amount rendered both as an integer `raw` string in collateral base units and a human-readable `formatted` decimal string.",
        "properties": {
          "raw": {
            "type": "string",
            "example": "100000000"
          },
          "formatted": {
            "type": "string",
            "example": "100"
          }
        },
        "required": [
          "raw",
          "formatted"
        ]
      },
      "UnrealizedPnlMoneyValueDto": {
        "type": "object",
        "description": "Money amount in the market's collateral with an optional USD-denominated value.",
        "properties": {
          "raw": {
            "type": "string",
            "example": "9000000"
          },
          "formatted": {
            "type": "string",
            "example": "9"
          },
          "usd": {
            "type": "string",
            "nullable": true,
            "example": "9"
          }
        },
        "required": [
          "raw",
          "formatted",
          "usd"
        ]
      },
      "UnrealizedPnlCollateralTokenDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "example": 7
          },
          "symbol": {
            "type": "string",
            "example": "USDC"
          },
          "address": {
            "type": "string",
            "example": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
          },
          "decimals": {
            "type": "integer",
            "example": 6
          },
          "priceOracleId": {
            "type": "string",
            "nullable": true,
            "example": "usd-coin"
          }
        },
        "required": [
          "id",
          "symbol",
          "address",
          "decimals",
          "priceOracleId"
        ]
      },
      "UnrealizedPnlMarkValueDto": {
        "type": "object",
        "description": "Current mark price used to value the open position, plus the source that produced it and the time it was observed.",
        "properties": {
          "raw": {
            "type": "string"
          },
          "formatted": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "CLOB_DEPTH_WEIGHTED_BID",
              "CLOB_LAST_MINED_TRADE",
              "AMM_SPOT",
              "AMM_LAST_INDEXED_TRADE",
              "AVG_ENTRY_FALLBACK"
            ]
          },
          "asOf": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "raw",
          "formatted",
          "source",
          "asOf"
        ]
      },
      "UnrealizedPnlMarketIdentityDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "slug": {
            "type": "string"
          },
          "address": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "id",
          "slug",
          "address",
          "title",
          "category"
        ]
      },
      "UnrealizedPnlSnapshotState": {
        "type": "string",
        "description": "Readiness of the underlying projection. `READY` is a complete, current snapshot. `BUILDING` means the projection is being rebuilt and `data` is empty. `STALE` and `DEGRADED` return the last complete snapshot with `Cache-Control: no-store`; callers should retry shortly.",
        "enum": [
          "BUILDING",
          "DEGRADED",
          "READY",
          "STALE"
        ]
      },
      "UnrealizedPnlMarketEntryDto": {
        "type": "object",
        "properties": {
          "rank": {
            "type": "integer",
            "minimum": 1
          },
          "account": {
            "type": "string"
          },
          "username": {
            "type": "string",
            "nullable": true
          },
          "displayName": {
            "type": "string",
            "nullable": true
          },
          "pfpUrl": {
            "type": "string",
            "nullable": true
          },
          "side": {
            "type": "string",
            "enum": [
              "YES",
              "NO",
              "UP",
              "DOWN"
            ]
          },
          "outcomeLabel": {
            "type": "string",
            "nullable": true
          },
          "heldShares": {
            "$ref": "#/components/schemas/UnrealizedPnlAmountValueDto"
          },
          "avgEntry": {
            "$ref": "#/components/schemas/UnrealizedPnlAmountValueDto"
          },
          "costBasis": {
            "$ref": "#/components/schemas/UnrealizedPnlMoneyValueDto"
          },
          "mark": {
            "$ref": "#/components/schemas/UnrealizedPnlMarkValueDto"
          },
          "marketValue": {
            "$ref": "#/components/schemas/UnrealizedPnlMoneyValueDto"
          },
          "unrealizedPnl": {
            "$ref": "#/components/schemas/UnrealizedPnlMoneyValueDto"
          },
          "unrealizedRoi": {
            "type": "number",
            "nullable": true,
            "description": "ROI as a percent (e.g. 37.5 = +37.5%). Null when cost basis is zero."
          }
        },
        "required": [
          "rank",
          "account",
          "username",
          "displayName",
          "pfpUrl",
          "side",
          "outcomeLabel",
          "heldShares",
          "avgEntry",
          "costBasis",
          "mark",
          "marketValue",
          "unrealizedPnl",
          "unrealizedRoi"
        ]
      },
      "UnrealizedPnlBiggestPositionEntryDto": {
        "type": "object",
        "properties": {
          "rank": {
            "type": "integer",
            "minimum": 1
          },
          "account": {
            "type": "string"
          },
          "username": {
            "type": "string",
            "nullable": true
          },
          "displayName": {
            "type": "string",
            "nullable": true
          },
          "pfpUrl": {
            "type": "string",
            "nullable": true
          },
          "positionSize": {
            "$ref": "#/components/schemas/UnrealizedPnlMoneyValueDto"
          },
          "heldShares": {
            "$ref": "#/components/schemas/UnrealizedPnlAmountValueDto"
          },
          "toWin": {
            "$ref": "#/components/schemas/UnrealizedPnlMoneyValueDto"
          },
          "mark": {
            "$ref": "#/components/schemas/UnrealizedPnlMarkValueDto"
          },
          "unrealizedPnl": {
            "$ref": "#/components/schemas/UnrealizedPnlMoneyValueDto"
          },
          "side": {
            "type": "string",
            "enum": [
              "YES",
              "NO",
              "UP",
              "DOWN"
            ]
          },
          "outcomeLabel": {
            "type": "string",
            "nullable": true
          },
          "market": {
            "$ref": "#/components/schemas/UnrealizedPnlMarketIdentityDto"
          }
        },
        "required": [
          "rank",
          "account",
          "username",
          "displayName",
          "pfpUrl",
          "positionSize",
          "heldShares",
          "toWin",
          "mark",
          "unrealizedPnl",
          "side",
          "outcomeLabel",
          "market"
        ]
      },
      "UnrealizedPnlMarketResponseDto": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "state": {
            "$ref": "#/components/schemas/UnrealizedPnlSnapshotState"
          },
          "projectionVersion": {
            "type": "string",
            "nullable": true
          },
          "scopeVersion": {
            "type": "string",
            "nullable": true
          },
          "presentationVersion": {
            "type": "string",
            "nullable": true
          },
          "asOf": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "markAsOf": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "staleReason": {
            "type": "string",
            "nullable": true
          },
          "collateralToken": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/UnrealizedPnlCollateralTokenDto"
              }
            ]
          },
          "scope": {
            "type": "string",
            "enum": [
              "MARKET"
            ]
          },
          "marketId": {
            "type": "integer",
            "minimum": 1
          },
          "metric": {
            "type": "string",
            "enum": [
              "pnl",
              "roi"
            ]
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "default": 1
          },
          "totalRows": {
            "type": "integer",
            "minimum": 0
          },
          "totalPages": {
            "type": "integer",
            "minimum": 0
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UnrealizedPnlMarketEntryDto"
            }
          }
        },
        "required": [
          "schemaVersion",
          "state",
          "scope",
          "marketId",
          "metric",
          "limit",
          "page",
          "totalRows",
          "totalPages",
          "data"
        ]
      },
      "UnrealizedPnlBiggestPositionsResponseDto": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "state": {
            "$ref": "#/components/schemas/UnrealizedPnlSnapshotState"
          },
          "projectionVersion": {
            "type": "string",
            "nullable": true
          },
          "scopeVersion": {
            "type": "string",
            "nullable": true
          },
          "presentationVersion": {
            "type": "string",
            "nullable": true
          },
          "asOf": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "markAsOf": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "staleReason": {
            "type": "string",
            "nullable": true
          },
          "collateralToken": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/UnrealizedPnlCollateralTokenDto"
              }
            ]
          },
          "scope": {
            "type": "string",
            "enum": [
              "BIGGEST_POSITIONS"
            ]
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 50
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UnrealizedPnlBiggestPositionEntryDto"
            }
          }
        },
        "required": [
          "schemaVersion",
          "state",
          "scope",
          "limit",
          "data"
        ]
      }
    }
  }
}