Skip to main content
supagamma®
API Reference

API Reference

Complete reference for the SupaGamma REST API. All endpoints require authentication via API key.

Data over the API

soon

Data isn't available over the API yet. Downloads are through the dashboard for now (Markets → Cart → Checkout → Downloads). The endpoints below are documented ahead of public API data access.

Base URL

https://api.supagamma.com/v1

Authentication

Include your API key in the X-API-Key header

X-API-Key: sg_your_key_here

API keys are created from your dashboard under the API Keys section. Keys use the format sg_ followed by 32 hex characters.

Rate Limits

All users

60 requests/min

Per API key

If you exceed the rate limit, you'll receive a 429 Too Many Requests response. Wait and retry after the limit resets.

Endpoints

GET/v1/markets
GET/v1/markets/{market_id}
POST/v1/markets/{market_id}/estimate
GET/v1/markets/{market_id}/stats
GET/v1/series
GET/v1/series/{series_id}
POST/v1/series/{series_id}/estimate
GET/v1/trades
GET/v1/trades/ohlcv
GET/v1/trades/recent
GET/v1/download/trades
GET/v1/download/ohlcv
GET/v1/download/orderbook
POST/v1/orders
GET/v1/orders
GET/v1/orders/estimate
GET/v1/user/me
GET/v1/user/keys
POST/v1/user/keys
DELETE/v1/user/keys/{key_id}
GET/v1/user/usage
GET/v1/user/downloads
GET/v1/billing/balance
POST/v1/billing/checkout
GET/v1/billing/transactions
GET/v1/billing/pricing

Response Format

Successful responses return JSON. List endpoints return arrays, detail endpoints return objects:

// GET /v1/markets — returns array
[
  {
    "id": "0x1234...",
    "event_id": "evt_...",
    "question": "Will BTC reach $100k by Dec 2025?",
    "description": "Market resolves YES if ...",
    "outcomes": ["Yes", "No"],
    "outcome_prices": [0.67, 0.33],
    "active": true,
    "closed": false,
    "resolved": false,
    "winning_outcome": null,
    "volume": 1542000,
    "volume_24h": 12500,
    "liquidity": 8900,
    "start_date": "2025-06-15T10:00:00Z",
    "end_date": "2025-12-31T23:59:59Z",
    "trade_count": 4231,
    "orderbook_count": 87412,
    "data_from": "2025-06-15T10:00:00Z",
    "data_to": "2026-05-11T12:00:00Z",
    "tags": ["crypto", "bitcoin"],
    "category": "crypto"
  }
]

// GET /v1/trades?market_id=...&limit=2 — returns array.
// market_id in trades rows is the outcome token id (YES or NO),
// not the same as the parent markets.id from /v1/markets.
[
  {
    "id": "trade_abc123",
    "market_id": "0xtoken_yes...",
    "timestamp": "2025-11-05T14:32:15Z",
    "block_number": 65123456,
    "transaction_hash": "0xfeed...",
    "outcome": 0,
    "side": "buy",
    "price": 0.67,
    "size": 1542.50,
    "usd_value": 1033.48,
    "maker": "0xabc...",
    "taker": "0xdef...",
    "fee": 0.0
  }
]

// POST /v1/markets/{market_id}/estimate — windowed cost preview
// Body: { "data_type": "trades", "start": null, "end": null }
{
  "market_id": "0x1234...",
  "data_type": "trades",
  "estimated_rows": 4231,
  "estimated_size_bytes": 973130,
  "estimated_size_mb": 0.9281,
  "rate_per_mb": 3.0,
  "estimated_cost_usd": 2.78,
  "in_range": true
}

Error Handling

Errors return appropriate HTTP status codes with a JSON body:

// 401 Unauthorized
{"detail": "Invalid API key"}

// 429 Too Many Requests
{"detail": "Rate limit exceeded"}

// 404 Not Found
{"detail": "Market not found"}

// 402 Payment Required
{"detail": "Insufficient credits"}

Pagination

List endpoints support pagination with limit and offset query parameters:

  • limit — Number of results to return (default: 50, max: 1000)
  • offset — Number of results to skip (default: 0)
GET /v1/trades?market_id=0x1234&limit=100&offset=200

Ready to start?

Create an account and get your API key in under 2 minutes.