Kalshi's API lets you read every market, order book and trade without an account, and place orders programmatically once you create an API key. It is a REST API with WebSocket streaming and a FIX gateway for larger traders, and it has a separate demo environment where you can test with fake money.
This guide covers what you need to get started: the base URLs, the free market data endpoints, how Kalshi's tickers fit together, how to create a key and sign requests, how to read the order book, and how the token-based rate limits work. For a comparison with other venues' APIs, see our roundup of the best prediction market APIs.
| Item | Details |
|---|---|
| REST base URL | https://external-api.kalshi.com/trade-api/v2 |
| Older host, still supported | https://api.elections.kalshi.com/trade-api/v2 |
| Demo REST URL | https://external-api.demo.kalshi.co/trade-api/v2 |
| WebSocket | wss://external-api-ws.kalshi.com/trade-api/ws/v2 |
| Authentication | API key ID plus a request signature (RSA-PSS or Ed25519) |
| Public data | Series, events, markets and order books, no key needed |
| Rate limits | Token buckets; most requests cost 10 tokens |
Production, Demo and the "Elections" Host
Kalshi runs two environments with separate accounts and keys. Production keys only work against production hosts, and demo keys only against demo hosts. Kalshi now recommends the external-api hosts for API traders. The older api.elections.kalshi.com host still works; despite the name, it serves every Kalshi market, not just elections.
Start in demo. Orders there use play money but go through the same API, so you can test order placement, cancellation and error handling before risking real funds.
Series, Events and Markets
Kalshi organizes contracts in three levels, and the API follows them:
- A series is a recurring question, such as
KXHIGHNYfor the daily high temperature in New York orKXFEDDECISIONfor Fed rate decisions. - An event is one instance of it, such as
KXFEDDECISION-26OCTfor the October 2026 Fed meeting. - A market is one tradable contract within the event, such as a specific outcome of that meeting, with its own ticker, order book and rules.
You can list the markets in a series with GET /markets?series_ticker=KXHIGHNY&status=open, fetch an event with GET /events/{event_ticker}, and read a single market with GET /markets/{ticker}. Market objects include each contract's settlement rules in rules_primary and rules_secondary, which are worth storing with any data you collect. Results are paginated with a cursor.
Reading Market Data for Free
The market data endpoints need no key. A minimal Python example:
import requests
BASE = "https://external-api.kalshi.com/trade-api/v2"
markets = requests.get(
f"{BASE}/markets",
params={"series_ticker": "KXFEDDECISION", "status": "open"},
timeout=10,
).json()["markets"]
for m in markets:
print(m["ticker"], m["title"], m.get("yes_bid_dollars"), m.get("yes_ask_dollars"))
Prices come back as dollar strings such as "0.4200", and quantities as fixed-point strings, because Kalshi supports sub-penny prices and fractional contracts in some markets. Parse them as decimals, not floats, if you are doing accounting.
The Order Book Only Shows Bids
GET /markets/{ticker}/orderbook returns two lists: bids for Yes (yes_dollars) and bids for No (no_dollars), each as [price, quantity] pairs. There is no ask side, because in a binary market a bid for No is an offer to sell Yes. A No bid at 30 cents is the same as a Yes ask at 70 cents. To build a conventional book, convert each No bid to a Yes ask at one dollar minus its price. Our guide to prediction market liquidity and spreads explains how to read depth.
Creating a Key and Signing Requests
To trade or read your own account, create a key in the Kalshi web app under Account and security, then API Keys. You get an API key ID and a private key file. Kalshi cannot show the private key again, so store it securely.
Every authenticated request carries three headers:
| Header | Value |
|---|---|
KALSHI-ACCESS-KEY | Your API key ID |
KALSHI-ACCESS-TIMESTAMP | The current time in milliseconds |
KALSHI-ACCESS-SIGNATURE | A base64 signature of timestamp + HTTP method + path |
The signed path starts at the API root and excludes the host and any query string, so a request to /trade-api/v2/portfolio/orders?limit=5 signs /trade-api/v2/portfolio/orders. RSA keys sign with RSA-PSS over SHA-256; Ed25519 keys sign the message directly. A sketch in Python with the cryptography library:
import base64, time
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import padding
def signed_headers(private_key, key_id, method, path):
ts = str(int(time.time() * 1000))
message = f"{ts}{method}{path.split('?')[0]}".encode()
signature = private_key.sign(
message,
padding.PSS(mgf=padding.MGF1(hashes.SHA256()), salt_length=padding.PSS.DIGEST_LENGTH),
hashes.SHA256(),
)
return {
"KALSHI-ACCESS-KEY": key_id,
"KALSHI-ACCESS-TIMESTAMP": ts,
"KALSHI-ACCESS-SIGNATURE": base64.b64encode(signature).decode(),
}
Most signature errors come from signing the wrong path, including the query string, or a clock that has drifted. Keep your server's time synced.
Rate Limits
Kalshi meters authenticated requests with token buckets. Each request costs tokens, 10 by default, and your tier sets how fast your bucket refills. There are separate buckets for reads and writes, so heavy polling does not block order placement, and GET /account/endpoint_costs lists the endpoints that cost more or less than the default.
- Tiers. Basic comes with signup, Advanced is available on request through the API, and higher tiers are earned through trading volume or assigned by Kalshi.
- Bursts. Lower tiers' read buckets hold three seconds of budget, so an idle client can burst to three times its per-second rate.
- Batches don't save tokens. Creating 25 orders in a batch costs the same as 25 single orders.
- Balance checks have their own small bucket, so react to fills over the WebSocket rather than polling your balance.
- When you hit the limit, you get HTTP 429 with no retry header and no penalty. Back off briefly and retry.
Streaming With WebSockets
For anything time-sensitive, use the WebSocket API instead of polling. It streams order book updates, trades and ticker changes for public channels, and your own fills and order updates for private ones. WebSocket connections are authenticated with the same key and signature scheme. Larger firms can also connect over FIX and, at higher tiers, through private network links.
Building Responsibly
An API makes it easy to scale mistakes. Start in demo, cap position sizes in code, handle partial fills and cancellations, and log every order you send. Fees apply to API orders the same way they do in the app; our Kalshi fees guide explains the formula, and makers pay nothing on most markets. If you plan to quote both sides of a market, read our guide to prediction market market making, and for automated strategies in general, the AI trading bots on prediction markets.
Frequently Asked Questions
Is the Kalshi API free?
Yes. Market data endpoints are free and need no key. Trading through the API is also free to access; you pay the same trading fees as in the app.
What is the Kalshi API base URL?
Kalshi recommends https://external-api.kalshi.com/trade-api/v2 for production and https://external-api.demo.kalshi.co/trade-api/v2 for demo. The older https://api.elections.kalshi.com/trade-api/v2 host still works and covers all markets.
How do I get a Kalshi API key?
Log in to Kalshi, open Account and security, then API Keys, and create a key. Save the private key file immediately; Kalshi can't show it again.
Why does the Kalshi order book have no asks?
In a binary market, a bid for No at a price is an offer to sell Yes at one dollar minus that price. The API returns Yes bids and No bids, and you derive the asks from them.
What are Kalshi's API rate limits?
Requests cost tokens, usually 10 each, drawn from read and write buckets that refill at a rate set by your tier. Exceeding the budget returns HTTP 429 until the bucket refills.
Does Kalshi have a sandbox?
Yes. The demo environment at demo.kalshi.co has its own accounts, keys and API hosts and uses play money.


