Kalshi offers a public API that lets you build trading bots, automate strategies, and integrate prediction market data into your own applications. Here's everything you need to get started.
API overview
The Kalshi API is a REST API that provides:
- Market data: Prices, order books, trade history, market metadata
- Trading: Place orders, cancel orders, check positions
- Account: Balances, portfolio, transaction history
You can use it for everything from simple price monitoring to fully automated trading systems.
Getting started
- Create a Kalshi account: You need a verified account to access the API.
- Generate API keys: Go to Settings → API in your Kalshi dashboard. Create a new API key pair.
- Store keys securely: You'll get an API key ID and a private key. Never share these or commit them to code.
- Read the docs: Kalshi's official API documentation is at
trading-api.readme.kalshi.com
Authentication
Kalshi uses API key authentication. You'll need to include your credentials in the request headers:
// Example headers
{
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
For trading endpoints, you'll need to sign requests with your private key. Kalshi provides SDKs and examples for this.
Key endpoints
Market data (public):
GET /markets— List all marketsGET /markets/{ticker}— Get specific market detailsGET /markets/{ticker}/orderbook— Get order bookGET /markets/{ticker}/trades— Get recent trades
Trading (authenticated):
POST /orders— Place a new orderDELETE /orders/{order_id}— Cancel an orderGET /orders— List your open ordersGET /positions— Get your current positions
Account (authenticated):
GET /balance— Check your balanceGET /fills— Get your trade history
Rate limits
Kalshi enforces rate limits to prevent abuse:
- Public endpoints: ~10 requests/second
- Authenticated endpoints: ~5 requests/second
- Order placement: Additional limits may apply
Exceeding limits returns a 429 error. Implement exponential backoff in your code.
Python example
A simple example to fetch market data:
import requests
BASE_URL = "https://trading-api.kalshi.com/trade-api/v2"
# Get all markets
response = requests.get(f"{BASE_URL}/markets")
markets = response.json()
for market in markets["markets"][:5]:
print(f"{market['ticker']}: {market['title']}")
For trading, you'll need to add authentication. Check Kalshi's Python SDK for signed request examples.
Common use cases
1. Market making: Provide liquidity by placing bid/ask orders. Profit from the spread.
2. Arbitrage: Monitor prices across Kalshi and Polymarket. Trade when prices diverge.
3. News-driven trading: Automatically detect news events and place trades before manual traders react.
4. Portfolio automation: Rebalance positions based on rules. Auto-exit at target prices.
5. Data collection: Build historical datasets for backtesting and research.
Tips for building bots
- Start with paper trading: Test your logic before risking real money.
- Handle errors gracefully: Networks fail. Orders get rejected. Plan for it.
- Log everything: You'll need audit trails to debug issues.
- Respect rate limits: Getting banned kills your bot.
- Monitor continuously: Bots need supervision. Set up alerts for anomalies.
Limitations
The Kalshi API is powerful but has constraints:
- No websockets (currently): You need to poll for updates. This adds latency.
- Rate limits: High-frequency strategies are limited.
- Market hours: Some markets have trading windows.
- Regulatory constraints: Automated trading must still follow Kalshi's terms.
Combine with Alphascope
The Kalshi API gives you execution. Alphascope gives you signal:
- News → Detect market-moving stories. Trigger trades via API when impact is high.
- Predictions → Monitor Kalshi vs Polymarket prices. Alert when arbitrage opportunities appear.
Build smarter bots by combining Kalshi's API with external data sources.
FAQ
Is the Kalshi API free?
Yes. API access is free for all verified Kalshi users. You only pay for trades (currently 0% fees).
Can I build a trading bot for Kalshi?
Yes. The API supports programmatic trading. Many users run automated strategies.
Does Kalshi have a Python SDK?
Kalshi provides code examples and community-built SDKs. Check their docs and GitHub for the latest.
What's the latency like?
REST API latency is typically 50–200ms. Without websockets, you're limited by polling frequency.
Can I use the API for high-frequency trading?
Rate limits make true HFT impractical. The API is better suited for medium-frequency or event-driven strategies.