Skip to main content

Polymarket Integration

The polymarket tool now supports market browsing and trading via these APIs:

  • Gamma API (https://gamma-api.polymarket.com)
  • CLOB API (https://clob.polymarket.com)

Supported Read Operations

OperationDescription
list_marketsList markets
get_marketGet market details
list_eventsList events
get_orderbookGet order book
get_priceGet price
get_positionsGet positions
get_balanceGet balance
get_open_ordersGet open orders
get_usdc_allowanceGet USDC allowance

Supported Write Operations

OperationDescription
place_orderPlace order
cancel_orderCancel order

Authentication and Signing Flow

L1 Handshake (One-time Bootstrap)

  • Sign CLOB ClobAuth EIP-712 payload with Polygon chain id 137
  • Call POST /auth/api-key; fall back to GET /auth/derive-api-key if needed
  • Persist the returned { apiKey, secret, passphrase } for L2

L2 Authenticated Requests

Each authenticated CLOB request is signed:

  • timestamp + method + request_path (+ body for POST)

Order Signing

place_order signs EIP-712 orders with domain:

  • name: Polymarket CTF Exchange
  • version: 1
  • chain id: 137

Configuration

Config path: integrations.polymarket

FieldDefault
enabledfalse
gamma_base_urlhttps://gamma-api.polymarket.com
clob_base_urlhttps://clob.polymarket.com
timeout_secs15

USDC Allowance

get_usdc_allowance only reports allowance status; it does not change chain state.

  • Token: USDC.e on Polygon
  • Spender: Polymarket exchange

Error and Retry Behavior

  • 4xx errors are treated as client errors and not retried
  • 429 and 5xx errors are treated as transient, retried up to 3 times
  • Fixed 500ms backoff between retries

Next Steps