This process is the same for the demo or production environment.
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. This action will generate a new API key in the RSA_PRIVATE_KEY format.Store Your API Key and Key ID:
After generating the key, you will be presented with: • Private Key: This is your secret key in RSA_PRIVATE_KEY 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.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 above signature is generated by signing a concatenation of the timestamp, the HTTP method and the path.
Sample code for generating the required headers is below. For end-to-end examples, see Quick Start: Authenticated Requests.