### Get a Quote Response Example (YAML) Source: https://docs.polymarket.com/api-reference/bridge/get-a-quote Example of a successful response from the /quote endpoint, including estimated checkout time, fees, and token amounts. ```yaml estCheckoutTimeMs: 25000 estFeeBreakdown: appFeeLabel: Fun.xyz fee appFeePercent: 0 appFeeUsd: 0 fillCostPercent: 0 fillCostUsd: 0 gasUsd: 0.003854 maxSlippage: 0 minReceived: 14.488305 swapImpact: 0 swapImpactUsd: 0 totalImpact: 0 totalImpactUsd: 0 estInputUsd: 14.488305 estOutputUsd: 14.488305 estToTokenBaseUnit: '14491203' quoteId: >- 0x00c34ba467184b0146406d62b0e60aaa24ed52460bd456222b6155a0d9de0ad5 ``` -------------------------------- ### Get Order Books Response Example (YAML) Source: https://docs.polymarket.com/api-reference/market-data/get-order-books-request-body This example shows a successful response containing order book summaries for multiple markets. It includes details like market ID, asset ID, timestamp, bids, asks, and trade information. ```yaml - market: '0x1234567890123456789012345678901234567890' asset_id: 0xabc123def456... timestamp: '1234567890' hash: a1b2c3d4e5f6... bids: - price: '0.45' size: '100' asks: - price: '0.46' size: '150' min_order_size: '1' tick_size: '0.01' neg_risk: false last_trade_price: '0.45' ``` -------------------------------- ### Install Polymarket CLOB Client v2 Source: https://docs.polymarket.com/api-reference/clients-sdks Install the CLOB client and its dependencies for your respective language. ```bash npm install @polymarket/clob-client-v2 viem ``` ```bash pip install py-clob-client-v2 ``` ```bash cargo add polymarket_client_sdk_v2 --features clob ``` -------------------------------- ### Get a Quote Request Example (YAML) Source: https://docs.polymarket.com/api-reference/bridge/get-a-quote Example of a request body for the /quote endpoint, specifying the amount, source and destination chains, and token addresses. ```yaml fromAmountBaseUnit: '10000000' fromChainId: '137' fromTokenAddress: '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359' recipientAddress: '0x17eC161f126e82A8ba337f4022d574DBEaFef575' toChainId: '137' toTokenAddress: '0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB' ``` -------------------------------- ### Get Midpoint Prices Response Example Source: https://docs.polymarket.com/api-reference/market-data/get-midpoint-prices-request-body This example demonstrates the expected response format when successfully retrieving midpoint prices. The response is a map where keys are token IDs and values are their corresponding midpoint prices. ```yaml 0xabc123def456...: '0.45' 0xdef456abc123...: '0.52' ``` -------------------------------- ### Authentication Message Example Source: https://docs.polymarket.com/api-reference/wss/rfq Use this example to authenticate your connection to the API. Ensure you provide your API key, secret, passphrase, and identity details. ```json { "type": "auth", "auth": { "apiKey": "YOUR_API_KEY", "secret": "YOUR_API_SECRET", "passphrase": "YOUR_API_PASSPHRASE" }, "identity": { "signer_address": "0xYourSigner", "maker_address": "0xYourQuoterWallet", "signature_type": 0 } } ``` -------------------------------- ### Authentication Response Example Source: https://docs.polymarket.com/api-reference/wss/rfq This is an example of a successful authentication response from the gateway. It includes the authenticated address upon success. ```json { "type": "auth", "success": true, "address": "0xAuthenticatedAddress" } ``` -------------------------------- ### User Channel Subscription Request Example Source: https://docs.polymarket.com/api-reference/wss/user This example demonstrates the structure of an authenticated subscription request for the User Channel. It includes API credentials and specifies the channel type. ```json { "auth": { "apiKey": "your-api-key-uuid", "secret": "your-api-secret", "passphrase": "your-passphrase" }, "type": "user" } ``` -------------------------------- ### Maker Confirmation Request Example Source: https://docs.polymarket.com/api-reference/maker/confirm-or-decline-last-look This example demonstrates the structure of a request to confirm or decline a last-look quote. Ensure 'decision' is set to 'CONFIRM' or 'DECLINE'. ```json { "rfq_id": "rfq_", "quote_id": "quote_", "signer_address": "0xYourSigner", "maker_address": "0xYourQuoterWallet", "signature_type": 0, "decision": "CONFIRM" } ``` -------------------------------- ### EIP-712 Signing Example (Python) Source: https://docs.polymarket.com/api-reference/authentication Example of signing data using EIP-712 in Python. This is required for L1 authentication. ```python domain = { "name": "ClobAuthDomain", "version": "1", "chainId": chainId, # Polygon Chain ID 137 } types = { "ClobAuth": [ {"name": "address", "type": "address"}, {"name": "timestamp", "type": "string"}, {"name": "nonce", "type": "uint256"}, {"name": "message", "type": "string"}, ] } value = { "address": signingAddress, # The signing address "timestamp": ts, # The CLOB API server timestamp "nonce": nonce, # The nonce used "message": "This message attests that I control the given wallet", } sig = signer.sign_typed_data(domain, types, value) ``` -------------------------------- ### RFQ Confirmation Request Example Source: https://docs.polymarket.com/api-reference/wss/rfq Example of a last-look confirmation request for a selected quote. Ensure all fields are correctly populated. ```json { "type": "RFQ_CONFIRMATION_REQUEST", "rfq_id": "rfq_", "quote_id": "quote_", "signer_address": "0xYourSigner", "maker_address": "0xYourQuoterWallet", "signature_type": 0, "leg_position_ids": [ "", "" ], "condition_id": "0x", "yes_position_id": "", "no_position_id": "", "direction": "BUY", "side": "YES", "fill_size_e6": "1000000", "price_e6": "450000", "confirm_by": 1780575184000 } ``` -------------------------------- ### Example API Response for User Earnings Source: https://docs.polymarket.com/api-reference/rewards/get-earnings-for-user-by-date This example demonstrates the structure of a successful response when fetching user earnings. It includes pagination details and a sample earnings data entry. ```json { "limit": 100, "count": 1, "next_cursor": "LTE=", "data": [ { "date": "2024-03-26T00:00:00Z", "condition_id": "0xbd31dc8a20211944f6b70f31557f1001557b59905b7738480ca09bd4532f84af", "asset_address": "0x9c4E1703476E875070EE25b56A58B008CFb8FA78", "maker_address": "0xFeA4cB3dD4ca7CefD3368653B7D6FF9BcDFca604", "earnings": 0.237519, "asset_rate": 1 } ] } ``` -------------------------------- ### Initialize and Use CLOB Client Source: https://docs.polymarket.com/api-reference/authentication Examples of initializing the CLOB client and creating/posting orders in TypeScript, Python, and Rust. ```APIDOC ## Initialize and Use CLOB Client ### Description Examples of initializing the CLOB client and creating/posting orders in TypeScript, Python, and Rust. ### TypeScript Example ```typescript import { ClobClient, Side } from "@polymarket/clob-client-v2"; import { createWalletClient, http } from "viem"; import { privateKeyToAccount } from "viem/accounts"; const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`); const signer = createWalletClient({ account, transport: http() }); const depositWalletAddress = process.env.DEPOSIT_WALLET_ADDRESS!; const client = new ClobClient({ host: "https://clob.polymarket.com", chain: 137, signer, creds: apiCreds, // Generated from L1 auth, API credentials enable L2 methods signatureType: 3, // POLY_1271, explained below funderAddress: depositWalletAddress, // deposit wallet funder }); // Now you can trade! const order = await client.createAndPostOrder( { tokenID: "123456", price: 0.65, size: 100, side: Side.BUY }, { tickSize: "0.01", negRisk: false } ); ``` ### Python Example ```python from py_clob_client_v2 import ClobClient, OrderArgs, PartialCreateOrderOptions from py_clob_client_v2.order_builder.constants import BUY import os client = ClobClient( host="https://clob.polymarket.com", chain_id=137, key=os.getenv("PRIVATE_KEY"), creds=api_creds, # Generated from L1 auth, API credentials enable L2 methods signature_type=3, # POLY_1271, explained below funder=os.getenv("DEPOSIT_WALLET_ADDRESS") ) # Now you can trade! order = client.create_and_post_order( OrderArgs(token_id="123456", price=0.65, size=100, side=BUY), options=PartialCreateOrderOptions(tick_size="0.01", neg_risk=False), ) ``` ### Rust Example ```rust use polymarket_client_sdk_v2::clob::types::{Side, SignatureType}; use polymarket_client_sdk_v2::types::dec; let deposit_wallet = std::env::var("DEPOSIT_WALLET_ADDRESS")?.parse()?; let client = Client::new("https://clob.polymarket.com", Config::default())? .authentication_builder(&signer) .funder(deposit_wallet) .signature_type(SignatureType::Poly1271) .authenticate() .await?; // Now you can trade! let order = client.limit_order() .token_id("123456".parse()?) .price(dec!(0.65)) .size(dec!(100)) .side(Side::Buy) .build().await?; let signed = client.sign(&signer, order).await?; let response = client.post_order(signed).await?; ``` ``` -------------------------------- ### Post Order Request Example Source: https://docs.polymarket.com/api-reference/trade/post-a-new-order This example demonstrates the structure of a JSON payload for posting a new order. It includes details like maker, signer, amounts, side, expiration, and signature. ```json { "order": { "maker": "0x1234567890123456789012345678901234567890", "signer": "0x1234567890123456789012345678901234567890", "tokenId": "0xabc123def456...", "makerAmount": "100000000", "takerAmount": "200000000", "side": "BUY", "expiration": "1735689600", "timestamp": "1735689600000", "metadata": "", "builder": "0x0000000000000000000000000000000000000000000000000000000000000000", "signature": "0x1234abcd...", "salt": 1234567890, "signatureType": 0 }, "owner": "f4f247b7-4ac7-ff29-a152-04fda0a8755a", "orderType": "GTC", "deferExec": false, "postOnly": false } ``` -------------------------------- ### Get User Orders OpenAPI Specification Source: https://docs.polymarket.com/api-reference/trade/get-user-orders This OpenAPI specification defines the GET /data/orders endpoint for retrieving user orders. It includes details on parameters, responses, and example payloads. ```yaml openapi: 3.1.0 info: title: Polymarket CLOB API description: Polymarket CLOB API Reference license: name: MIT identifier: MIT version: 1.0.0 servers: - url: https://clob.polymarket.com description: Production CLOB API - url: https://clob-staging.polymarket.com description: Staging CLOB API security: [] tags: - name: Trade description: Trade endpoints - name: Markets description: Market data endpoints - name: Account description: Account and authentication endpoints - name: Notifications description: User notification endpoints - name: Rewards description: Rewards and earnings endpoints - name: Rebates description: Maker rebate endpoints paths: /data/orders: get: tags: - Trade summary: Get user orders description: > Retrieves open orders for the authenticated user. Returns paginated results. Builder-authenticated clients can also use this endpoint to retrieve orders attributed to their builder account. operationId: getOrders parameters: - name: id in: query description: Order ID (hash) to filter by specific order required: false schema: type: string example: '0xabcdef1234567890abcdef1234567890abcdef12' - name: market in: query description: Market (condition ID) to filter orders required: false schema: type: string example: '0x0000000000000000000000000000000000000000000000000000000000000001' - name: asset_id in: query description: Asset ID (token ID) to filter orders required: false schema: type: string example: 0xabc123def456... - name: next_cursor in: query description: Cursor for pagination (base64 encoded offset) required: false schema: type: string example: MA== responses: '200': description: Successfully retrieved orders content: application/json: schema: $ref: '#/components/schemas/OrdersResponse' examples: example: summary: User orders response value: limit: 100 next_cursor: MTAw count: 2 data: - id: '0xabcdef1234567890abcdef1234567890abcdef12' status: ORDER_STATUS_LIVE owner: f4f247b7-4ac7-ff29-a152-04fda0a8755a maker_address: '0x1234567890123456789012345678901234567890' market: >- 0x0000000000000000000000000000000000000000000000000000000000000001 asset_id: 0xabc123def456... side: BUY original_size: '100000000' size_matched: '0' price: '0.5' outcome: 'YES' expiration: '1735689600' order_type: GTC associate_trades: [] created_at: 1700000000 - id: '0xfedcba0987654321fedcba0987654321fedcba09' status: ORDER_STATUS_LIVE owner: f4f247b7-4ac7-ff29-a152-04fda0a8755a maker_address: '0x1234567890123456789012345678901234567890' market: >- 0x0000000000000000000000000000000000000000000000000000000000000002 asset_id: 0xdef456abc789... side: SELL original_size: '200000000' size_matched: '50000000' price: '0.75' outcome: 'NO' expiration: '1735689600' order_type: GTC associate_trades: - trade-123 created_at: 1700000001 '400': description: Bad request - Invalid parameters content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: error: invalid order params payload '401': ``` -------------------------------- ### Get Midpoint Prices Request Body Example Source: https://docs.polymarket.com/api-reference/market-data/get-midpoint-prices-request-body This example shows the structure of the request body to retrieve midpoint prices for multiple token IDs. Each item in the array should contain a `token_id`. ```yaml - token_id: 0xabc123def456... - token_id: 0xdef456abc123... ``` -------------------------------- ### Initialize CLOB Client and Fetch Markets Source: https://docs.polymarket.com/api-reference/clients-sdks Initialize the CLOB client with host, chain, signer, and credentials, then fetch available markets. ```typescript import { ClobClient } from "@polymarket/clob-client-v2"; const client = new ClobClient({ host: "https://clob.polymarket.com", chain: 137, signer, creds: apiCreds, }); const markets = await client.getMarkets(); ``` ```python from py_clob_client_v2 import ClobClient client = ClobClient( "https://clob.polymarket.com", key=private_key, chain_id=137, creds=api_creds, ) markets = client.get_markets() ``` ```rust use polymarket_client_sdk_v2::clob::{Client, Config}; let client = Client::new("https://clob.polymarket.com", Config::default())? .authentication_builder(&signer) .authenticate() .await?; let markets = client.markets(None).await?; ``` -------------------------------- ### OpenAPI Specification for Get Single Order by ID Source: https://docs.polymarket.com/api-reference/trade/get-single-order-by-id This OpenAPI specification defines the GET /data/order/{orderID} endpoint for retrieving a single order. It includes request parameters, response schemas, and example responses for success and various error conditions. ```yaml openapi: 3.1.0 info: title: Polymarket CLOB API description: Polymarket CLOB API Reference license: name: MIT identifier: MIT version: 1.0.0 servers: - url: https://clob.polymarket.com description: Production CLOB API - url: https://clob-staging.polymarket.com description: Staging CLOB API security: [] tags: - name: Trade description: Trade endpoints - name: Markets description: Market data endpoints - name: Account description: Account and authentication endpoints - name: Notifications description: User notification endpoints - name: Rewards description: Rewards and earnings endpoints - name: Rebates description: Maker rebate endpoints paths: /data/order/{orderID}: get: tags: - Trade summary: Get single order by ID description: > Retrieves a specific order by its ID (order hash) for the authenticated user. Builder-authenticated clients can also use this endpoint to retrieve orders attributed to their builder account. operationId: getOrder parameters: - name: orderID in: path description: Order ID (order hash) required: true schema: type: string example: '0x0000000000000000000000000000000000000000000000000000000000000001' responses: '200': description: Successfully retrieved order content: application/json: schema: $ref: '#/components/schemas/OpenOrder' example: id: '0xabcdef1234567890abcdef1234567890abcdef12' status: ORDER_STATUS_LIVE owner: f4f247b7-4ac7-ff29-a152-04fda0a8755a maker_address: '0x1234567890123456789012345678901234567890' market: >- 0x0000000000000000000000000000000000000000000000000000000000000001 asset_id: 0xabc123def456... side: BUY original_size: '100000000' size_matched: '0' price: '0.5' outcome: 'YES' expiration: '1735689600' order_type: GTC associate_trades: [] created_at: 1700000000 '400': description: Bad request - Invalid order ID content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: error: Invalid orderID '401': description: Unauthorized - Invalid API key or authentication failed content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: error: Invalid API key '404': description: Order not found content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: error: Order not found '500': description: Internal server error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: error: Internal server error security: - polyApiKey: [] polyAddress: [] polySignature: [] polyPassphrase: [] polyTimestamp: [] components: schemas: OpenOrder: type: object required: - id - status - owner - maker_address - market - asset_id - side - original_size - size_matched - price - expiration - order_type - created_at - outcome properties: id: type: string description: Order ID (order hash) example: '0xabcdef1234567890abcdef1234567890abcdef12' status: type: string description: Order status enum: - ORDER_STATUS_LIVE - ORDER_STATUS_INVALID - ORDER_STATUS_CANCELED_MARKET_RESOLVED - ORDER_STATUS_CANCELED - ORDER_STATUS_MATCHED owner: type: string description: UUID of the order owner example: f4f247b7-4ac7-ff29-a152-04fda0a8755a maker_address: type: string description: Ethereum address of the maker ``` -------------------------------- ### OpenAPI Specification for Get Builder Trades Source: https://docs.polymarket.com/api-reference/trade/get-builder-trades This OpenAPI specification defines the GET /builder/trades endpoint for retrieving trades attributed to a builder code. It includes parameters for filtering by trade ID, market, asset ID, time range, and pagination, along with response schemas and examples. ```yaml openapi: 3.1.0 info: title: Polymarket CLOB API description: Polymarket CLOB API Reference license: name: MIT identifier: MIT version: 1.0.0 servers: - url: https://clob.polymarket.com description: Production CLOB API - url: https://clob-staging.polymarket.com description: Staging CLOB API security: [] tags: - name: Trade description: Trade endpoints - name: Markets description: Market data endpoints - name: Account description: Account and authentication endpoints - name: Notifications description: User notification endpoints - name: Rewards description: Rewards and earnings endpoints - name: Rebates description: Maker rebate endpoints paths: /builder/trades: get: tags: - Trade summary: Get builder trades description: | Retrieves trades attributed to a builder code. operationId: getBuilderTrades parameters: - name: builder_code in: query description: Builder code to fetch attributed trades for required: true schema: type: string pattern: ^0x[a-fA-F0-9]{64}$ example: '0x0000000000000000000000000000000000000000000000000000000000000001' - name: id in: query description: Trade ID to filter by specific trade required: false schema: type: string example: trade-123 - name: market in: query description: Market (condition ID) to filter trades required: false schema: type: string pattern: ^0x[a-fA-F0-9]{64}$ example: '0x0000000000000000000000000000000000000000000000000000000000000001' - name: asset_id in: query description: Asset ID (token ID) to filter trades required: false schema: type: string example: >- 15871154585880608648532107628464183779895785213830018178010423617714102767076 - name: before in: query description: Filter trades before this Unix timestamp required: false schema: type: string pattern: ^\d+$ example: '1700000000' - name: after in: query description: Filter trades after this Unix timestamp required: false schema: type: string pattern: ^\d+$ example: '1600000000' - name: next_cursor in: query description: Cursor for pagination (base64 encoded offset) required: false schema: type: string example: MA== responses: '200': description: Successfully retrieved builder trades content: application/json: schema: $ref: '#/components/schemas/BuilderTradesResponse' examples: example: summary: Builder trades response value: limit: 300 next_cursor: MzAw count: 2 data: - id: trade-123 tradeType: TAKER takerOrderHash: '0xabcdef1234567890abcdef1234567890abcdef12' builder: >- 0x0000000000000000000000000000000000000000000000000000000000000001 market: >- 0x0000000000000000000000000000000000000000000000000000000000000001 assetId: >- 15871154585880608648532107628464183779895785213830018178010423617714102767076 side: BUY size: '100000000' sizeUsdc: '50000000' price: '0.5' status: TRADE_STATUS_CONFIRMED outcome: 'YES' outcomeIndex: 0 owner: f4f247b7-4ac7-ff29-a152-04fda0a8755a maker: '0x1234567890123456789012345678901234567890' transactionHash: >- 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef matchTime: '1700000000' bucketIndex: 0 fee: '300000' feeUsdc: '150000' createdAt: '2024-01-01T00:00:00Z' updatedAt: '2024-01-01T00:00:00Z' '400': ``` -------------------------------- ### Get Spreads OpenAPI Specification Source: https://docs.polymarket.com/api-reference/market-data/get-spreads This OpenAPI specification defines the endpoint for retrieving spreads for multiple token IDs. It includes request and response schemas, along with examples. ```yaml openapi: 3.1.0 info: title: Polymarket CLOB API description: Polymarket CLOB API Reference license: name: MIT identifier: MIT version: 1.0.0 servers: - url: https://clob.polymarket.com description: Production CLOB API - url: https://clob-staging.polymarket.com description: Staging CLOB API security: [] tags: - name: Trade description: Trade endpoints - name: Markets description: Market data endpoints - name: Account description: Account and authentication endpoints - name: Notifications description: User notification endpoints - name: Rewards description: Rewards and earnings endpoints - name: Rebates description: Maker rebate endpoints paths: /spreads: post: tags: - Market Data summary: Get spreads description: | Retrieves spreads for multiple token IDs. The spread is the difference between the best ask and best bid prices. operationId: getSpreads requestBody: required: true content: application/json: schema: type: array items: $ref: '#/components/schemas/BookRequest' example: - token_id: 0xabc123def456... - token_id: 0xdef456abc123... responses: '200': description: Successfully retrieved spreads content: application/json: schema: type: object additionalProperties: type: string description: Map of token ID to spread example: 0xabc123def456...: '0.02' 0xdef456abc123...: '0.015' '400': description: Bad request - Invalid payload content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: error: Invalid payload '500': description: Internal server error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: error: error getting the spread security: [] components: schemas: BookRequest: type: object required: - token_id properties: token_id: type: string description: Token ID (asset ID) example: 0xabc123def456... side: type: string description: Order side (optional, not used for midpoint calculation) enum: - BUY - SELL example: BUY ErrorResponse: type: object required: - error properties: error: type: string description: Error message code: type: string description: Machine-readable error code, when provided retry_after_seconds: type: integer description: Number of seconds to wait before retrying, when provided ``` -------------------------------- ### New Market Event Example Source: https://docs.polymarket.com/api-reference/wss/market This example demonstrates the structure of a 'new_market' event message. It includes details about the market question, outcomes, associated assets, and event metadata. Requires custom_feature_enabled: true. ```json { "event_type": "new_market", "id": "1031769", "question": "Will NVIDIA (NVDA) close above $240 end of January?", "market": "0x311d0c4b6671ab54af4970c06fcf58662516f5168997bdda209ec3db5aa6b0c1", "slug": "nvda-above-240-on-january-30-2026", "description": "This market will resolve to \"Yes\" if the official closing price for NVIDIA (NVDA) on the final trading day of January 2026 is higher than the listed price. Otherwise, this market will resolve to \"No\".", "assets_ids": [ "76043073756653678226373981964075571318267289248134717369284518995922789326425", "31690934263385727664202099278545688007799199447969475608906331829650099442770" ], "outcomes": [ "Yes", "No" ], "event_message": { "id": "125819", "ticker": "nvda-above-in-january-2026", "slug": "nvda-above-in-january-2026", "title": "Will NVIDIA (NVDA) close above ___ end of January?", "description": "This market will resolve to \"Yes\" if the official closing price for NVIDIA (NVDA) on the final trading day of January 2026 is higher than the listed price. Otherwise, this market will resolve to \"No\"." }, "timestamp": "1766790415550", "tags": [ "stocks" ], "condition_id": "0x311d0c4b6671ab54af4970c06fcf58662516f5168997bdda209ec3db5aa6b0c1", "active": true, "clob_token_ids": [ "76043073756653678226373981964075571318267289248134717369284518995922789326425", "31690934263385727664202099278545688007799199447969475608906331829650099442770" ], "sports_market_type": "", "line": "", "game_start_time": "", "order_price_min_tick_size": "0.01", "group_item_title": "NVDA above $240" } ``` -------------------------------- ### OpenAPI Specification for Get Market Prices Source: https://docs.polymarket.com/api-reference/market-data/get-market-prices-request-body This OpenAPI specification defines the POST /prices endpoint for retrieving market prices. It includes request body schema, examples, and possible responses. ```yaml openapi: 3.1.0 info: title: Polymarket CLOB API description: Polymarket CLOB API Reference license: name: MIT identifier: MIT version: 1.0.0 servers: - url: https://clob.polymarket.com description: Production CLOB API - url: https://clob-staging.polymarket.com description: Staging CLOB API security: [] tags: - name: Trade description: Trade endpoints - name: Markets description: Market data endpoints - name: Account description: Account and authentication endpoints - name: Notifications description: User notification endpoints - name: Rewards description: Rewards and earnings endpoints - name: Rebates description: Maker rebate endpoints paths: /prices: post: tags: - Market Data summary: Get market prices (request body) description: > Retrieves market prices for multiple token IDs and sides using a request body. Each request must include both token_id and side. operationId: getPricesPost requestBody: required: true content: application/json: schema: type: array items: $ref: '#/components/schemas/BookRequest' example: - token_id: 0xabc123def456... side: BUY - token_id: 0xdef456abc123... side: SELL responses: '200': description: Successfully retrieved market prices content: application/json: schema: type: object additionalProperties: type: object additionalProperties: type: number format: double description: Map of token ID to map of side to price example: 0xabc123def456...: BUY: 0.45 0xdef456abc123...: SELL: 0.52 '400': description: Bad request - Invalid payload or side content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' examples: invalid_payload: summary: Invalid payload value: error: Invalid payload invalid_side: summary: Invalid side value: error: Invalid side '404': description: Not found - No orderbook exists for the requested token id content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: error: No orderbook exists for the requested token id '500': description: Internal server error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: error: Internal server error security: [] components: schemas: BookRequest: type: object required: - token_id properties: token_id: type: string description: Token ID (asset ID) example: 0xabc123def456... side: type: string description: Order side (optional, not used for midpoint calculation) enum: - BUY - SELL example: BUY ErrorResponse: type: object required: - error properties: error: type: string description: Error message code: type: string description: Machine-readable error code, when provided retry_after_seconds: type: integer description: Number of seconds to wait before retrying, when provided ``` -------------------------------- ### RFQ Execution Update Example Source: https://docs.polymarket.com/api-reference/wss/rfq This example demonstrates an RFQ execution update, indicating the progress of a trade. It includes the RFQ ID and the current status, such as MATCHED, MINED, CONFIRMED, or FAILED. A transaction hash may also be provided. ```json { "type": "RFQ_EXECUTION_UPDATE", "rfq_id": "rfq_", "status": "MINED", "tx_hash": "0x" } ``` -------------------------------- ### Get Tick Size OpenAPI Specification Source: https://docs.polymarket.com/api-reference/market-data/get-tick-size This OpenAPI specification defines the endpoint for retrieving the tick size. It includes request parameters, response schemas, and example responses for success and error cases. ```yaml openapi: 3.1.0 info: title: Polymarket CLOB API description: Polymarket CLOB API Reference license: name: MIT identifier: MIT version: 1.0.0 servers: - url: https://clob.polymarket.com description: Production CLOB API - url: https://clob-staging.polymarket.com description: Staging CLOB API security: [] tags: - name: Trade description: Trade endpoints - name: Markets description: Market data endpoints - name: Account description: Account and authentication endpoints - name: Notifications description: User notification endpoints - name: Rewards description: Rewards and earnings endpoints - name: Rebates description: Maker rebate endpoints paths: /tick-size: get: tags: - Market Data summary: Get tick size description: > Retrieves the minimum tick size (price increment) for a specific token ID. The tick size can be provided either as a query parameter or as a path parameter. operationId: getTickSize parameters: - name: token_id in: query description: Token ID (asset ID) required: false schema: type: string example: 0xabc123def456... responses: '200': description: Successfully retrieved tick size content: application/json: schema: $ref: '#/components/schemas/TickSize' example: minimum_tick_size: 0.01 '400': description: Bad request - Invalid token id content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: error: Invalid token id '404': description: Not found - Market not found content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: error: market not found '500': description: Internal server error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: error: Internal server error security: [] components: schemas: TickSize: type: object required: - minimum_tick_size properties: minimum_tick_size: type: number format: double description: Minimum tick size (price increment) example: 0.01 ErrorResponse: type: object required: - error properties: error: type: string description: Error message code: type: string description: Machine-readable error code, when provided retry_after_seconds: type: integer description: Number of seconds to wait before retrying, when provided ``` -------------------------------- ### Create API Credentials Source: https://docs.polymarket.com/api-reference/authentication Use this endpoint to create new API credentials for authentication. ```bash POST https://clob.polymarket.com/auth/api-key ``` -------------------------------- ### Get Prices History OpenAPI Specification Source: https://docs.polymarket.com/api-reference/markets/get-prices-history This OpenAPI specification defines the endpoint for retrieving historical price data. It includes details on parameters such as market ID, start and end timestamps, interval, and fidelity. ```yaml openapi: 3.1.0 info: title: Polymarket CLOB API description: Polymarket CLOB API Reference license: name: MIT identifier: MIT version: 1.0.0 servers: - url: https://clob.polymarket.com description: Production CLOB API - url: https://clob-staging.polymarket.com description: Staging CLOB API security: [] tags: - name: Trade description: Trade endpoints - name: Markets description: Market data endpoints - name: Account description: Account and authentication endpoints - name: Notifications description: User notification endpoints - name: Rewards description: Rewards and earnings endpoints - name: Rebates description: Maker rebate endpoints paths: /prices-history: get: tags: - Markets summary: Get prices history description: Retrieve historical price data for a market. operationId: getPricesHistory parameters: - name: market in: query required: true description: The market (asset id) to query. schema: type: string - name: startTs in: query required: false description: Filter by items after this unix timestamp. schema: type: number format: double - name: endTs in: query required: false description: Filter by items before this unix timestamp. schema: type: number format: double - name: interval in: query required: false description: Time interval for data aggregation. schema: type: string enum: - max - all - 1m - 1w - 1d - 6h - 1h - name: fidelity in: query required: false description: Accuracy of the data expressed in minutes. Default is 1 minute. schema: type: integer responses: '200': description: Successful response with price history content: application/json: schema: $ref: '#/components/schemas/PricesHistoryResponse' '400': description: Bad Request - Missing or invalid query parameters content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '500': description: Internal server error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' security: [] components: schemas: PricesHistoryResponse: type: object properties: history: type: array items: $ref: '#/components/schemas/MarketPrice' ErrorResponse: type: object required: - error properties: error: type: string description: Error message code: type: string description: Machine-readable error code, when provided retry_after_seconds: type: integer description: Number of seconds to wait before retrying, when provided MarketPrice: type: object properties: t: type: integer format: uint32 p: type: number format: float ```