Skip to main content
This process is the same for the demo or production environment.

Key types

Kalshi API keys are asymmetric key pairs: you sign each request with the private key, and Kalshi verifies the signature with the registered public key. Two key types are supported: Headers, pre-sign text, permissions and errors are identical for both types. Kalshi selects the verification algorithm from the registered public key; sign with the algorithm that matches your key. The PEM header does not identify the key type: PKCS#8 RSA keys, including openssl genpkey output, also begin with -----BEGIN PRIVATE KEY-----. Determine the type from the parsed key, as the samples below do.

Generating an API Key

Access the Account Settings Page:

Log in to your account and navigate to the “Account Settings” page. You can typically find this option by clicking on your profile picture or account icon in the top-right corner of the application.

Generate a New API Key

In the “Profile Settings” page https://kalshi.com/account/profile, locate the “API Keys” section. Click on the “Create New API Key” button to generate a key pair. Ed25519 is selected by default; choose RSA if your client supports only RSA-PSS. You can also register your own public key (below) or use POST /trade-api/v2/api_keys/generate with key_type. To register your own public key of either type, in PEM format:
Paste the contents of kalshi.pub into the public key field. The private key never leaves your system.

Store Your API Key and Key ID:

After generating the key, you will be presented with: • Private Key: your secret key in PEM format. • Key ID: This is a unique identifier associated with your private key. Important: For security reasons, the private key will not be stored by our service, and you will not be able to retrieve it again once this page is closed. Please make sure to securely copy and save the private key immediately. The key will also be downloaded as txt file with the name provided. Keys can also be created through the API: POST /trade-api/v2/api_keys registers your public key; POST /trade-api/v2/api_keys/generate returns a new key pair of the requested key_type (rsa when omitted).

Using a API Key

Each request to Kalshi trading api will need to be signed with the private key generated above. The following header values will need to be provided with each request: KALSHI-ACCESS-KEY- the Key ID KALSHI-ACCESS-TIMESTAMP - the request timestamp in ms KALSHI-ACCESS-SIGNATURE- request hash signed with private key The signature is the base64 encoding of the signed concatenation of the timestamp, the HTTP method and the path. Ed25519 keys sign the string directly; RSA keys use RSA-PSS with SHA-256 (MGF1 with SHA-256, salt length equal to the digest length).
Important: When signing requests, use the path without query parameters. For example, if your request is to /trade-api/v2/portfolio/orders?limit=5, sign only /trade-api/v2/portfolio/orders (strip the ? and everything after it).
The samples below detect the key type and sign accordingly. For end-to-end examples, see Quick Start: Authenticated Requests. The official Python and TypeScript SDKs accept either key type from version 3.31.0.

Python

Load the private key stored in a file
Sign text with private key
Send a request to Kalshi API with signed header

Javascript

Load the private key stored in a file
Sign text with private key
Send a request to Kalshi API with signed header