Getting Started
The Predexon API requires an API key for all requests. Signing up is free at dashboard.predexon.com.
curl -H "x-api-key: YOUR_API_KEY" \
"https://api.predexon.com/v1/polymarket/markets?limit=10"
Rate Limits
| Tier | Rate | Quota | Price |
|---|
| Free | 1 req/sec | 100k/month | Free |
| Pro | 20 req/sec (40 burst) | Unlimited | Paid |
Upgrade to Pro for higher rate limits and unlimited requests.
Exceeding rate limits will result in 429 Too Many Requests responses. Implement exponential backoff in your applications.
Best Practices
Caching
Many endpoints return data that doesn’t change frequently. Implement caching to reduce API calls:
import requests
import time
BASE_URL = "https://api.predexon.com"
# Simple TTL cache
cache = {}
CACHE_TTL = 300 # 5 minutes
def get_market(condition_id: str, api_key: str) -> dict:
"""Fetch market with 5-minute cache."""
cache_key = f"market:{condition_id}"
now = time.time()
if cache_key in cache and cache[cache_key]["expires"] > now:
return cache[cache_key]["data"]
response = requests.get(
f"{BASE_URL}/v1/polymarket/markets",
params={"condition_id": condition_id},
headers={"x-api-key": api_key}
)
data = response.json()
cache[cache_key] = {"data": data, "expires": now + CACHE_TTL}
return data
Retry Logic
Implement retries with exponential backoff for transient errors:
import time
import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
session = requests.Session()
retries = Retry(
total=3,
backoff_factor=0.5,
status_forcelist=[500, 502, 503, 504]
)
session.mount("https://", HTTPAdapter(max_retries=retries))
Connection Pooling
Reuse connections for better performance:
BASE_URL = "https://api.predexon.com"
API_KEY = "your_api_key"
# Create a session once with auth header
session = requests.Session()
session.headers.update({"x-api-key": API_KEY})
# Use it for all requests
response = session.get(f"{BASE_URL}/v1/polymarket/markets")
CORS
The API supports CORS for browser-based applications:
const API_KEY = "your_api_key";
fetch("https://api.predexon.com/v1/polymarket/markets", {
headers: { "x-api-key": API_KEY }
})
.then(res => res.json())
.then(data => console.log(data));
Health Check
Use the health endpoint to verify API availability:
curl "https://api.predexon.com/health"
# Returns: {"status": "healthy"}