Skip to main content
This guide shows you how to make authenticated requests to the Kalshi API in three simple steps. For the full production and demo endpoint list, see API Environments and Endpoints.

Step 1: Get Your API Keys

  1. Log in to your Kalshi account (demo or production)
  2. Navigate to Account & securityAPI Keys
  3. Click Create Key
  4. Save both:
    • Private Key: Downloaded as a .key file
    • API Key ID: Displayed on screen (looks like a952bcbe-ec3b-4b5b-b8f9-11dae589608c)
Your private key cannot be retrieved after this page is closed. Store it securely!

Step 2: Set Up Your Request

Every authenticated request to Kalshi requires three headers:

How to Create the Signature

The signature proves you own the private key. Here’s how it works:
  1. Create a message string: Concatenate timestamp + HTTP_METHOD + path
    • Example: 1703123456789GET/trade-api/v2/portfolio/balance
    • Important: Sign the full URL path from the API root, without query parameters. For https://external-api.demo.kalshi.co/trade-api/v2/portfolio/orders?limit=5, sign /trade-api/v2/portfolio/orders.
  2. Sign with your private key: Use RSA-PSS with SHA256
  3. Encode as base64: Convert the signature to base64 string
Here’s the signing process in Python:

Step 3: Get Your Balance

Now let’s make your first authenticated request to get your account balance:

Complete Working Example

Here’s the minimal code to get your balance:

Common Issues

Next Steps

Now you can make authenticated requests! Try these endpoints (relative to BASE_URL):
  • /portfolio/positions - Get your positions
  • /portfolio/orders - View your orders
  • /markets - Browse available markets
For more details, see the Complete Order Lifecycle guide or explore the API Reference.