Skip to main content

Welcome to the Tremor API

The Tremor API provides programmatic access to prediction market data from Polymarket and Kalshi. Query historical snapshots, track market movements, and build custom analytics with our REST API.

Get Your API Key

Generate an API key from your Tremor dashboard

Base URL

All API requests should be made to:
https://tremor.sh/api

Authentication

All API endpoints require authentication using Bearer tokens. Include your API key in the Authorization header:
curl -X POST https://tremor.sh/api/query \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "SELECT * FROM polymarket_events LIMIT 10"}'
Keep your API key secure! Never commit it to version control or share it publicly.

Available Endpoints

Queries

  • POST /api/query - Execute SQL queries against Tremor data
  • POST /api/query/validate - Validate SQL syntax without execution
  • GET /api/query/{query_id}/stats - Get execution statistics for a saved query
  • GET /api/queries/stats - List analytics for all saved queries

Metadata & Schema

  • GET /api/tables - List all available tables and namespaces
  • GET /api/table/{namespace}/{table} - Get schema for a specific table
  • GET /api/table/{namespace}/{table}/sample - Retrieve sample rows from a table
  • GET /api/table/{namespace}/{table}/stats - Get column-level statistics

Search & AI

  • POST /api/markets/semantic-search - Find markets using natural language
  • POST /api/assistant/generate/stream - Generate SQL from natural language (SSE streaming)

Sync Monitoring

  • GET /api/sync/status - Current sync status and recent runs
  • GET /api/sync/history - Historical sync execution logs
  • GET /api/sync/metrics - Aggregated sync performance metrics

API Key Management

  • POST /api/keys/create - Create a new API key
  • GET /api/keys/list - List your API keys
  • DELETE /api/keys/{key_id} - Revoke an API key

Rate Limits

  • Query endpoints: 30 requests per minute
  • Metadata endpoints: 60 requests per minute
  • Sync monitoring: 60 requests per minute
  • API key management: 30 requests per minute
  • AI Assistant: 20 requests per minute
If you receive a 429 Too Many Requests response, pause briefly before retrying.

Response Format

All API responses are returned in JSON format:
{
  "success": true,
  "result": {
    "columns": ["title", "yes_probability", "volume_24hr"],
    "data": [
      ["Election Market A", 0.63, 152345.77],
      ["Election Market B", 0.58, 101234.11]
    ],
    "row_count": 2,
    "execution_time_ms": 146
  },
  "query": "SELECT title, yes_probability, volume_24hr FROM polymarket_events LIMIT 2"
}

Error Handling

API errors return standard HTTP status codes with descriptive error messages:
400
Bad Request
Invalid query syntax or parameters
401
Unauthorized
Missing or invalid API key
500
Internal Server Error
Server error - please retry or contact support

Quick Example

Here’s a complete example of querying the top 10 markets by volume:
import requests

response = requests.post(
    "https://tremor.sh/api/query",
    headers={
        "Authorization": f"Bearer {API_KEY}",
        "Content-Type": "application/json"
    },
    json={
        "query": """
            SELECT title, yes_probability, volume_24hr
            FROM polymarket_events
            WHERE active = true
            ORDER BY volume_24hr DESC
            LIMIT 10
        """
    }
)

data = response.json()
for title, yes_probability, volume_24hr in data['result']['data']:
    print(f"{title}: ${volume_24hr:,.2f} (yes={yes_probability:.0%})")

Available Data

polymarket_events

Decentralized prediction market data with probabilities, volume, and liquidity

kalshi_events

CFTC-regulated prediction market data with settlement information
Each dataset also exposes a _latest view (for example polymarket.events_latest) that surfaces the most recent snapshot per market, plus the internal.sync_run_history table for operational metadata.

Need Help?

Next Steps