API Documentation

Complete reference for the PredictAPI REST API. Access real-time Polymarket BTC prediction market data.

Base URL: https://api.predictapi.dev

Introduction

PredictAPI provides real-time and historical data from Polymarket's BTC UP/DOWN prediction markets. Data is updated every second and includes:

Authentication

All API requests require an API key passed in the X-API-Key header:

curl -H "X-API-Key: your_api_key_here" https://api.predictapi.dev/markets

Get your API key instantly at dashboard.

Rate Limits

Requests per Day

Free 100/day
Pro ($29/mo) 10,000/day
Enterprise ($99/mo) Unlimited

History Access

Free 24 hours
Pro 30 days
Enterprise 1 year

GET /markets

GET /markets

Returns current market data for all BTC prediction markets (1h, 15m, 4h).

Response

{
  "timestamp": "2026-01-25T15:30:00Z",
  "btc_price": 88542.50,
  "markets": {
    "1h": {
      "label": "11AM",
      "secs_remaining": 1854,
      "up": {
        "bid": 0.52,
        "ask": 0.53,
        "spread": 0.01,
        "volume": 2535.89
      },
      "down": {
        "bid": 0.47,
        "ask": 0.48,
        "spread": 0.01,
        "volume": 1312.00
      },
      "arbitrage": {
        "cost": 1.01,
        "viable": false
      }
    },
    "15m": { ... },
    "4h": { ... }
  }
}

GET /history

GET /history

Returns historical market snapshots.

Query Parameters

Parameter Type Description
hours integer Hours of history (1-8760, limited by plan)
market_type string Filter by market: "1h", "15m", "4h"
limit integer Max records to return (default: 1000)

Example

GET /history?hours=24&market_type=1h&limit=100

GET /arbitrage

GET /arbitrage

Returns historical arbitrage opportunities where UP ask + DOWN ask < 1.0.

Query Parameters

Parameter Type Description
hours integer Hours of history to search
min_profit float Minimum profit percentage

GET /arbitrage/current

GET /arbitrage/current

Check current arbitrage opportunities across all markets in real-time.

GET /stats

GET /stats

Returns database statistics including total snapshots and date ranges.

POST /auth/register

POST /auth/register

Register a new account and get an API key.

Request Body

{
  "email": "you@example.com"
}

Response

{
  "message": "Registration successful",
  "email": "you@example.com",
  "api_key": "abc123..."
}
Important: Save your API key immediately. It cannot be retrieved later.

GET /auth/me

GET /auth/me

Returns information about the authenticated user.

Python Example

import requests

API_KEY = "your_api_key_here"
BASE_URL = "https://api.predictapi.dev"

# Get current markets
response = requests.get(
    f"{BASE_URL}/markets",
    headers={"X-API-Key": API_KEY}
)

data = response.json()

# Access 1h market data
market_1h = data["markets"]["1h"]
print(f"BTC Price: ${data['btc_price']:,.2f}")
print(f"1H UP Bid: ${market_1h['up']['bid']}")
print(f"1H DOWN Bid: ${market_1h['down']['bid']}")

# Check for arbitrage
if market_1h["arbitrage"]["viable"]:
    print("ARBITRAGE OPPORTUNITY!")

JavaScript Example

const API_KEY = 'your_api_key_here';
const BASE_URL = 'https://api.predictapi.dev';

async function getMarkets() {
  const response = await fetch(`${BASE_URL}/markets`, {
    headers: { 'X-API-Key': API_KEY }
  });

  const data = await response.json();

  console.log('BTC Price:', data.btc_price);
  console.log('1H Market:', data.markets['1h']);

  return data;
}

getMarkets();

cURL Example

# Get current markets
curl -X GET "https://api.predictapi.dev/markets" \
  -H "X-API-Key: your_api_key_here"

# Get 24 hours of history
curl -X GET "https://api.predictapi.dev/history?hours=24" \
  -H "X-API-Key: your_api_key_here"

# Register new account
curl -X POST "https://api.predictapi.dev/auth/register" \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com"}'

Need help? Contact support@predictapi.dev