API Documentation

Base URL: https://api.predmktdata.com

Quick start

Get data flowing in 3 steps:

  1. Sign in at predmktdata.com with Google and pick a plan. You get your API key instantly.
  2. Test your key:
curl -H "x-api-key: YOUR_KEY" https://api.predmktdata.com/status
  1. Download data — list available Parquet dumps and start downloading:
# List available files
curl -H "x-api-key: YOUR_KEY" https://api.predmktdata.com/dumps

# Download a Parquet file
curl -L -H "x-api-key: YOUR_KEY" -o fills.parquet \
  https://api.predmktdata.com/dumps/order_filled_events/20260405.parquet

# Or query remotely with DuckDB (no download needed)
# Get the presigned URL, then: SELECT * FROM read_parquet('URL')

That's it. You have Polymarket data. For full sync patterns, see Sync patterns below.

How Polymarket works

Polymarket is a prediction market where people bet on real-world outcomes. Every market is a yes/no question (e.g. "Will Bitcoin hit $100k by July 2026?"). Each side has a token that trades between $0 and $1 — if the event happens, "Yes" tokens pay out $1; otherwise, they're worth $0.

All trading happens on the Polygon blockchain — a public, permanent ledger where every transaction is recorded and verifiable. A wallet is a user's identity on the blockchain, represented by an address like 0xed86.... Every trade, deposit, and withdrawal is tied to a wallet address.

When a user buys an outcome, they receive outcome tokens — ERC-1155 tokens on Polygon, each identified by a large numeric token_id. On its own, a token_id is just a number — the included markets lookup table maps each one to its human-readable question and outcome (e.g. token 123... → "Will Bitcoin hit $100k?" / "Yes"). A user's position is their current holding of a specific outcome token: how many they hold, what they paid on average, and their realized profit/loss from any tokens they've already sold or redeemed.

What this API provides

predmktdata reads every relevant transaction from Polygon and delivers it as Parquet dumps and CSV API responses. You get two types of data:

You don't need to understand Solidity, ABIs, or how to talk to a blockchain node. The API handles all of that and gives you clean, structured data you can load into any database or spreadsheet.

Authentication

All endpoints require an API key via the x-api-key header. Get your key by signing in with Google at predmktdata.com.

curl -H "x-api-key: YOUR_API_KEY" https://api.predmktdata.com/status

Endpoints

GET /status LITE PRO

Current indexer state and table row counts. Returns JSON.

{
  "last_block": 84570000,
  "head_block": 84570000,
  "tables": {
    "order_filled_events": 854000000,
    "order_filled_events_v2": 1500000,
    "positions": 150000000,
    "payout_redemptions": 93000000, ...
  }
}
GET /events PRO

Fetch events as CSV. One table per request. Supports gzip and zstd compression.

ParamDefaultDescription
after_blockrequiredReturn events after this block number
limit5000Max blocks to include (1 - 5,000)
tablesrequiredSingle table name

Block metadata is returned in response headers:

  • x-after-block — your requested after_block
  • x-last-block — last block in this chunk (use as next after_block)
  • x-head-block — current chain head
  • x-reorg — present if you're ahead of the indexer (rollback to this block)
# Fetch fills for 500 blocks
curl --compressed -H "x-api-key: YOUR_KEY" \
  "https://api.predmktdata.com/events?after_block=84420000&limit=500&tables=order_filled_events"

# Response: CSV with header row
transaction_hash,log_index,block_number,exchange,maker,taker,...
0x7fe2...,210,84420001,ctf,0xed86...,0x9ce4...,...

Available tables: order_filled_events, order_filled_events_v2, position_splits, position_merges, payout_redemptions, position_conversions, combinatorial_redemptions, positions. Dumps additionally include the markets and parlay_legs lookups, UMA resolution snapshots, and order book depth.

v1 vs v2 fills: Polymarket deployed new exchange contracts in April 2026. order_filled_events covers the legacy CTF and NegRisk exchanges (active since Aug 2022). order_filled_events_v2 covers the new CTF v2 (0xE111…996B) and NegRisk v2 (0xe222…0F59) exchanges and has a different schema: a unified token_id, side as integer (0=buy, 1=sell), plus order_hash, builder, and metadata. Both tables continue to receive new fills — query each independently to capture all activity. See the schema sections below for full column details.
The /events API covers the last ~2 days of blocks. For older data, use the Parquet dumps from /dumps.
GET /user/{address}/positions PRO

All current positions for a wallet address. Returns CSV. Includes unrealized_pnl and total_pnl columns computed from live market prices (updated every minute).

GET /user/{address}/fills PRO

All fills where address is maker or taker, across both v1 (order_filled_events) and v2 (order_filled_events_v2) exchange contracts. v2 fills are normalized to the v1 column shape (maker_asset_id/taker_asset_id, side as buy/sell) so a single client can consume both. The exchange column (ctf/neg_risk/ctf_v2/neg_risk_v2/ctf_v3_v2) tells you which contract emitted the fill. Returns CSV.

ParamDefaultDescription
after_block0Only fills after this block
limit50000Max rows (up to 500,000)
GET /user/{address}/pnl PRO

Current PnL summary for a wallet. Realized from closed trades, unrealized mark-to-market on open positions using live prices (updated every minute). All values in USD. Returns JSON.

{
  "realized_pnl": -52.34,
  "unrealized_pnl": 184.21,
  "total_pnl": 131.87,
  "portfolio_value": 1250.00,
  "total_volume": 8340.50,
  "active_positions": 12,
  "markets_traded": 47
}
WS /ws/feed PRO

Real-time WebSocket feed of fills and position changes. Subscribe by wallet address or amount/price thresholds. Data pushes to you the moment the indexer commits — no polling needed.

Connect:

wscat -c "wss://api.predmktdata.com/ws/feed?x_api_key=YOUR_KEY"

Subscribe messages (send as JSON after connecting):

# Watch a specific wallet's fills and position changes
{"action": "subscribe", "type": "user", "address": "0xabc..."}

# Watch large fills (raw units, divide by 1e6 for USDC)
{"action": "subscribe", "type": "threshold", "min_fill_amount": 10000000000}

# Watch positions with low avg_price (cheap bets)
{"action": "subscribe", "type": "threshold", "max_avg_price": 50000}

# Unsubscribe
{"action": "unsubscribe", "type": "user", "address": "0xabc..."}

# Keepalive
{"action": "ping"}

Messages you receive:

{
  "fills": [{"transaction_hash": "0x...", "maker": "0x...", ...}],
  "positions": [{"user_address": "0x...", "amount": 5000000, ...}]
}

Limits: 100 total connections, 5 per API key, 20 user subscriptions per connection. Values are raw i64 (same as REST API — divide by 1e6).

WS /ws/stream PRO

Firehose WebSocket for keeping your own database in sync. Catches up from a recent block, then streams all new events and positions as the indexer commits them. No subscriptions needed — you get everything.

ParamDefaultDescription
x_api_keyrequiredAPI key (query string)
start_blockrequiredBlock to start from (max ~900 blocks / 30 min behind head)
tablesallComma-separated tables to stream (optional filter)

Connect:

wscat -c "wss://api.predmktdata.com/ws/stream?x_api_key=YOUR_KEY&start_block=84650000"

# Or stream only specific tables:
wscat -c "wss://api.predmktdata.com/ws/stream?x_api_key=YOUR_KEY&start_block=84650000&tables=order_filled_events,positions"

Messages you receive:

# Catchup batches (sent rapidly until caught up)
{"type": "batch", "from_block": 84650000, "to_block": 84650100,
 "order_filled_events": [{...}], "positions": [{...}], ...}

# Catchup complete signal
{"type": "caught_up", "block": 84651400}

# Live batches (every few seconds as indexer commits)
{"type": "batch", "from_block": 84651400, "to_block": 84651410, ...}

Limits: 10 concurrent stream connections (shared pool: 100 total, 5 per key). Slow consumers are disconnected (code 4008) — reconnect with a newer start_block.

GET /dumps LITE PRO

List available Parquet dump files. Returns JSON with file paths and sizes.

GET /dumps/{path} LITE PRO

Download a dump file (.parquet). Returns 302 redirect to a time-limited URL (60 min). Parquet files support remote querying with DuckDB via HTTP range requests.

Available tables

TableRowsParquetType
order_filled_events~1.2B~37 GBAppend-only (v1 exchanges, Nov 2022 → Apr 28, 2026)
order_filled_events_v2~440M~24 GBAppend-only (v2/v3 exchanges, Apr 2026+, growing)
payout_redemptions~222M~6.8 GBAppend-only
position_splits~118M~5 GBAppend-only
position_merges~24M~1 GBAppend-only
position_conversions~3.4M~150 MBAppend-only
combinatorial_redemptions~370K~20 MBAppend-only (parlays, Jun 2026+)
positions~318M~8.6 GBMutable (UPSERT)
markets~1.7M~220 MBLookup (overwritten daily)
parlay_legsgrowingsmallLookup (overwritten daily) — parlay → leg markets
perps_* (7 streams)growingdaily filesOff-chain perps capture (dumps only) — see Perps

Sizes are approximate and grow over time. With Parquet, you can query remotely with DuckDB without downloading — only the columns and rows you need are transferred.

Schema

order_filled_events (v1 — legacy CTF + NegRisk, Nov 2022 → Apr 28, 2026)

ColumnTypeNotes
timestamptimestampBlock timestamp
transaction_hashtext
block_numberbigint
makertextMaker wallet address
takertextTaker wallet address
maker_asset_idtextUsually "0" (USDC side)
taker_asset_idtextOutcome token ID
maker_amount_filledbigintRaw units (divide by 1e6 for USDC)
taker_amount_filledbigintRaw units (divide by 1e6)
feebigintRaw units
sidetextbuy or sell

The /events API returns additional columns: log_index, exchange. The timestamp column is named block_timestamp in API responses.

order_filled_events_v2 (CTF v2 + NegRisk v2 + Exchange v3 parlays, since April 28, 2026)

ColumnTypeNotes
timestamptimestampBlock timestamp
transaction_hashtext
block_numberbigint
exchangetextctf_v2, neg_risk_v2, or ctf_v3_v2 (v3 = parlay fills — token_id is a combinatorial position id, joins with combinatorial_redemptions.position_id, not with markets)
order_hashtextOrder identifier emitted by the contract
makertextMaker wallet address
takertextTaker wallet address
sideinteger0 = buy, 1 = sell (int, not text — different from v1)
token_idtextOutcome token ID (unified — replaces maker_asset_id/taker_asset_id)
maker_amount_filledbigintRaw units (divide by 1e6 for USDC)
taker_amount_filledbigintRaw units (divide by 1e6)
feebigintRaw units
buildertextAddress that built the order (often 0x0…0)
metadatatextOrder-level metadata emitted by the contract

Cash-flow semantics match v1: for side=0 (buy), maker pays maker_amount_filled USDC and receives taker_amount_filled outcome tokens. For side=1 (sell), maker delivers tokens and receives USDC. The v1 flow ended on-chain at the cutover (last v1 fill Apr 28, 2026 ~11:00 UTC) — all new fills land here. Union both tables for full history.

Computing volume: each row is one on-chain OrderFilled log, not one unique trade — a match emits one log per maker order plus a taker-side roll-up that restates the same volume, so summing every row double-counts. To count each match once, drop rows where lower(taker) is an exchange contract: 0x4bfb…982e, 0xc5d5…f80a (v1), 0xe111…996b, 0xe222…0f59 (v2), 0xe333…00aa (v3). Full lowercase addresses and worked SQL are in llms.txt. Note Polymarket's published per-market volume counts both sides of every match (≈2× the single-counted metric).

Row identity: the unique key for an event is (transaction_hash, log_index) at the source, but the fills dumps omit log_index (and v1 dumps also omit order_hash). As a result, distinct on-chain fills can appear as byte-identical rows — about 1% of v1 rows, e.g. one order matched in several equal legs in the same transaction. These are real, separate fills: never DISTINCT or deduplicate the fills dumps. If you need a strict per-row key, use /events, which includes log_index.

combinatorial_redemptions (parlays — multi-leg bets, since June 2026)

ColumnTypeNotes
timestamptimestampBlock timestamp
transaction_hashtext
block_numberbigint
recipienttextWallet that owned the parlay — the real winner, even for relayer-assisted auto-redemptions
position_idtextParlay outcome token ID — the same ID that appears as token_id in order_filled_events_v2, so parlay entries (trades) and cash-outs join on it
amountbigintParlay tokens burned (raw, divide by 1e6)
payoutbigintUSDC received (raw, divide by 1e6). payout / amount = settlement price

A parlay combines several markets into one position that pays out only if every leg wins. This table records the cash-outs; opening a parlay is a regular trade on the new exchange and appears in order_filled_events_v2 with the same position_id as token_id. Voided legs pay 0.5, so fractional settlement prices (0.5, 0.25, 0.75…) are legitimate.

parlay_legs (lookup: parlay → underlying markets, overwritten daily · dumps only)

ColumnTypeNotes
parlay_condition_idtextThe parlay's condition id
position_id_yestextParlay YES token — joins order_filled_events_v2.token_id and combinatorial_redemptions.position_id
position_id_notextParlay NO token (same joins)
n_legsintegerNumber of legs in the parlay
leg_indexinteger0-based leg position
leg_position_idtextRaw leg position id (audit)
leg_moduletextbinary or neg_risk
leg_condition_idtextThe leg's market — joins markets.condition_id for question/outcomes. Empty for markets not yet in the lookup (self-heals daily)
leg_outcometextyes or no — which side of the market this parlay needs to win

One row per leg. Lets you name every parlay with plain SQL: join a v3 fill's token_id against position_id_yes/position_id_no, then each leg_condition_id against the markets table. See llms.txt for a worked query.

positions

ColumnTypeNotes
user_addresstextWallet address
token_idtextOutcome token ID
amountbigintCurrent position size (raw)
avg_pricebigintAverage entry price (divide by 1e6)
realized_pnlbigintRealized PnL (raw units)
total_boughtbigintTotal tokens bought (raw)
last_blockbigintLast block this position was updated

The /events API and /user endpoints add block_timestamp. The /user/*/positions endpoint also adds unrealized_pnl and total_pnl (computed from live market prices).

markets

Lookup table that maps token IDs to human-readable market info. Join with event or position tables on yes_token_id / no_token_id to see which question and outcome a trade or position belongs to. Overwritten daily.

ColumnTypeNotes
condition_idtextUnique identifier for the market condition
questiontextThe market question (e.g. "Will Bitcoin hit $100k?")
outcome_yestextLabel for the Yes side (e.g. "Yes", "Bitcoin")
outcome_notextLabel for the No side (e.g. "No", "Ethereum")
yes_token_idtextToken ID for the "Yes" outcome
no_token_idtextToken ID for the "No" outcome
market_slugtextURL slug on polymarket.com
end_date_isotextMarket end date (ISO 8601)
neg_riskbooleanUses NegRisk exchange (multi-outcome markets)
To look up which market a trade belongs to, join the event's token_id (or taker_asset_id for fills) against yes_token_id or no_token_id in the markets table. Parlay fills (exchange='ctf_v3_v2') will not match this join — their token is a combinatorial position id, not a market token; treat them as their own category in per-market breakdowns. A parlay position_id with its last byte zeroed identifies the parlay condition (last byte: 0 = YES, 1 = NO of the same parlay).

resolution_proposals (UMA Oracle)

Who proposed the outcome of each market. Indexed from UMA OptimisticOracleV2, filtered to Polymarket adapters only. Full snapshot updated daily in uma/ folder.

ColumnTypeNotes
transaction_hashtextOn-chain transaction
block_numberbigintPolygon block number
requestertextAdapter contract address (V1/V2/V3)
proposertextAddress that proposed the outcome
proposed_pricetext1e18 = Yes, 0 = No, 0.5e18 = Unknown
ancillary_datatextQuestion text (human-readable)
request_timestampbigintUMA request timestamp (unix)
expiration_timestampbigintChallenge window end (unix)

resolution_disputes (UMA Oracle)

When someone challenges a proposed outcome. ~2% of proposals are disputed.

ColumnTypeNotes
transaction_hashtextOn-chain transaction
block_numberbigintPolygon block number
disputertextAddress that disputed
proposertextOriginal proposer being disputed
proposed_pricetextThe price being challenged
ancillary_datatextQuestion text

resolution_settlements (UMA Oracle)

Final resolved outcome and bond payouts.

ColumnTypeNotes
transaction_hashtextOn-chain transaction
block_numberbigintPolygon block number
proposertextOriginal proposer
disputertextDisputer (0x0 if undisputed)
settled_pricetextFinal outcome (1e18=Yes, 0=No)
payouttextBond payout to winner
ancillary_datatextQuestion text

polymarket_orderbook (L2 depth)

Level-2 order book snapshots for every Polymarket outcome token, sourced from pmxt (CC BY 4.0) and consolidated into 6-hour windows. Each row is an order-book event with best bid/ask and full depth; we enrich it with the market question, slug, and Yes/No outcome. Order book dumps are Parquet, served from the orderbook/ folder (path: orderbook/polymarket_orderbook_YYYYMMDD_HH.parquet), with windows starting at hour 00, 06, 12, 18 UTC. History starts April 2026.

ColumnTypeNotes
timestamptimestamptzOrder book event time
timestamp_receivedtimestamptzWhen pmxt captured the snapshot
markettextMarket condition_id
asset_idtextOutcome token ID (join to markets)
event_typetextbook / price_change / tick_size_change
bidstextFull bid side — JSON array of [price, size] levels
askstextFull ask side — JSON array of [price, size] levels
best_biddecimalHighest bid price (0–1)
best_askdecimalLowest ask price (0–1)
pricedecimalPrice of the changed level (price_change events)
sizedecimalSize at the changed level
sidetextbuy / sell (for price_change events)
fee_rate_bpssmallintMaker/taker fee in basis points
old_tick_size / new_tick_sizedecimalTick size before/after a tick_size_change
transaction_hashtextOn-chain tx (when applicable)
questiontextMarket question (enriched)
slugtextMarket slug (enriched)
outcometextYES / NO for this asset_id (enriched)
spreaddecimalbest_ask − best_bid (enriched)
middouble(best_bid + best_ask) / 2 (enriched)

Perps (off-chain perpetual futures)

Polymarket Perps is a separate product from everything above: leveraged perpetual futures on equity indices, commodities, and crypto, traded on an off-chain central limit order book. Matching happens off-chain, so an individual trade produces no on-chain record — every trade's hash is an empty "0x". Unlike the on-chain tables, there is no ledger to reconstruct this from later, so we capture it live from the exchange's public WebSocket firehose, plus a one-time REST backfill for history predating capture start. Live capture began 2026-07-09 ~12:31 UTC. Either you record this feed as it arrives or the data is gone — there is no way to fetch a missed trade back from a blockchain.

Dumps only. Perps is not available via /events, /ws/feed, or /ws/stream. Layout: perps_<stream>/YYYYMMDD.parquet, one file per stream per UTC day (the day boundary is the UTC day of the row's capture time). Listed by GET /dumps and downloaded like any other dump.

Instruments are keyed by an integer iid: 1=SP500-USD, 2=GOLD-USD, 3=WTIOIL-USD, 4=NAS100-USD, 5=SILVER-USD, 6=BTC-USD, 7=ETH-USD, 8=SOL-USD, 9=SPCX-USD, 10=HYPE-USD. The list can grow — new instruments appear with a new iid automatically.

Common columns (every stream except perps_funding):

ColumnTypeNotes
timestamp_receivedtimestamptzCapture time (UTC) — also the file's day bucket
tstimestamptzExchange message timestamp (UTC)
sqbigintServer-global sequence — ordering metadata only, not a per-channel loss detector
iidintegerInstrument ID (see above)

Each stream then adds its own columns. All numeric fields (prices, quantities, rates, volumes) are delivered as strings to preserve raw precision — cast in your query.

StreamCadenceColumns beyond the common four (type)
perps_tradesevent-driventid (bigint), side (varchar: long/short), price (varchar), quantity (varchar), hash (varchar: always 0x)
perps_book~10 Hz snapshotbids (varchar JSON), asks (varchar JSON) — [["price","qty"], ...]
perps_bboevent-drivenbp, bq, ap, aq (varchar) — best bid/ask price & quantity
perps_tickers~10 Hz snapshotidx, mark, last, mid, oi, fr (varchar); nxf (timestamptz). fr is the live funding rate, not the settled one
perps_statistics~1 Hz snapshotvol (varchar), open (varchar), klines (varchar JSON passthrough — use perps_klines for canonical candles)
perps_klines1-minuteinterval (varchar, always 1m), candle_ts (timestamptz), open, high, low, close, volume (varchar), trades (bigint)
perps_fundinghourly (REST)own shape: iid (integer), funding_rate (varchar), ts (timestamptz, settlement time), fetched_at (timestamptz). No timestamp_received/sq

Conventions a quant needs

Download with the same /dumps flow as any other file — e.g. GET /dumps/perps_trades/20260709.parquet. Full stream-by-stream detail and worked recipes are in llms.txt.

Error responses

All errors return JSON with a detail field:

StatusMeaningExample
401Missing or invalid API key{"detail": "Unauthorized"}
403Plan doesn't include this endpoint{"detail": "Pro plan required"}
400Bad request{"detail": "Specify exactly one table per request."}
422Missing required parameter{"detail": [{"type": "missing", ...}]}
429Rate limit exceeded{"detail": "Rate limit exceeded"}

Sync patterns

Want your own complete, always-updated Polymarket database?

We wrote a step-by-step guide: create the schema, backfill the full history from dumps, and keep it synced in real time. Read the full guide ↗

Lite: dumps only

  1. GET /dumps to list available Parquet dump files
  2. Download daily event files in parallel
  3. Download the rolling positions snapshot (positions/positions_current.parquet) and markets lookup
  4. Query directly with DuckDB, or INSERT into your database (UPSERT for positions)
  5. Run daily: download new daily event files + re-download positions_current.parquet (overwritten daily)
Event tables are append-only — use INSERT. Positions are mutable — always use UPSERT (INSERT ... ON CONFLICT (user_address, token_id) DO UPDATE).

Positions snapshot model: a single rolling file positions/positions_current.parquet that always represents the current state of every position. We update it daily (incremental merge Mon–Sat, full regen Sunday). The URL is stable — point your job at it and re-download once a day.

Pro: dumps + near real-time API

  1. Do the Lite setup above for fast backfill
  2. Find MAX(last_block) from the positions dump — this is your sync cursor
  3. Use GET /events to sync the remaining gap to chain head
  4. Continue polling every few seconds for near real-time updates
The positions dump is not atomic — rows may have different last_block values. Use MAX(last_block) as your sync cursor. The API will send updates for any positions that changed in the gap, and your UPSERT will reconcile them.

Compression

The API supports two compression algorithms via Accept-Encoding header:

Units and scaling

Coverage

Plans

FeatureLite ($49/mo)Pro ($149/mo)
Full history of trades (since 2022)
Daily position snapshot (05:00 UTC)
Markets lookup table
UMA resolution data (proposals, disputes, settlements)
Order book L2 depth (Polymarket, pmxt)
Perps — off-chain perpetual futures (7 streams)
UpdatesEnd-of-dayReal-time (<1s)
Real-time API (/events)
Per-wallet queries (/user/*, /user/*/pnl)
WebSocket real-time feed (/ws/feed)
Firehose stream (/ws/stream)
Rate limit (API)Dumps only5 req/s
Dump downloads/day20,00030,000

Free samples (pending users)

If you've signed up but haven't subscribed yet, you can preview the data shape before paying. Samples live under samples/ and are exposed by GET /dumps like any other dump file. Cap: 50 downloads/day.

All samples are CSV.gz (paid plans get Parquet for the full history) and cover one busy day — 2025-01-20, US inauguration day — plus a 10k slice of open positions and the markets lookup. Schema matches the paid dumps.

FileSizeContents
samples/order_filled_events_sample.csv.gz~38 MBAll trades on 2025-01-20
samples/payout_redemptions_sample.csv.gz~2.7 MBRedemptions on 2025-01-20
samples/position_merges_sample.csv.gz~448 KBMerges on 2025-01-20
samples/markets_sample.csv.gz~281 KBMarkets lookup snapshot
samples/position_conversions_sample.csv.gz~88 KBNegRisk conversions on 2025-01-20
samples/positions_sample.csv.gz~812 KBRandom slice of 10k open positions
samples/position_splits_sample.csv.gz~59 KBSplits on 2025-01-20

Example:

curl -H "x-api-key: $KEY" -L \
  https://api.predmktdata.com/dumps/samples/order_filled_events_sample.csv.gz \
  -o trades.csv.gz