Skip to main content

Quick Start

1

Get an API Key

Sign up at polysimulator.com, then create an API key from your profile page or via the API.
# One-time bootstrap: create your first API key using your Supabase JWT.
# After this step, ALL subsequent requests use X-API-Key instead.
curl -X POST https://api.polysimulator.com/v1/keys/bootstrap \
  -H "Authorization: Bearer YOUR_SUPABASE_JWT" \
  -H "Content-Type: application/json" \
  -d '{"name": "my-first-bot"}'
The bootstrap endpoint is the only endpoint that uses Authorization: Bearer. All other PolySimulator API endpoints authenticate with the X-API-Key header.
Response (201 Created):
{
  "id": 1,
  "raw_key": "ps_live_kJ9mNx2pQrStUvWxYz01Ab3CdEfGhI4j...",
  "key_prefix": "ps_live_kJ9mNx2p",
  "name": "my-first-bot",
  "rate_limit_tier": "free",
  "permissions": ["read", "trade"],
  "created_at": "2026-03-04T12:00:00Z"
}
Save raw_key immediately — it is shown only once and cannot be retrieved again. Only the SHA-256 hash is stored server-side.
Error handling:
StatusMeaning
201Key created — save raw_key
400You already have key(s) — use POST /v1/keys with X-API-Key instead
401Invalid or expired Supabase JWT
2

Set Your Environment

export POLYSIM_API_KEY="ps_live_abc123..."
export POLYSIM_BASE_URL="https://api.polysimulator.com"
3

Check Connectivity

curl -H "X-API-Key: $POLYSIM_API_KEY" \
     $POLYSIM_BASE_URL/v1/health
Expected response:
{"status": "healthy", "timestamp": "2026-03-02T12:00:00Z"}
4

Fetch Hot Markets

curl -H "X-API-Key: $POLYSIM_API_KEY" \
     "$POLYSIM_BASE_URL/v1/markets?hot_only=true&limit=5"
This returns actively traded markets with live prices from Polymarket.
5

Place Your First Trade

curl -X POST $POLYSIM_BASE_URL/v1/orders \
  -H "X-API-Key: $POLYSIM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "market_id": "0xabc123...",
    "side": "BUY",
    "outcome": "Yes",
    "quantity": "10",
    "order_type": "market"
  }'
Response:
{
  "order_id": 42,
  "status": "FILLED",
  "side": "BUY",
  "outcome": "Yes",
  "price": "0.65",
  "quantity": "10",
  "notional": "6.50",
  "slippage_bps": 15,
  "account_balance": "993.50"
}
6

Check Your Portfolio

curl -H "X-API-Key: $POLYSIM_API_KEY" \
     $POLYSIM_BASE_URL/v1/account/portfolio
All numeric values are strings ("10", not 10). This prevents floating-point precision loss — critical for financial applications. See String Numerics for details.

What’s Next?