Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt

Use this file to discover all available pages before exploring further.

Polymarket’s CLOB (Central Limit Order Book) is a hybrid-decentralized trading system — offchain order matching with onchain settlement via the Exchange contract (audited by Chainsecurity). All trading is non-custodial. Orders are EIP-712 signed messages, and matched trades settle atomically on Polygon. The operator cannot set prices or execute unauthorized trades. We recommend using the open-source SDK clients, which handle order signing, authentication, and submission:

TypeScript Client

npm install @polymarket/clob-client-v2 viem

Python Client

pip install py-clob-client-v2

Rust Client

cargo add polymarket_client_sdk_v2 —features clob

You can also use the REST API directly, but you’ll need to manage EIP-712 order signing and HMAC authentication headers yourself. See REST API Headers below.

Authentication

The CLOB uses two levels of authentication:
LevelMethodPurpose
L1EIP-712 signature (private key)Create or derive API credentials
L2HMAC-SHA256 (API credentials)Place orders, cancel orders, query trades
You use your private key once to derive L2 credentials (API key, secret, passphrase), which authenticate all subsequent trading requests.
import { ClobClient } 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() });

// Derive L2 API credentials
const tempClient = new ClobClient({
  host: "https://clob.polymarket.com",
  chain: 137,
  signer,
});
const apiCreds = await tempClient.createOrDeriveApiKey();

Signature Types

When initializing the trading client, you must specify your wallet’s signature type and funder address:
Wallet TypeIDWhen to UseFunder Address
EOA0Standalone wallet — you pay your own gas (POL for gas)Your EOA wallet address
POLY_PROXY1Existing Polymarket proxy wallet flowYour proxy wallet address
GNOSIS_SAFE2Existing Gnosis Safe wallet flowYour Safe wallet address
POLY_12713Deposit wallet flow for new API users. Orders are signed by the owner/session signer and validated by ERC-1271Your deposit wallet address
New API users should use deposit wallets with signature type 3. Existing Proxy and Safe users are unaffected and can keep using signature types 1 and 2. Type 0 is for standalone EOA wallets only.

Initialize the Trading Client

const depositWalletAddress = process.env.DEPOSIT_WALLET_ADDRESS!;

const client = new ClobClient({
  host: "https://clob.polymarket.com",
  chain: 137,
  signer,
  creds: apiCreds,
  signatureType: 3, // POLY_1271
  funderAddress: depositWalletAddress,
});

REST API Headers

If you’re using the REST API directly (without the SDK), you need to attach authentication headers to each request. L1 Headers — for creating or deriving API credentials:
HeaderDescription
POLY_ADDRESSYour wallet address
POLY_SIGNATUREEIP-712 signature
POLY_TIMESTAMPUnix timestamp
POLY_NONCERequest nonce
L2 Headers — for all trading operations (orders, cancellations, queries):
HeaderDescription
POLY_ADDRESSYour wallet address
POLY_SIGNATUREHMAC-SHA256 signature of the request
POLY_TIMESTAMPUnix timestamp
POLY_API_KEYYour API key
POLY_PASSPHRASEYour API passphrase
Even with L2 authentication, methods that create orders still require the user’s private key for EIP-712 order payload signing. L2 credentials authenticate the request, but the order itself must be signed by the key.

Client Methods

Public Methods

Market data, orderbooks, prices, and spreads — no auth required.

L1 Methods

Sign orders and derive API credentials with your private key.

L2 Methods

Place orders, cancel orders, query trades, and manage notifications.

Builder Methods

Track orders and trades attributed to your builder code.

Server Infrastructure

The CLOB matching engine runs in the following regions:
  • Primary Servers: eu-west-2
  • Closest Non-Georestricted Region: eu-west-1
Direct co-location available. Users who complete the KYC/KYB form can get access to co-locate directly in eu-west-2 for the lowest possible latency to Polymarket’s primary servers. See Geographic Restrictions for full geographic availability details.

What Is in This Section

Quickstart

Place your first order end-to-end

Orderbook

Reading the orderbook, prices, spreads, and midpoints

Orders

Order types, tick sizes, creating, cancelling, and querying orders

Fees

Fee structure, fee-enabled markets, and maker rebates

Gasless Transactions

Execute onchain operations without paying gas

CTF Tokens

Split, merge, and redeem outcome tokens

Bridge

Deposit and withdraw funds across chains