5 min setup
Quickstart
Get up and running with the PolyTest API in under 5 minutes. Authenticate, fetch markets, and retrieve snapshots — with live examples you can try right here.
1Authenticate
2Fetch Markets
3Get Snapshots
Step 1
Authenticate
Start your 3-day free trial and generate an API key from your dashboard. All requests are authenticated via the X-API-Key header.
Your API Key
Get a keyYour key is only used for live requests from this browser and is never stored or sent to our servers.
Key rotation: We recommend rotating your API keys every 90 days.
# Copy your key from the dashboard
export POLYTEST_KEY="pt_live_your_key_here"
# Test it with a simple request
curl -H "X-API-Key: $POLYTEST_KEY" \
"https://api.polytest.io/api/health"Step 2
Fetch Markets
Query all available prediction markets. Filter by coin (BTC, ETH, SOL — with XRP, DOGE & BNB coming soon) and market timeframe. Returns paginated results sorted newest first.
import { polytest } from "@polytest/sdk"
const api = polytest()
const page = await api.markets({ market_type: "5m", coin: "btc", limit: 3 })
console.log(page.total)
for (const market of page.items) console.log(market.slug, market.winner)Step 3
Get Snapshots
Fetch historical price snapshots for any market. Each snapshot includes the asset price, up/down outcome probabilities, and optional orderbook depth. Snapshots are captured 8 times per second.
import { polytest } from "@polytest/sdk"
const api = polytest()
const markets = await api.markets({ market_type: "5m", coin: "btc", limit: 1 })
const page = await api.snapshots(markets.items[0].market_id, { limit: 5 })
for (const shot of page.items) {
console.log(shot.time, shot.price_up, shot.price_down)
}