Kalshi
Connect Kalshi for markets, trading, balances, and history
Kalshi is a regulated US prediction market exchange.
Capabilities
| Feature | Supported |
|---|---|
| Search markets | ✓ |
| Place / cancel orders | ✓ |
| Read balance | ✓ |
| Read positions | ✓ |
| Read history | ✓ |
Getting your Kalshi API key
- Log into kalshi.com
- Go to Settings → API
- Generate a key — you'll get an API Key ID (a UUID) and download an RSA private key (PEM file). Both
BEGIN RSA PRIVATE KEY(PKCS#1) andBEGIN PRIVATE KEY(PKCS#8) PEM files work.
Connecting
Kalshi's credential is a single string: your API Key ID, a colon, then the base64-encoded PEM block — <keyId>:<base64(PEM)>. Build the base64 part from your PEM file (e.g. base64 -i kalshi-key.pem), then connect a platform account:
curl -X POST "https://prediction-router-api.kalashshah47.workers.dev/v1/platform-accounts" \
-H "Authorization: Bearer pr_..." \
-H "Content-Type: application/json" \
-d '{
"platform": "kalshi",
"label": "Main account",
"credential": "your-key-id:LS0tLS1CRUdJTiBQUklWQVRF..."
}'Response:
{ "account": { "id": "8f3c1a2b-...", "platform": "kalshi", "label": "Main account" } }Connecting through the dashboard is easier — paste the Key ID and raw PEM into the form and it builds the credential for you.
Orders
outcomeId is yes or no, amount is the number of contracts, and price is the limit price for that outcome (strictly between 0 and 1). Orders rest good-till-cancelled. Market orders aren't supported. To cross the spread, set a marketable limit price.
Positions and history
Positions are valued at cost basis. currentValue is what you paid and unrealizedPnl is 0. History returns your fills.
Currency
Kalshi uses USD. Amounts in orders and balances are in US dollars.