Kalshi Demo API (2026): Keys, URL and Endpoints

The Short Answer
Kalshi's demo API runs at https://external-api.demo.kalshi.co/trade-api/v2, with WebSocket streams at wss://external-api-ws.demo.kalshi.co/trade-api/ws/v2. It mirrors the production API with mock funds, so the same code works once you swap the base URL and keys. Demo credentials are separate: create an account at demo.kalshi.co and generate an API key there, because production keys do not work against demo and demo keys do not work in production. Kalshi warns that demo prices and market behavior may not reflect real markets.
Key Takeaways
- The recommended demo REST root is
external-api.demo.kalshi.co, anddemo-api.kalshi.cois also supported. - Demo and production never share credentials, so a production key on demo fails with a 401.
- Demo keys are created exactly like production keys, in the demo site's profile settings.
- Public demo endpoints, such as exchange status and markets, answer without a key.
- Demo uses mock funds and its own liquidity, so fills there say little about real Kalshi books.
What are the Kalshi demo API URLs?
| Surface | Recommended demo URL | Also supported |
|---|---|---|
| REST Trade API | https://external-api.demo.kalshi.co/trade-api/v2 | https://demo-api.kalshi.co/trade-api/v2 |
| WebSocket | wss://external-api-ws.demo.kalshi.co/trade-api/ws/v2 | wss://demo-api.kalshi.co/trade-api/ws/v2 |
| Perps REST | https://external-api.demo.kalshi.co/trade-api/v2/margin/ | None listed |
| Perps WebSocket | wss://external-api-margin-ws.demo.kalshi.co/trade-api/ws/v2/margin | None listed |
The production equivalents are https://external-api.kalshi.com/trade-api/v2 and wss://external-api-ws.kalshi.com/trade-api/ws/v2, with api.elections.kalshi.com still supported. Every production URL is listed in the Kalshi API guide.
Public endpoints answer without a key, which makes a quick check easy:
curl -s "https://external-api.demo.kalshi.co/trade-api/v2/exchange/status"
curl -s "https://external-api.demo.kalshi.co/trade-api/v2/markets?limit=5&status=open"
The first call returns whether the demo exchange and trading are active, and the second returns five open demo markets. Portfolio endpoints, such as balance, return 401 with token_authentication_failure until you sign the request with a demo key.
How do you get a Kalshi demo API key?
Kalshi's documentation says the process is the same for demo and production. It just happens on the demo site:
- Create a demo account at
demo.kalshi.co. It is a separate account from your real one, funded with mock money. - Open your profile settings and find the API Keys section.
- Create a new API key. Kalshi generates the key pair and shows you the private key and a Key ID once, and downloads the private key as a file.
- Store the private key safely. Kalshi does not keep it and cannot show it again.
Kalshi now creates Ed25519 keys by default, with RSA still available. Its SDKs support Ed25519 from version 3.31.0, so if you are on an older SDK, choose RSA when you create the key. You can also register your own public key instead of having Kalshi generate one.
How do you sign demo requests?
Exactly as in production. Each authenticated request carries three headers:
| Header | Value |
|---|---|
KALSHI-ACCESS-KEY | Your demo Key ID |
KALSHI-ACCESS-TIMESTAMP | The request time in milliseconds |
KALSHI-ACCESS-SIGNATURE | A base64 signature of the timestamp, HTTP method and path |
Sign the full path from the API root, such as /trade-api/v2/portfolio/orders, without the hostname or the query string. The host never changes the signed text, so code that works on demo works in production once the keys and base URL change. The SDKs build the signature for you:
from kalshi_python_sync import Configuration, KalshiClient
config = Configuration(host="https://external-api.demo.kalshi.co/trade-api/v2")
config.api_key_id = "YOUR_DEMO_API_KEY_ID"
with open("kalshi-demo-private-key.pem") as f:
config.private_key_pem = f.read()
client = KalshiClient(config)
markets = client.get_markets(limit=5, status="open")
balance = client.get_balance()
Switching to production means changing the host to https://external-api.kalshi.com/trade-api/v2 and loading your production key, nothing else. Keep the two sets of credentials in separate environment variables so a script never sends demo keys to production by accident. Choosing the right package is covered in the Kalshi SDK guide.
Why does my Kalshi demo request fail?
401 token_authentication_failure: the key belongs to the other environment, the timestamp is not in milliseconds, or the signature covered the hostname or query string.- The ticker does not exist: demo has its own markets, so a production ticker may not be listed. Look tickers up on demo first.
- Orders fill oddly or not at all: demo liquidity is not production liquidity, and Kalshi says demo prices may not reflect real markets.
- The key type is rejected: an older SDK cannot sign with an Ed25519 key. Upgrade to 3.31.0 or create an RSA key.
Demo API or paper trading on real books?
The demo API is the right place to prove your integration: authentication, order flow, cancels and WebSocket handling. It is the wrong place to judge a strategy, because the order books are not Kalshi's real ones. For that, practice against live liquidity. Predictefy's paper trading fills simulated orders against Kalshi's real order book at 0 credits, as compared in detail in Kalshi paper trading: demo account vs real order books, and the Predictefy API uses the same calls when you move to live orders across 15+ venues.
Frequently Asked Questions
What is the Kalshi demo API URL?
The recommended demo REST root is https://external-api.demo.kalshi.co/trade-api/v2, with https://demo-api.kalshi.co/trade-api/v2 also supported. The demo WebSocket is wss://external-api-ws.demo.kalshi.co/trade-api/ws/v2.
How do I get a Kalshi demo API key?
Create an account at demo.kalshi.co, open your profile settings, and create a key in the API Keys section, exactly as you would in production. Save the private key immediately, because Kalshi shows it only once.
Do Kalshi production API keys work on the demo?
No. Kalshi does not share credentials between environments, so demo keys only work against demo endpoints and production keys only work against production. A key used in the wrong environment fails authentication.
Is money in the Kalshi demo real?
No. The demo environment uses mock funds, so nothing you win or lose there is real. Kalshi also warns that demo prices and market behavior may not reflect real markets.
Does the Kalshi demo have a WebSocket?
Yes. Connect to wss://external-api-ws.demo.kalshi.co/trade-api/ws/v2, or the also-supported wss://demo-api.kalshi.co/trade-api/ws/v2, and authenticate with your demo key the same way as in production.
Why are Kalshi demo prices different from Kalshi?
The demo runs its own markets with its own traders and mock funds, so its order books are not Kalshi's real ones. Use it to test your code, and test strategies against live books instead.