Polymarket splits its API by job. Gamma describes what exists: events, markets, questions, outcomes and dates. The CLOB (central limit order book) describes what is trading: bids, asks, prices, and the orders you send. Most integrations start with Gamma to find a market, then switch to the CLOB with that market's token IDs.
What the Polymarket API is
Two public HTTP services, each with its own base URL. Both serve JSON. The official Polymarket docs are the reference for parameters, response fields and limits; this guide covers the parts you need first.
| Service | Base URL | Used for | Auth |
|---|---|---|---|
| Gamma API | gamma-api.polymarket.com | Events, markets, questions, outcomes, dates | None for reads |
| CLOB API, public | clob.polymarket.com | Order books, prices, midpoints | None for reads |
| CLOB API, trading | clob.polymarket.com | Placing and cancelling orders | Wallet signature plus API credentials |
The endpoints you will use first
Six endpoints cover discovery, pricing and order entry. Everything else in the docs builds on these.
| Endpoint | Service | What it gives you |
|---|---|---|
| GET /events | Gamma | Events, each grouping one or more markets |
| GET /markets | Gamma | Markets with question, identifiers, outcomes and prices |
| GET /book | CLOB | The order book for one outcome token |
| GET /price | CLOB | The best price for one token on one side |
| GET /midpoint | CLOB | The midpoint between best bid and best ask |
| POST /order | CLOB | Submits a signed order (authenticated) |
Query parameters and field names change over time. Check the official docs before you hard-code either.
Read example: fetch active markets
This request asks Gamma for five markets that are open for trading. No key, no wallet, no signup.
curl -s 'https://gamma-api.polymarket.com/markets?active=true&closed=false&limit=5'
Keep the limit small while you explore. The response is a JSON array, one object per market. Most integrations need only a handful of its fields:
| Field | What it holds | What you do with it |
|---|---|---|
| question | The market's question text | Display it and match it to your topic |
| conditionId | The market's condition identifier | Keep it as the stable ID for the market |
| clobTokenIds | Outcome token IDs, one per outcome, as a JSON-encoded string | Pass a token ID to /book, /price or /midpoint |
| outcomes, outcomePrices | Outcome labels and their last prices, as JSON-encoded strings | Read them in the same order as the token IDs |
| startDate, endDate | When the market opened and when it is scheduled to end | Filter by time left; store the time you fetched |
Two details trip up first integrations. The list fields arrive as strings, so parse them before indexing. And the Gamma price is a snapshot; for a current bid, ask or midpoint, call the CLOB with the token ID, for example GET /midpoint?token_id=.... Inspect your own response rather than copying an identifier from an old example: markets open and close daily.
Authentication for orders
Reads are public because market data is public: anyone can see a book or a price. An order moves funds, so the CLOB needs proof that the request comes from the wallet that holds them.
The official docs describe two layers. First, the wallet's private key signs a message that creates or derives a set of API credentials (a key, a secret and a passphrase). Second, each trading request carries headers signed with those credentials, and each order is itself signed by the wallet before it is sent to POST /order. The official client libraries handle both signatures; the docs list the current libraries and the signature types for different wallet setups.
- Reads: no key, no wallet, no credentials.
- Orders: a funded wallet, API credentials derived from it, and a signed order.
- Keys: keep the private key out of code, prompts and repositories. Load it from a secret store.
Access to trading also depends on Polymarket's terms and where you are. Our guide to whether Polymarket is legal covers the jurisdiction question.
Raw API vs NickAI Polymarket node
The raw API gives full control and full responsibility. NickAI wraps the same APIs in two workflow nodes, so the parts you would script become settings you can inspect.
| Task | Raw API | NickAI Polymarket nodes |
|---|---|---|
| Discovery | Call Gamma /events or /markets, page through results, parse the JSON-encoded fields | Polymarket Data node in Browse, Search or Lookup mode, with normalized markets and YES/NO token IDs |
| Price checks on a schedule | Your own cron job calls /price or /midpoint and stores each result | Snapshot, History or Depth mode on a built-in schedule |
| Order placement | Derive credentials, sign each order, send it, handle rejections | Polymarket Order node, signing through a Polymarket Wallet credential |
| Guardrails | The checks you write and maintain | Conditional and Function nodes before the order node; inactive drafts |
| Code required | Yes | No |
Use it without code
NickAI keeps reading and trading in separate nodes, so a monitor cannot place an order by accident.
The Polymarket Data node wraps both read APIs in six modes. Browse, Search and Lookup find markets through Gamma. Snapshot, History and Depth fetch live pricing, price history and order book depth through the CLOB. It needs no key and no wallet, and its output feeds an LLM, Function or Conditional node downstream.
The Polymarket Order node is the separate, authenticated action. It signs through a Polymarket Wallet credential; per the node docs, that agent key is limited to trading, so funds cannot leave the wallet without your signature. Orders are fill-or-kill market orders, and the node reports success only once the fill is confirmed.
You do not wire these by hand. Describe the job to Nick, for example: "Every morning, list the five most active politics markets with their midpoint, and email me a summary. No order node." Nick builds the workflow as a draft; inspect each node, run it once, then schedule it. The Polymarket integration page and the prediction market agent use case show more designs, and our Polymarket workflow walkthrough builds a read-only monitor step by step.
Comparing approaches first? See the prediction market automation tools roundup.
Try it for free now: getnick.ai