The Kalshi API lets you read market data and place orders on Kalshi with code instead of the app. This guide explains what the Kalshi API offers, how API keys and request signing work, and how to test safely in the demo environment before you trade real money.

Everything below comes from Kalshi's official developer documentation at the time of writing. Endpoints and limits can change, so check the Kalshi API documentation before you build anything that handles funds.

What the Kalshi API offers

Kalshi publishes two families of APIs. The Predictions APIs cover event-contract markets, the yes/no contracts most people know from the app. The Perps APIs cover perpetual futures, which are margin products. Both families are available over REST, WebSocket and FIX.

Each protocol fits a different job:

  • REST is for requests and responses: list markets, read an order book, place or cancel an order, check your balance.
  • WebSocket keeps a connection open and streams updates, such as price changes and fills. The Kalshi websocket feed is the usual choice for live dashboards and bots.
  • FIX is the standard protocol used by institutional trading systems.

Kalshi also publishes machine-readable specifications (OpenAPI for REST and AsyncAPI for WebSocket), which you can feed into code generators. If you are new to how markets are structured, read our guide on how Kalshi works and the glossary entry on the order book first.

Base URLs for the Kalshi API

According to Kalshi's endpoints page, the recommended production REST root is https://external-api.kalshi.com/trade-api/v2. The recommended production WebSocket root is wss://external-api-ws.kalshi.com/trade-api/ws/v2. Older hosts under api.elections.kalshi.com are still listed as supported.

Demo has its own hosts: https://external-api.demo.kalshi.co/trade-api/v2 for REST and wss://external-api-ws.demo.kalshi.co/trade-api/ws/v2 for WebSocket. Note the .co domain for demo.

How Kalshi API keys work

You need Kalshi API keys for anything tied to your account, such as orders and balances. Kalshi suggests starting with a public endpoint, such as GetMarkets, to check your setup before you add authentication.

To create a key, log in, open Profile Settings and find the API Keys section. Click "Create New API Key". Ed25519 is the default key type, and RSA is available if your client only supports RSA-PSS.

Save the private key straight away. Kalshi does not store it, and you cannot download it again after you close the page. The Key ID is shown next to it. You can also generate your own key pair locally and register only the public key.

Treat the private key like a password. Anyone who holds it can sign requests as you. Keep it out of source code repositories and shared folders.

Signing a request

Every authenticated request carries three headers:

  • KALSHI-ACCESS-KEY: your Key ID.
  • KALSHI-ACCESS-TIMESTAMP: the current time in milliseconds.
  • KALSHI-ACCESS-SIGNATURE: a base64-encoded signature.

To build the signature, take the request path without its query string. Join the timestamp, the HTTP method and that path into one string. Sign it with your private key, then base64-encode the result.

With Ed25519 you sign the string directly. With a 2048-bit RSA key the documentation specifies RSA-PSS with SHA-256. The signing method must match the key type you registered, or Kalshi will reject the request.

Test in the Kalshi demo environment first

The Kalshi demo environment is a separate copy of the exchange that uses mock funds. Its web app lives at demo.kalshi.co, and it has its own API hosts.

Credentials are not shared between demo and production. You create separate keys in each, which protects you from sending a test order to your real account by mistake. Build and debug your code in demo, then switch the base URL and keys only when it behaves as expected. Kalshi's demo environment page has the details.

Kalshi rate limits explained

Kalshi rate limits use a token budget. Each authenticated request spends tokens, and most requests cost 10. Predictions and Perps each have separate read and write buckets.

On the Basic tier, the documented budgets are 200 tokens per second for Predictions reads and 100 tokens per second for Predictions writes. That works out to roughly 20 reads and 10 writes per second for standard requests. The balance endpoint is limited to once per second. Going over a limit returns an HTTP 429 error, and Kalshi recommends retrying with exponential backoff.

Higher tiers exist. Advanced can be requested through an API endpoint. Tiers above that are earned from trading volume or assigned by Kalshi, and are reviewed daily. See the rate limits page for the current tier table.

Practical tips before you automate trading

Automation does not remove risk. A bug can send the wrong order size in milliseconds. A few habits help:

  • Start with read-only calls to learn the data model.
  • Cap order size and position size in your own code.
  • Log every request and response so you can audit what happened.
  • Handle 429 errors and timeouts without blindly resending orders.

Fees apply to API trades as they do in the app. Our guide to how Kalshi makes money and the glossary entry on maker and taker orders explain the basics. Prediction markets carry real risk of loss, and nothing here is a promise of profit.

Kalshi API: key takeaways

The Kalshi API gives you REST, WebSocket and FIX access to both prediction markets and perpetual futures. Authentication uses signed requests with Ed25519 or RSA keys. The demo environment uses mock funds and separate credentials, and Kalshi rate limits are based on token budgets that grow with your tier. Read the official documentation for each endpoint before you rely on it.