Polymarket API Key Setup
Everything you need to generate, store and use a Polymarket CLOB API key — a security-first walkthrough for developers building bots, analytics tools and automated forecasting pipelines.
TL;DR
Polymarket's public Gamma and Data endpoints work without any key. You only need CLOB API credentials — a key, secret and passphrase — to place or manage orders. The three values are derived from a wallet signature, kept server-side in environment variables, and are revocable independently of the wallet's private key.
PolyMarketBot is a read-only intelligence layer over Polymarket. No API key required, no orders placed — just live signals, verdicts and cross-venue spread.
When You Actually Need an API Key
- Reading markets, prices, order books, trades: no key needed — use Gamma / Data.
- Placing, cancelling or managing orders: CLOB credentials required.
- Fetching your own positions and P&L history: CLOB credentials required.
- Building read-only dashboards or research tools: no key needed.
Prerequisites
- A Polygon-compatible wallet (MetaMask, Rabby, or a hardware wallet).
- USDC on Polygon in the wallet you will use for trading.
- Node.js 18+ or Python 3.10+ if you plan to call the CLOB SDK.
- A secure secrets store — environment variables, a vault, or a hosted secrets manager.
Step 1 — Generate Your CLOB Credentials
Sign in to the Polymarket app with your wallet, open the CLOB developer settings, and derive a key from your wallet signature. The response contains three fields:
apiKey— public identifier for this credential.apiSecret— HMAC secret used to sign every authenticated request.apiPassphrase— additional secret sent in the request headers.
All three are required together. Losing any one requires revoking and re-deriving. They are scoped to the CLOB — they cannot move funds out of your wallet.
Step 2 — Store the Credentials Safely
Put the three values in server-side environment variables, never in a browser bundle or a public repository. A typical .env looks like:
POLYMARKET_API_KEY=pk_live_... POLYMARKET_API_SECRET=... POLYMARKET_API_PASSPHRASE=... POLYMARKET_WALLET_ADDRESS=0x...
- Use a hosted secret store in production — never commit
.env. - Restrict the deploy target's IP if your host supports it.
- Rotate the key after any suspected leak — rotation does not affect your wallet.
Step 3 — Sign an Authenticated Request
Every authenticated CLOB call carries HMAC-signed headers derived from the secret + passphrase + method + path + timestamp. Use Polymarket's official SDK — signing manually is error-prone and every drift is a 401.
import { ClobClient } from "@polymarket/clob-client";
const client = new ClobClient(
"https://clob.polymarket.com",
137, // Polygon chain id
signer, // ethers.js wallet
{
key: process.env.POLYMARKET_API_KEY!,
secret: process.env.POLYMARKET_API_SECRET!,
passphrase: process.env.POLYMARKET_API_PASSPHRASE!,
},
);
const positions = await client.getPositions();Step 4 — Respect Rate Limits
- Public Gamma endpoints: a few requests per second per IP — cache heavily.
- Authenticated CLOB endpoints: higher, still bounded — batch where possible.
- For order-book updates, use websockets instead of polling.
- Backoff on 429 with exponential retry; log every non-2xx response.
Security Best Practices
- Never expose the secret or passphrase in the browser. Proxy every authenticated call through your backend.
- Separate hot and cold wallets. The wallet holding your API-active balance should hold only what you can afford to trade with.
- Log every order request. A signed audit trail makes incident response tractable.
- Set a hard order-size ceiling in code — belt-and-braces against a compromised key.
- Rotate credentials after any suspicious event and revoke unused keys.
Pair It with a Research Workflow
A key by itself doesn't produce edge. Most serious operators split the stack: read-only intelligence upstream to find signal, and their own signed CLOB client downstream to act on it. That's exactly how PolyMarketBot fits — as the research and verdict layer that never touches your key.
Compare Polymarket vs Kalshi vs PredictPlus with live spread, AI verdict and cross-venue arbitrage — updated every 30 seconds.
Polymarket API Key FAQ
Do I need an API key to read Polymarket data?+
How do I generate a Polymarket API key?+
Is a Polymarket API key the same as a private key?+
What are the Polymarket API rate limits?+
Do I need an API key to use PolyMarketBot?+
Continue Learning
New to event markets? What Are Prediction Markets. Deciding where to trade? Polymarket vs Kalshi. Or open the PolyMarketBot terminal.

