{
  "openapi": "3.0.0",
  "info": {
    "title": "Poly Market Maker API",
    "version": "0.50.0",
    "description": "## Quickstart\n\n**Start in the test environment.** Use the deployed API base URL (including its API prefix, if any), not the documentation URL.\n\nIn the signed-in storefront, open your account’s API Keys section. Create a key with `orders:read`, `orders:create`, and `orders:cancel` for this walkthrough. Add `trades:read` to recover executions; do not grant scopes the bot does not use. The credential is displayed once. Store it in your runtime secret store and pass it to your terminal or bot as `POLY_API_KEY`. Never paste it into this website, use it in browser code, or commit it.\n\nSet `POLY_API_BASE_URL` to the test API HTTPS base without a trailing slash. Export `POLY_MARKET_ID` and `POLY_OUTCOME_ID` from a published market before requesting its book; use the market’s outcome list to select the outcome you want. The examples are available as cURL, Python 3 (standard library), and Node.js (native fetch).\n\n1. Read the market and the outcome order book. Check that the market is open, limit orders are enabled, and your limit price respects the tick and does not cross the book.\n\n2. Submit the post-only limit buy below. Replace the placeholder outcome and request ID and adjust the budget and price before sending. Save the exact request body before sending. On HTTP 201, record the returned order ID. If the response is lost, resend the identical body with the **same** `idempotencyKey`. Do not generate a new ID for a retry. A different payload under a previously used key can return `409 idempotency_conflict`.\n\n3. Set `POLY_ORDER_ID` from the response. Read the order by that ID and cancel it when no longer needed. Cancellation affects only your remaining order; it does not undo fills. Turning off API access or revoking a key does not cancel resting orders.\n\n## Recover orders and executions\n\nRead `GET /orders?marketId=market_example&status=active&limit=50` and then do a separate scan with `status=partially_filled`. Read `GET /orders/trades?marketId=market_example&limit=50` for your executions. Both return `{items, nextCursor}`. If `nextCursor` is not null, send it as the URL-encoded `cursor` on the same endpoint with the same filters and account. Start a fresh scan when the cursor is rejected. Pages are newest first; use order or trade IDs to deduplicate across scans.\n\nExample for subsequent order pages (set `POLY_NEXT_CURSOR` to the returned cursor):\n\n```bash\ncurl --fail-with-body --get \"$POLY_API_BASE_URL/orders\" \\\n  -H \"Authorization: ApiKey $POLY_API_KEY\" \\\n  --data-urlencode \"marketId=$POLY_MARKET_ID\" --data-urlencode \"status=active\" \\\n  --data-urlencode \"limit=50\" --data-urlencode \"cursor=$POLY_NEXT_CURSOR\"\n```\n\n## Units and errors\n\nMoney and prices are integer **strings in micro-USD**: `\"1000000\"` = $1; `\"400000\"` per contract = $0.40. Contract quantities are decimal strings with up to two fractional digits in requests and exactly two in responses, e.g. `\"1.25\"`. Keep IDs and amount strings lossless. The public order book is in canonical YES prices; the equivalent NO price is 1,000,000 minus the YES price, with bids and asks reversed.\n\nA buy sends `budgetAmount` including fees; it must meet the higher of $1 and the market minimum. A sell sends the quantity of contracts you already own. Market buys require `maxPrice` for placement, market sells require `minPrice`, and market orders require `allowPartialFill`. `postOnly` is limit-only. Read-only estimates do not guarantee execution or reserve funds.\n\n`400`: invalid parameters or body. `401`: missing, invalid, revoked or disabled API key. `403`: a valid key lacks the required scope, or the account is restricted. `404`: unknown or inaccessible resource. `409`: business conflict, for example a crossing post-only order (`post_only_would_cross`), position limit, insufficient funds, closed market, financial lock, or idempotency mismatch. Inspect the response rather than retrying a rejected command blindly."
  },
  "servers": [
    {
      "url": "https://poly-admin.xchng.site/api"
    }
  ],
  "paths": {
    "/profile/balance": {
      "get": {
        "description": "API key required: `Authorization: ApiKey <credential>`. Required scope: `balance:read`.\n\nReturns your available, reserved and total USD balances as integer micro-USD strings.",
        "operationId": "ProfileController_getBalance",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "available",
                    "reserved",
                    "total"
                  ],
                  "properties": {
                    "available": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "description": "Integer micro-USD"
                    },
                    "reserved": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "description": "Integer micro-USD"
                    },
                    "total": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "description": "Integer micro-USD"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid authentication"
          },
          "403": {
            "description": "Requires balance:read for API keys; account restrictions still apply"
          }
        },
        "security": [
          {
            "poly_market_maker_key": []
          }
        ],
        "summary": "Get your available and reserved balances",
        "tags": [
          "Profile"
        ],
        "x-market-maker-scope": "balance:read"
      }
    },
    "/markets": {
      "get": {
        "operationId": "MarketCatalogController_list",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "1 to 100; defaults to 25",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "required": false,
            "in": "query",
            "schema": {
              "enum": [
                "scheduled",
                "open",
                "trading_closed",
                "resolving",
                "resolved",
                "settled",
                "voided"
              ],
              "type": "string"
            }
          },
          {
            "name": "categoryId",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Published markets ordered by opening time descending, then ID descending",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id",
                          "code",
                          "title",
                          "question",
                          "type",
                          "state",
                          "category",
                          "media",
                          "opensAt",
                          "closesAt",
                          "outcomeCount"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "code": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "question": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "binary"
                            ]
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "scheduled",
                              "open",
                              "trading_closed",
                              "resolving",
                              "resolved",
                              "settled",
                              "voided"
                            ]
                          },
                          "category": {
                            "type": "object",
                            "required": [
                              "id",
                              "code",
                              "name"
                            ],
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            }
                          },
                          "media": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "required": [
                                "id",
                                "kind",
                                "mimeType",
                                "sizeBytes",
                                "url"
                              ],
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "kind": {
                                  "type": "string",
                                  "example": "image"
                                },
                                "mimeType": {
                                  "type": "string",
                                  "example": "image/jpeg"
                                },
                                "sizeBytes": {
                                  "type": "integer",
                                  "description": "Image size in bytes"
                                },
                                "url": {
                                  "type": "string",
                                  "description": "Public market-media path",
                                  "example": "/market-media/media-id"
                                }
                              }
                            }
                          },
                          "outcomeCount": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 20
                          },
                          "opensAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "closesAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "nextCursor": {
                      "type": "string",
                      "nullable": true,
                      "description": "Pass as cursor to retrieve the following page"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid categoryId, cursor, state, or limit query parameter"
          }
        },
        "summary": "List published markets",
        "tags": [
          "Public markets"
        ],
        "security": [],
        "description": "Public operation. No API key is required.\n\nReturns a cursor-paginated page of published markets. Use the IDs from this page to request market details."
      }
    },
    "/markets/{marketId}": {
      "get": {
        "operationId": "MarketCatalogController_detail",
        "parameters": [
          {
            "name": "marketId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Published market detail and trading settings",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id",
                    "code",
                    "title",
                    "question",
                    "type",
                    "state",
                    "category",
                    "media",
                    "opensAt",
                    "closesAt",
                    "eventStartsAt",
                    "resolutionRules",
                    "liveStreamUrl",
                    "liveStreamEmbedHtml",
                    "outcomes",
                    "limitOrdersEnabled",
                    "priceTick",
                    "minimumOrderNotional",
                    "maxContractsPerUserPerSide",
                    "makerFeeBps",
                    "takerFeeBps",
                    "protectionWindowSeconds"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "question": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "binary"
                      ]
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "scheduled",
                        "open",
                        "trading_closed",
                        "resolving",
                        "resolved",
                        "settled",
                        "voided"
                      ]
                    },
                    "category": {
                      "type": "object",
                      "required": [
                        "id",
                        "code",
                        "name"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      }
                    },
                    "media": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id",
                          "kind",
                          "mimeType",
                          "sizeBytes",
                          "url"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string",
                            "example": "image"
                          },
                          "mimeType": {
                            "type": "string",
                            "example": "image/jpeg"
                          },
                          "sizeBytes": {
                            "type": "integer",
                            "description": "Image size in bytes"
                          },
                          "url": {
                            "type": "string",
                            "description": "Public market-media path",
                            "example": "/market-media/media-id"
                          }
                        }
                      }
                    },
                    "outcomeCount": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 20
                    },
                    "opensAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "closesAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "eventStartsAt": {
                      "type": "string",
                      "format": "date-time",
                      "nullable": true,
                      "description": "Optional event start, separate from market opening and closing times. Can be used as order expiresAt."
                    },
                    "resolutionRules": {
                      "type": "string"
                    },
                    "liveStreamUrl": {
                      "type": "string",
                      "nullable": true,
                      "format": "uri"
                    },
                    "liveStreamEmbedHtml": {
                      "type": "string",
                      "nullable": true,
                      "description": "Normalized iframe player HTML from YouTube, Twitch, or Kick. Render only as a trusted iframe."
                    },
                    "outcomes": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 20,
                      "items": {
                        "type": "object",
                        "required": [
                          "id",
                          "label",
                          "displayOrder",
                          "resolution"
                        ],
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Use as outcomeId with trading and market-data endpoints"
                          },
                          "label": {
                            "type": "string"
                          },
                          "displayOrder": {
                            "type": "integer"
                          },
                          "resolution": {
                            "nullable": true,
                            "type": "object",
                            "required": [
                              "declaredAt",
                              "result"
                            ],
                            "properties": {
                              "declaredAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "result": {
                                "type": "string",
                                "enum": [
                                  "yes",
                                  "no"
                                ]
                              }
                            }
                          }
                        }
                      }
                    },
                    "limitOrdersEnabled": {
                      "type": "boolean"
                    },
                    "priceTick": {
                      "type": "string",
                      "description": "Integer micro-USD price increment",
                      "example": "10000"
                    },
                    "minimumOrderNotional": {
                      "type": "string",
                      "description": "Integer micro-USD minimum budget for a new buy order; sales of owned contracts have no minimum notional",
                      "example": "1000000"
                    },
                    "maxContractsPerUserPerSide": {
                      "type": "string",
                      "nullable": true,
                      "pattern": "^[0-9]+\\.[0-9]{2}$",
                      "description": "Maximum contracts per user, outcome, and YES/NO side; null means unlimited.",
                      "example": "10.00"
                    },
                    "makerFeeBps": {
                      "type": "integer",
                      "description": "Maker fee in basis points"
                    },
                    "takerFeeBps": {
                      "type": "integer",
                      "description": "Taker fee in basis points"
                    },
                    "protectionWindowSeconds": {
                      "type": "integer",
                      "description": "Trading protection window in seconds"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid market ID"
          },
          "404": {
            "description": "The market does not exist or is not published"
          }
        },
        "summary": "Get a published market card",
        "tags": [
          "Public markets"
        ],
        "security": [],
        "description": "Public operation. No API key is required.\n\nUse a published market ID. HTTP 200 returns the market details, outcomes and trading settings; 404 means the market is not found or not published.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl --fail-with-body --request GET \"$POLY_API_BASE_URL/markets/$POLY_MARKET_ID\""
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import json\nimport os\nfrom urllib.request import Request, urlopen\n\nbase = os.environ[\"POLY_API_BASE_URL\"].rstrip(\"/\")\nurl = base + f'/markets/{os.environ[\"POLY_MARKET_ID\"]}'\nheaders = {}\ndata = None\nwith urlopen(Request(url, method=\"GET\", headers=headers, data=data), timeout=10) as response:\n    print(response.status, json.load(response))"
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "// Run with Node.js, not in a browser.\nconst base = process.env.POLY_API_BASE_URL.replace(/\\/$/, \"\")\nconst response = await fetch(`${base}/markets/${process.env.POLY_MARKET_ID}`, {\n  method: \"GET\",\n  signal: AbortSignal.timeout(10_000),\n})\nconst payload = await response.json()\nconsole.log(response.status, payload)\nif (!response.ok) process.exitCode = 1"
          }
        ]
      }
    },
    "/market-categories": {
      "get": {
        "operationId": "PublicMarketCategoriesController_list",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Active categories ordered by name",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "id",
                      "code",
                      "name"
                    ],
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "code": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "summary": "List active market categories",
        "tags": [
          "Public markets"
        ],
        "security": [],
        "description": "Public operation. No API key is required.\n\nReturns active categories that can be used to filter markets."
      }
    },
    "/markets/{marketId}/outcomes/{outcomeId}/order-book": {
      "get": {
        "operationId": "MarketDataController_getOrderBook",
        "parameters": [
          {
            "name": "depth",
            "required": false,
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "outcomeId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "marketId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "marketId",
                    "outcomeId",
                    "bids",
                    "asks"
                  ],
                  "properties": {
                    "marketId": {
                      "type": "string"
                    },
                    "outcomeId": {
                      "type": "string"
                    },
                    "bids": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "price",
                          "quantity"
                        ],
                        "properties": {
                          "price": {
                            "type": "string",
                            "pattern": "^[0-9]+$",
                            "example": "600000",
                            "description": "Integer micro-USD"
                          },
                          "quantity": {
                            "type": "string",
                            "pattern": "^[0-9]+\\.[0-9]{2}$",
                            "example": "1.25",
                            "description": "Contracts; exactly two decimal places in responses."
                          }
                        }
                      }
                    },
                    "asks": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "price",
                          "quantity"
                        ],
                        "properties": {
                          "price": {
                            "type": "string",
                            "pattern": "^[0-9]+$",
                            "example": "600000",
                            "description": "Integer micro-USD"
                          },
                          "quantity": {
                            "type": "string",
                            "pattern": "^[0-9]+\\.[0-9]{2}$",
                            "example": "1.25",
                            "description": "Contracts; exactly two decimal places in responses."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid market data request"
          },
          "404": {
            "description": "Unknown or unpublished market or outcome"
          }
        },
        "summary": "Get the order book for a market outcome",
        "tags": [
          "Public market data"
        ],
        "security": [],
        "description": "Public operation. No API key is required.\n\nUse an outcome ID belonging to the supplied market. HTTP 200 returns asks and bids in canonical YES prices (micro-USD strings). A closed book can be empty; 404 means the market or outcome is unavailable.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl --fail-with-body --request GET \"$POLY_API_BASE_URL/markets/$POLY_MARKET_ID/outcomes/$POLY_OUTCOME_ID/order-book\""
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import json\nimport os\nfrom urllib.request import Request, urlopen\n\nbase = os.environ[\"POLY_API_BASE_URL\"].rstrip(\"/\")\nurl = base + f'/markets/{os.environ[\"POLY_MARKET_ID\"]}/outcomes/{os.environ[\"POLY_OUTCOME_ID\"]}/order-book'\nheaders = {}\ndata = None\nwith urlopen(Request(url, method=\"GET\", headers=headers, data=data), timeout=10) as response:\n    print(response.status, json.load(response))"
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "// Run with Node.js, not in a browser.\nconst base = process.env.POLY_API_BASE_URL.replace(/\\/$/, \"\")\nconst response = await fetch(`${base}/markets/${process.env.POLY_MARKET_ID}/outcomes/${process.env.POLY_OUTCOME_ID}/order-book`, {\n  method: \"GET\",\n  signal: AbortSignal.timeout(10_000),\n})\nconst payload = await response.json()\nconsole.log(response.status, payload)\nif (!response.ok) process.exitCode = 1"
          }
        ]
      }
    },
    "/markets/{marketId}/outcomes/{outcomeId}/trades": {
      "get": {
        "operationId": "MarketDataController_listTrades",
        "parameters": [
          {
            "name": "depth",
            "required": false,
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "outcomeId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "marketId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "id",
                      "outcomeId",
                      "price",
                      "quantity",
                      "createdAt"
                    ],
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "outcomeId": {
                        "type": "string"
                      },
                      "price": {
                        "type": "string",
                        "pattern": "^[0-9]+$",
                        "example": "600000",
                        "description": "Integer micro-USD"
                      },
                      "quantity": {
                        "type": "string",
                        "pattern": "^[0-9]+\\.[0-9]{2}$",
                        "example": "1.25",
                        "description": "Contracts; exactly two decimal places in responses."
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid market data request"
          },
          "404": {
            "description": "Unknown or unpublished market or outcome"
          }
        },
        "summary": "List the latest public executions for a market outcome",
        "tags": [
          "Public market data"
        ],
        "security": [],
        "description": "Public operation. No API key is required.\n\nReturns recent public executions. Use depth for the number of results; it is not an account history cursor."
      }
    },
    "/orders": {
      "get": {
        "description": "API key required: `Authorization: ApiKey <credential>`. Required scope: `orders:read`.\n\nLists your own orders, newest first. Keep marketId and status unchanged between pages. A null nextCursor means the scan is finished.",
        "operationId": "TradingController_listOrders",
        "parameters": [
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "nextCursor from the preceding page with the same filters",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "enum": [
                "active",
                "partially_filled",
                "filled",
                "canceled",
                "expired"
              ],
              "type": "string"
            }
          },
          {
            "name": "marketId",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id",
                          "outcomeId",
                          "direction",
                          "side",
                          "type",
                          "status",
                          "price",
                          "quantity",
                          "remainingQuantity",
                          "reserves",
                          "feeAmount",
                          "createdAt",
                          "expiresAt",
                          "canceledAt"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "outcomeId": {
                            "type": "string"
                          },
                          "marketId": {
                            "type": "string"
                          },
                          "direction": {
                            "type": "string",
                            "enum": [
                              "buy",
                              "sell"
                            ]
                          },
                          "side": {
                            "type": "string",
                            "enum": [
                              "yes",
                              "no"
                            ]
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "limit",
                              "market"
                            ]
                          },
                          "status": {
                            "type": "string"
                          },
                          "price": {
                            "type": "string",
                            "pattern": "^[0-9]+$",
                            "example": "600000",
                            "description": "Integer micro-USD"
                          },
                          "quantity": {
                            "type": "string",
                            "pattern": "^[0-9]+\\.[0-9]{2}$",
                            "example": "1.25",
                            "description": "Contracts; exactly two decimal places in responses."
                          },
                          "remainingQuantity": {
                            "type": "string",
                            "pattern": "^[0-9]+\\.[0-9]{2}$",
                            "example": "1.25",
                            "description": "Contracts; exactly two decimal places in responses."
                          },
                          "budgetAmount": {
                            "type": "string",
                            "pattern": "^[0-9]+$",
                            "example": "600000",
                            "description": "Buy only: originally approved budget, including fees."
                          },
                          "spentAmount": {
                            "type": "string",
                            "pattern": "^[0-9]+$",
                            "example": "600000",
                            "description": "Buy only: total executed cost including fees."
                          },
                          "unusedAmount": {
                            "type": "string",
                            "pattern": "^[0-9]+$",
                            "example": "600000",
                            "description": "Buy only: budget minus spent amount and current cash reserve."
                          },
                          "feeAmount": {
                            "type": "string",
                            "pattern": "^[0-9]+$",
                            "example": "600000",
                            "description": "Integer micro-USD"
                          },
                          "grossProceedsAmount": {
                            "type": "string",
                            "pattern": "^[0-9]+$",
                            "example": "600000",
                            "description": "Sell only: gross proceeds before monetary fees."
                          },
                          "netProceedsAmount": {
                            "type": "string",
                            "pattern": "^[0-9]+$",
                            "example": "600000",
                            "description": "Sell only: gross proceeds minus fees."
                          },
                          "reserves": {
                            "type": "object",
                            "required": [
                              "cashAmount",
                              "yesQuantity",
                              "noQuantity"
                            ],
                            "properties": {
                              "cashAmount": {
                                "type": "string",
                                "pattern": "^[0-9]+$",
                                "example": "600000",
                                "description": "Integer micro-USD"
                              },
                              "yesQuantity": {
                                "type": "string",
                                "pattern": "^[0-9]+\\.[0-9]{2}$",
                                "example": "1.25",
                                "description": "Contracts; exactly two decimal places in responses."
                              },
                              "noQuantity": {
                                "type": "string",
                                "pattern": "^[0-9]+\\.[0-9]{2}$",
                                "example": "1.25",
                                "description": "Contracts; exactly two decimal places in responses."
                              }
                            }
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "expiresAt": {
                            "type": "string",
                            "format": "date-time",
                            "nullable": true
                          },
                          "canceledAt": {
                            "type": "string",
                            "format": "date-time",
                            "nullable": true
                          }
                        }
                      }
                    },
                    "nextCursor": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid authentication"
          },
          "403": {
            "description": "Requires orders:read for API keys; account restrictions still apply"
          }
        },
        "security": [
          {
            "poly_market_maker_key": []
          }
        ],
        "summary": "List your own orders",
        "tags": [
          "Trading"
        ],
        "x-market-maker-scope": "orders:read"
      },
      "post": {
        "description": "API key required: `Authorization: ApiKey <credential>`. Required scope: `orders:create`.\n\nPlace a limit or market buy or sell. Example: a non-crossing post-only limit buy on a market with limit orders enabled and sufficient funds. HTTP 201 returns the order, including status and reserves. A crossing post-only order returns 409 without execution or reservation. Preserve the exact request and idempotencyKey for retries.",
        "operationId": "TradingController_create",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "direction",
                  "side",
                  "idempotencyKey",
                  "outcomeId",
                  "type"
                ],
                "properties": {
                  "allowPartialFill": {
                    "type": "boolean"
                  },
                  "direction": {
                    "type": "string",
                    "enum": [
                      "buy",
                      "sell"
                    ]
                  },
                  "side": {
                    "type": "string",
                    "enum": [
                      "yes",
                      "no"
                    ]
                  },
                  "budgetAmount": {
                    "type": "string",
                    "pattern": "^[0-9]+$",
                    "example": "600000",
                    "description": "Integer micro-USD"
                  },
                  "expiresAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "example": "maker-outcome-a-20261129-001",
                    "description": "Repeat the exact request with this same key after a timeout."
                  },
                  "maxPrice": {
                    "type": "string",
                    "pattern": "^[0-9]+$",
                    "example": "600000",
                    "description": "Integer micro-USD"
                  },
                  "minPrice": {
                    "type": "string",
                    "pattern": "^[0-9]+$",
                    "example": "600000",
                    "description": "Integer micro-USD"
                  },
                  "outcomeId": {
                    "type": "string"
                  },
                  "price": {
                    "type": "string",
                    "pattern": "^[0-9]+$",
                    "example": "600000",
                    "description": "Integer micro-USD"
                  },
                  "postOnly": {
                    "type": "boolean",
                    "description": "Limit orders only. Reject if the order crosses the book."
                  },
                  "quantity": {
                    "type": "string",
                    "pattern": "^(?:[1-9][0-9]*(?:\\.[0-9]{1,2})?|0\\.(?:0?[1-9]|[1-9][0-9]))$",
                    "example": "1.25",
                    "description": "Positive contract quantity with up to two decimal places."
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "limit",
                      "market"
                    ]
                  }
                },
                "description": "Buy: budgetAmount in micro-USD, including fees; no quantity. The buy budget must meet the market minimum and 1 USD. Sell: quantity of owned contracts; no budgetAmount or minimum sale notional. Market buy requires maxPrice and market sell requires minPrice. NO prices are quoted for NO but stored in the canonical YES book.",
                "oneOf": [
                  {
                    "required": [
                      "budgetAmount"
                    ],
                    "properties": {
                      "direction": {
                        "type": "string",
                        "enum": [
                          "buy"
                        ]
                      }
                    },
                    "not": {
                      "required": [
                        "quantity"
                      ]
                    }
                  },
                  {
                    "required": [
                      "quantity"
                    ],
                    "properties": {
                      "direction": {
                        "type": "string",
                        "enum": [
                          "sell"
                        ]
                      }
                    },
                    "not": {
                      "required": [
                        "budgetAmount"
                      ]
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id",
                    "outcomeId",
                    "direction",
                    "side",
                    "type",
                    "status",
                    "price",
                    "quantity",
                    "remainingQuantity",
                    "reserves",
                    "feeAmount",
                    "createdAt",
                    "expiresAt",
                    "canceledAt"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "outcomeId": {
                      "type": "string"
                    },
                    "marketId": {
                      "type": "string"
                    },
                    "direction": {
                      "type": "string",
                      "enum": [
                        "buy",
                        "sell"
                      ]
                    },
                    "side": {
                      "type": "string",
                      "enum": [
                        "yes",
                        "no"
                      ]
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "limit",
                        "market"
                      ]
                    },
                    "status": {
                      "type": "string"
                    },
                    "price": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Integer micro-USD"
                    },
                    "quantity": {
                      "type": "string",
                      "pattern": "^[0-9]+\\.[0-9]{2}$",
                      "example": "1.25",
                      "description": "Contracts; exactly two decimal places in responses."
                    },
                    "remainingQuantity": {
                      "type": "string",
                      "pattern": "^[0-9]+\\.[0-9]{2}$",
                      "example": "1.25",
                      "description": "Contracts; exactly two decimal places in responses."
                    },
                    "budgetAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Buy only: originally approved budget, including fees."
                    },
                    "spentAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Buy only: total executed cost including fees."
                    },
                    "unusedAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Buy only: budget minus spent amount and current cash reserve."
                    },
                    "feeAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Integer micro-USD"
                    },
                    "grossProceedsAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Sell only: gross proceeds before monetary fees."
                    },
                    "netProceedsAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Sell only: gross proceeds minus fees."
                    },
                    "reserves": {
                      "type": "object",
                      "required": [
                        "cashAmount",
                        "yesQuantity",
                        "noQuantity"
                      ],
                      "properties": {
                        "cashAmount": {
                          "type": "string",
                          "pattern": "^[0-9]+$",
                          "example": "600000",
                          "description": "Integer micro-USD"
                        },
                        "yesQuantity": {
                          "type": "string",
                          "pattern": "^[0-9]+\\.[0-9]{2}$",
                          "example": "1.25",
                          "description": "Contracts; exactly two decimal places in responses."
                        },
                        "noQuantity": {
                          "type": "string",
                          "pattern": "^[0-9]+\\.[0-9]{2}$",
                          "example": "1.25",
                          "description": "Contracts; exactly two decimal places in responses."
                        }
                      }
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time",
                      "nullable": true
                    },
                    "canceledAt": {
                      "type": "string",
                      "format": "date-time",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid order body"
          },
          "401": {
            "description": "Missing or invalid authentication"
          },
          "403": {
            "description": "Requires orders:create for API keys; account restrictions still apply"
          },
          "404": {
            "description": "Unknown market outcome"
          },
          "409": {
            "description": "Order conflict; an active manual balance lease returns financial_operations_temporarily_locked."
          }
        },
        "security": [
          {
            "poly_market_maker_key": []
          }
        ],
        "summary": "Buy YES/NO with a micro-USD budget or sell owned YES/NO contracts",
        "tags": [
          "Trading"
        ],
        "x-market-maker-scope": "orders:create",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl --fail-with-body --request POST \"$POLY_API_BASE_URL/orders\" \\\n  -H \"Authorization: ApiKey $POLY_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  --data-binary '{\n  \"outcomeId\": \"outcome_example\",\n  \"side\": \"yes\",\n  \"direction\": \"buy\",\n  \"type\": \"limit\",\n  \"price\": \"400000\",\n  \"budgetAmount\": \"5000000\",\n  \"postOnly\": true,\n  \"idempotencyKey\": \"quote-example-001\"\n}'"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import json\nimport os\nfrom urllib.request import Request, urlopen\n\nbase = os.environ[\"POLY_API_BASE_URL\"].rstrip(\"/\")\nurl = base + '/orders'\nheaders = {\"Authorization\": \"ApiKey \" + os.environ[\"POLY_API_KEY\"]}\nheaders[\"Content-Type\"] = \"application/json\"\nbody = json.loads(\"\"\"{\n  \"outcomeId\": \"outcome_example\",\n  \"side\": \"yes\",\n  \"direction\": \"buy\",\n  \"type\": \"limit\",\n  \"price\": \"400000\",\n  \"budgetAmount\": \"5000000\",\n  \"postOnly\": true,\n  \"idempotencyKey\": \"quote-example-001\"\n}\"\"\")\ndata = json.dumps(body).encode(\"utf-8\")\nwith urlopen(Request(url, method=\"POST\", headers=headers, data=data), timeout=10) as response:\n    print(response.status, json.load(response))"
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "// Run with Node.js, not in a browser.\nconst base = process.env.POLY_API_BASE_URL.replace(/\\/$/, \"\")\nconst response = await fetch(`${base}/orders`, {\n  method: \"POST\",\n  headers: {\n    Authorization: \"ApiKey \" + process.env.POLY_API_KEY,\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    \"outcomeId\": \"outcome_example\",\n    \"side\": \"yes\",\n    \"direction\": \"buy\",\n    \"type\": \"limit\",\n    \"price\": \"400000\",\n    \"budgetAmount\": \"5000000\",\n    \"postOnly\": true,\n    \"idempotencyKey\": \"quote-example-001\"\n  }),\n  signal: AbortSignal.timeout(10_000),\n})\nconst payload = await response.json()\nconsole.log(response.status, payload)\nif (!response.ok) process.exitCode = 1"
          }
        ]
      }
    },
    "/orders/quote": {
      "post": {
        "description": "API key required: `Authorization: ApiKey <credential>`. Required scope: `orders:create`.\n\nEstimate execution without reserving funds or contracts. Quotes may change. Only a market buy quote may omit maxPrice; placement still requires a bound.",
        "operationId": "TradingController_quote",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "direction",
                  "side",
                  "outcomeId",
                  "type"
                ],
                "properties": {
                  "allowPartialFill": {
                    "type": "boolean"
                  },
                  "direction": {
                    "type": "string",
                    "enum": [
                      "buy",
                      "sell"
                    ]
                  },
                  "side": {
                    "type": "string",
                    "enum": [
                      "yes",
                      "no"
                    ]
                  },
                  "budgetAmount": {
                    "type": "string",
                    "pattern": "^[0-9]+$",
                    "example": "600000",
                    "description": "Integer micro-USD"
                  },
                  "expiresAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "maxPrice": {
                    "type": "string",
                    "pattern": "^[0-9]+$",
                    "example": "600000",
                    "description": "Market-buy maximum price on the selected YES/NO side. May be omitted only for a read-only market-buy quote."
                  },
                  "minPrice": {
                    "type": "string",
                    "pattern": "^[0-9]+$",
                    "example": "600000",
                    "description": "Integer micro-USD"
                  },
                  "outcomeId": {
                    "type": "string"
                  },
                  "price": {
                    "type": "string",
                    "pattern": "^[0-9]+$",
                    "example": "600000",
                    "description": "Integer micro-USD"
                  },
                  "postOnly": {
                    "type": "boolean",
                    "description": "Limit orders only. Reject if the order crosses the book."
                  },
                  "quantity": {
                    "type": "string",
                    "pattern": "^(?:[1-9][0-9]*(?:\\.[0-9]{1,2})?|0\\.(?:0?[1-9]|[1-9][0-9]))$",
                    "example": "1.25",
                    "description": "Positive contract quantity with up to two decimal places."
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "limit",
                      "market"
                    ]
                  }
                },
                "description": "Read-only estimate of a limit or market order at the current book, without an idempotency key. Only a market buy quote may omit maxPrice. No funds or positions are reserved, and the quote can change before placement.",
                "oneOf": [
                  {
                    "required": [
                      "budgetAmount"
                    ],
                    "properties": {
                      "direction": {
                        "type": "string",
                        "enum": [
                          "buy"
                        ]
                      }
                    },
                    "not": {
                      "required": [
                        "quantity"
                      ]
                    }
                  },
                  {
                    "required": [
                      "quantity"
                    ],
                    "properties": {
                      "direction": {
                        "type": "string",
                        "enum": [
                          "sell"
                        ]
                      }
                    },
                    "not": {
                      "required": [
                        "budgetAmount"
                      ]
                    }
                  }
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "asOf",
                    "marketId",
                    "outcomeId",
                    "side",
                    "direction",
                    "execution",
                    "canPlaceOrder",
                    "reason",
                    "estimatedFilledQuantity",
                    "estimatedWorstFillPrice",
                    "estimatedFeeAmount"
                  ],
                  "properties": {
                    "asOf": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Time of the read-only order-book snapshot."
                    },
                    "marketId": {
                      "type": "string"
                    },
                    "outcomeId": {
                      "type": "string"
                    },
                    "side": {
                      "type": "string",
                      "enum": [
                        "yes",
                        "no"
                      ]
                    },
                    "direction": {
                      "type": "string",
                      "enum": [
                        "buy",
                        "sell"
                      ]
                    },
                    "execution": {
                      "type": "string",
                      "enum": [
                        "full",
                        "partial",
                        "none"
                      ]
                    },
                    "canPlaceOrder": {
                      "type": "boolean",
                      "description": "Whether this order would be accepted in the sampled state."
                    },
                    "reason": {
                      "type": "string",
                      "nullable": true,
                      "enum": [
                        "insufficientBalance",
                        "insufficientPosition",
                        "partialFillNotAllowed",
                        "selfTradePrevention",
                        "noLiquidity",
                        "positionLimitExceeded"
                      ]
                    },
                    "estimatedFilledQuantity": {
                      "type": "string",
                      "pattern": "^[0-9]+\\.[0-9]{2}$",
                      "example": "1.25",
                      "description": "Contracts; exactly two decimal places in responses."
                    },
                    "estimatedWorstFillPrice": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Price of the worst actually estimated fill on the selected YES/NO side; null without fills. A per-contract price bound, not an average or execution guarantee.",
                      "nullable": true
                    },
                    "estimatedFeeAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Integer micro-USD"
                    },
                    "budgetAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Integer micro-USD"
                    },
                    "estimatedPrincipalAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Buy only: immediate contract cost before fees."
                    },
                    "estimatedSpentAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Buy only: immediate principal plus taker fees."
                    },
                    "estimatedRemainingBudgetAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Buy only: budget minus immediate spending."
                    },
                    "estimatedRestingCashReserveAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Limit buy only: estimated reserve for a resting remainder."
                    },
                    "estimatedRestingQuantity": {
                      "type": "string",
                      "pattern": "^[0-9]+\\.[0-9]{2}$",
                      "example": "1.25",
                      "description": "Contracts; exactly two decimal places in responses."
                    },
                    "estimatedUnusedAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Buy only: budget minus immediate spending and resting reserve."
                    },
                    "requestedQuantity": {
                      "type": "string",
                      "pattern": "^[0-9]+\\.[0-9]{2}$",
                      "example": "1.25",
                      "description": "Contracts; exactly two decimal places in responses."
                    },
                    "estimatedGrossProceedsAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Sell only: immediate proceeds before fees."
                    },
                    "estimatedNetProceedsAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Sell only: gross proceeds minus taker fees."
                    },
                    "estimatedRemainingQuantity": {
                      "type": "string",
                      "pattern": "^[0-9]+\\.[0-9]{2}$",
                      "example": "1.25",
                      "description": "Contracts; exactly two decimal places in responses."
                    }
                  },
                  "description": "Indicative immediate execution only; no average price or resolution payout. Amounts are integer micro-USD strings; contract quantities have two decimal places. A limit-order remainder is not an executed position. Actual execution can differ."
                }
              }
            }
          },
          "400": {
            "description": "Invalid quote input."
          },
          "401": {
            "description": "Missing or invalid authentication"
          },
          "403": {
            "description": "Requires orders:create for API keys; account restrictions still apply"
          },
          "404": {
            "description": "Market outcome is unknown."
          },
          "409": {
            "description": "Market is closed or order price, minimum, or expiry is invalid."
          },
          "503": {
            "description": "The unbounded quote exceeds the safe maker-processing limit."
          }
        },
        "security": [
          {
            "poly_market_maker_key": []
          }
        ],
        "summary": "Estimate immediate order execution without reserving funds or positions",
        "tags": [
          "Trading"
        ],
        "x-market-maker-scope": "orders:create"
      }
    },
    "/orders/positions": {
      "get": {
        "description": "API key required: `Authorization: ApiKey <credential>`. Required scope: `positions:read`.\n\nReturns your contracts and contract reserves per outcome.",
        "operationId": "TradingController_listPositions",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "marketId",
                      "outcomeId",
                      "yesQuantity",
                      "noQuantity",
                      "reservedYesQuantity",
                      "reservedNoQuantity",
                      "remainingYesBuyCapacity",
                      "remainingNoBuyCapacity"
                    ],
                    "properties": {
                      "marketId": {
                        "type": "string"
                      },
                      "outcomeId": {
                        "type": "string"
                      },
                      "yesQuantity": {
                        "type": "string",
                        "pattern": "^[0-9]+\\.[0-9]{2}$",
                        "example": "1.25",
                        "description": "Contracts; exactly two decimal places in responses."
                      },
                      "noQuantity": {
                        "type": "string",
                        "pattern": "^[0-9]+\\.[0-9]{2}$",
                        "example": "1.25",
                        "description": "Contracts; exactly two decimal places in responses."
                      },
                      "reservedYesQuantity": {
                        "type": "string",
                        "pattern": "^[0-9]+\\.[0-9]{2}$",
                        "example": "1.25",
                        "description": "Contracts; exactly two decimal places in responses."
                      },
                      "reservedNoQuantity": {
                        "type": "string",
                        "pattern": "^[0-9]+\\.[0-9]{2}$",
                        "example": "1.25",
                        "description": "Contracts; exactly two decimal places in responses."
                      },
                      "remainingYesBuyCapacity": {
                        "type": "string",
                        "pattern": "^[0-9]+\\.[0-9]{2}$",
                        "example": "1.25",
                        "description": "Contracts; exactly two decimal places in responses.",
                        "nullable": true
                      },
                      "remainingNoBuyCapacity": {
                        "type": "string",
                        "pattern": "^[0-9]+\\.[0-9]{2}$",
                        "example": "1.25",
                        "description": "Contracts; exactly two decimal places in responses.",
                        "nullable": true
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid authentication"
          },
          "403": {
            "description": "Requires positions:read for API keys; account restrictions still apply"
          }
        },
        "security": [
          {
            "poly_market_maker_key": []
          }
        ],
        "summary": "List your positions by outcome",
        "tags": [
          "Trading"
        ],
        "x-market-maker-scope": "positions:read"
      }
    },
    "/orders/trades": {
      "get": {
        "description": "API key required: `Authorization: ApiKey <credential>`. Required scope: `trades:read`.\n\nLists your executions, newest first. Keep marketId unchanged across pages. Trade IDs are strings.",
        "operationId": "TradingController_listTrades",
        "parameters": [
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "nextCursor from the preceding page with the same filters",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "marketId",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id",
                          "outcomeId",
                          "price",
                          "quantity",
                          "createdAt"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "outcomeId": {
                            "type": "string"
                          },
                          "price": {
                            "type": "string",
                            "pattern": "^[0-9]+$",
                            "example": "600000",
                            "description": "Integer micro-USD"
                          },
                          "quantity": {
                            "type": "string",
                            "pattern": "^[0-9]+\\.[0-9]{2}$",
                            "example": "1.25",
                            "description": "Contracts; exactly two decimal places in responses."
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "nextCursor": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid authentication"
          },
          "403": {
            "description": "Requires trades:read for API keys; account restrictions still apply"
          }
        },
        "security": [
          {
            "poly_market_maker_key": []
          }
        ],
        "summary": "List your own executions",
        "tags": [
          "Trading"
        ],
        "x-market-maker-scope": "trades:read"
      }
    },
    "/orders/{orderId}": {
      "get": {
        "description": "API key required: `Authorization: ApiKey <credential>`. Required scope: `orders:read`.\n\nUse the ID returned by an order placement or list. HTTP 200 returns your order and its reserves; an unknown or foreign order returns 404.",
        "operationId": "TradingController_detail",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id",
                    "outcomeId",
                    "direction",
                    "side",
                    "type",
                    "status",
                    "price",
                    "quantity",
                    "remainingQuantity",
                    "reserves",
                    "feeAmount",
                    "createdAt",
                    "expiresAt",
                    "canceledAt"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "outcomeId": {
                      "type": "string"
                    },
                    "marketId": {
                      "type": "string"
                    },
                    "direction": {
                      "type": "string",
                      "enum": [
                        "buy",
                        "sell"
                      ]
                    },
                    "side": {
                      "type": "string",
                      "enum": [
                        "yes",
                        "no"
                      ]
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "limit",
                        "market"
                      ]
                    },
                    "status": {
                      "type": "string"
                    },
                    "price": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Integer micro-USD"
                    },
                    "quantity": {
                      "type": "string",
                      "pattern": "^[0-9]+\\.[0-9]{2}$",
                      "example": "1.25",
                      "description": "Contracts; exactly two decimal places in responses."
                    },
                    "remainingQuantity": {
                      "type": "string",
                      "pattern": "^[0-9]+\\.[0-9]{2}$",
                      "example": "1.25",
                      "description": "Contracts; exactly two decimal places in responses."
                    },
                    "budgetAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Buy only: originally approved budget, including fees."
                    },
                    "spentAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Buy only: total executed cost including fees."
                    },
                    "unusedAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Buy only: budget minus spent amount and current cash reserve."
                    },
                    "feeAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Integer micro-USD"
                    },
                    "grossProceedsAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Sell only: gross proceeds before monetary fees."
                    },
                    "netProceedsAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Sell only: gross proceeds minus fees."
                    },
                    "reserves": {
                      "type": "object",
                      "required": [
                        "cashAmount",
                        "yesQuantity",
                        "noQuantity"
                      ],
                      "properties": {
                        "cashAmount": {
                          "type": "string",
                          "pattern": "^[0-9]+$",
                          "example": "600000",
                          "description": "Integer micro-USD"
                        },
                        "yesQuantity": {
                          "type": "string",
                          "pattern": "^[0-9]+\\.[0-9]{2}$",
                          "example": "1.25",
                          "description": "Contracts; exactly two decimal places in responses."
                        },
                        "noQuantity": {
                          "type": "string",
                          "pattern": "^[0-9]+\\.[0-9]{2}$",
                          "example": "1.25",
                          "description": "Contracts; exactly two decimal places in responses."
                        }
                      }
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time",
                      "nullable": true
                    },
                    "canceledAt": {
                      "type": "string",
                      "format": "date-time",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid authentication"
          },
          "403": {
            "description": "Requires orders:read for API keys; account restrictions still apply"
          },
          "404": {
            "description": "Order not found in this account"
          }
        },
        "security": [
          {
            "poly_market_maker_key": []
          }
        ],
        "summary": "Get one of your orders",
        "tags": [
          "Trading"
        ],
        "x-market-maker-scope": "orders:read",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl --fail-with-body --request GET \"$POLY_API_BASE_URL/orders/$POLY_ORDER_ID\" \\\n  -H \"Authorization: ApiKey $POLY_API_KEY\""
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import json\nimport os\nfrom urllib.request import Request, urlopen\n\nbase = os.environ[\"POLY_API_BASE_URL\"].rstrip(\"/\")\nurl = base + f'/orders/{os.environ[\"POLY_ORDER_ID\"]}'\nheaders = {\"Authorization\": \"ApiKey \" + os.environ[\"POLY_API_KEY\"]}\ndata = None\nwith urlopen(Request(url, method=\"GET\", headers=headers, data=data), timeout=10) as response:\n    print(response.status, json.load(response))"
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "// Run with Node.js, not in a browser.\nconst base = process.env.POLY_API_BASE_URL.replace(/\\/$/, \"\")\nconst response = await fetch(`${base}/orders/${process.env.POLY_ORDER_ID}`, {\n  method: \"GET\",\n  headers: {\n    Authorization: \"ApiKey \" + process.env.POLY_API_KEY,\n  },\n  signal: AbortSignal.timeout(10_000),\n})\nconst payload = await response.json()\nconsole.log(response.status, payload)\nif (!response.ok) process.exitCode = 1"
          }
        ]
      },
      "delete": {
        "description": "API key required: `Authorization: ApiKey <credential>`. Required scope: `orders:cancel`.\n\nCancel your own order by ID. HTTP 200 returns its resulting state; fills are not undone. A foreign or unknown order returns 404. Account restrictions and financial locks still apply.",
        "operationId": "TradingController_cancel",
        "parameters": [
          {
            "name": "orderId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id",
                    "outcomeId",
                    "direction",
                    "side",
                    "type",
                    "status",
                    "price",
                    "quantity",
                    "remainingQuantity",
                    "reserves",
                    "feeAmount",
                    "createdAt",
                    "expiresAt",
                    "canceledAt"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "outcomeId": {
                      "type": "string"
                    },
                    "marketId": {
                      "type": "string"
                    },
                    "direction": {
                      "type": "string",
                      "enum": [
                        "buy",
                        "sell"
                      ]
                    },
                    "side": {
                      "type": "string",
                      "enum": [
                        "yes",
                        "no"
                      ]
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "limit",
                        "market"
                      ]
                    },
                    "status": {
                      "type": "string"
                    },
                    "price": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Integer micro-USD"
                    },
                    "quantity": {
                      "type": "string",
                      "pattern": "^[0-9]+\\.[0-9]{2}$",
                      "example": "1.25",
                      "description": "Contracts; exactly two decimal places in responses."
                    },
                    "remainingQuantity": {
                      "type": "string",
                      "pattern": "^[0-9]+\\.[0-9]{2}$",
                      "example": "1.25",
                      "description": "Contracts; exactly two decimal places in responses."
                    },
                    "budgetAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Buy only: originally approved budget, including fees."
                    },
                    "spentAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Buy only: total executed cost including fees."
                    },
                    "unusedAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Buy only: budget minus spent amount and current cash reserve."
                    },
                    "feeAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Integer micro-USD"
                    },
                    "grossProceedsAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Sell only: gross proceeds before monetary fees."
                    },
                    "netProceedsAmount": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "example": "600000",
                      "description": "Sell only: gross proceeds minus fees."
                    },
                    "reserves": {
                      "type": "object",
                      "required": [
                        "cashAmount",
                        "yesQuantity",
                        "noQuantity"
                      ],
                      "properties": {
                        "cashAmount": {
                          "type": "string",
                          "pattern": "^[0-9]+$",
                          "example": "600000",
                          "description": "Integer micro-USD"
                        },
                        "yesQuantity": {
                          "type": "string",
                          "pattern": "^[0-9]+\\.[0-9]{2}$",
                          "example": "1.25",
                          "description": "Contracts; exactly two decimal places in responses."
                        },
                        "noQuantity": {
                          "type": "string",
                          "pattern": "^[0-9]+\\.[0-9]{2}$",
                          "example": "1.25",
                          "description": "Contracts; exactly two decimal places in responses."
                        }
                      }
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time",
                      "nullable": true
                    },
                    "canceledAt": {
                      "type": "string",
                      "format": "date-time",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid authentication"
          },
          "403": {
            "description": "Requires orders:cancel for API keys; account restrictions still apply"
          },
          "404": {
            "description": "Order not found in this account"
          },
          "409": {
            "description": "An active manual balance lease returns financial_operations_temporarily_locked."
          }
        },
        "security": [
          {
            "poly_market_maker_key": []
          }
        ],
        "summary": "Cancel one of your orders",
        "tags": [
          "Trading"
        ],
        "x-market-maker-scope": "orders:cancel",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl --fail-with-body --request DELETE \"$POLY_API_BASE_URL/orders/$POLY_ORDER_ID\" \\\n  -H \"Authorization: ApiKey $POLY_API_KEY\""
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import json\nimport os\nfrom urllib.request import Request, urlopen\n\nbase = os.environ[\"POLY_API_BASE_URL\"].rstrip(\"/\")\nurl = base + f'/orders/{os.environ[\"POLY_ORDER_ID\"]}'\nheaders = {\"Authorization\": \"ApiKey \" + os.environ[\"POLY_API_KEY\"]}\ndata = None\nwith urlopen(Request(url, method=\"DELETE\", headers=headers, data=data), timeout=10) as response:\n    print(response.status, json.load(response))"
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "// Run with Node.js, not in a browser.\nconst base = process.env.POLY_API_BASE_URL.replace(/\\/$/, \"\")\nconst response = await fetch(`${base}/orders/${process.env.POLY_ORDER_ID}`, {\n  method: \"DELETE\",\n  headers: {\n    Authorization: \"ApiKey \" + process.env.POLY_API_KEY,\n  },\n  signal: AbortSignal.timeout(10_000),\n})\nconst payload = await response.json()\nconsole.log(response.status, payload)\nif (!response.ok) process.exitCode = 1"
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "poly_market_maker_key": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "description": "Send ApiKey <credential> over HTTPS."
      }
    }
  }
}
