Skip to content

Prediction Market Data API

GET/v1/predictiondata/markets/{market_id}/history

OHLC bars per outcome in micro-USD with volume (taker side, micro-USD) and trade counts. interval 1m covers the last 90 days, 1h and 1d the full history. Bars are immutable once closed; the resolution is a separate field so a backtest cannot see the outcome early. Refreshes every 60 seconds.

Price

$0.02/ call

Edge cache

30s

Uptime 24h

100.00%

p95

3.14s

The PredictionMarketDataAPI provides prediction market prices, implied probabilities, volumes, movers, resolutions, and history. Data is derived from public Polygon chain data (Polymarket exchange contracts). Payment options include per request in USDC over x402 or using an API key. The API offers a GET endpoint for retrieving price history as OHLC bars.

Parameters

NameInTypeDescription
market_id* path string
interval query string = 1h
from query string
to query string
limit query integer = 500

Code

curl
# 1. No key, no payment: the gateway answers 402 with the price
curl -i "https://api.realtimeapi.ai/v1/predictiondata/markets/top/history"

# 2. Pay: retry with a signed x402 payment (any x402 client builds this header)
curl "https://api.realtimeapi.ai/v1/predictiondata/markets/top/history" -H "PAYMENT-SIGNATURE: $X402_PAYMENT"
TypeScript · @x402/fetch
// npm i @x402/fetch @x402/core @x402/evm viem
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = x402Client.fromConfig({ schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(privateKeyToAccount(PRIVATE_KEY)) }] });
const pay = wrapFetchWithPayment(fetch, client);
const data = await (await pay("https://api.realtimeapi.ai/v1/predictiondata/markets/top/history")).json();
console.log(data);
Python · x402
# pip install x402 eth-account requests
from eth_account import Account
from x402.clients.requests import x402_requests

session = x402_requests(Account.from_key(PRIVATE_KEY))
print(session.get("https://api.realtimeapi.ai/v1/predictiondata/markets/top/history").json())
With an API key
curl "https://api.realtimeapi.ai/v1/predictiondata/markets/top/history" -H "X-API-Key: $RTAPI_KEY"

Frequently asked questions

What data does the API provide?

Prediction market prices, implied probabilities, volumes, movers, resolutions, and history.

How is the data derived?

From public Polygon chain data (Polymarket exchange contracts).

What are the payment options?

Per request in USDC over x402 or using an API key.

What is the price of the API?

$0.020

Get a free key

1,000 calls a month across every feed. Who is setting it up?

No key needed at all: agents can pay per call in USDC with x402.