Get your API credentials from Kalshi
- 01Log in to app.kalshi.com
- 02Go to Account → API Access
- 03Click "Create API Key" - download the .pem file
- 04Paste the Key ID and .pem contents below
▸ How your private key is handled▾ How your private key is handled
- ·Stored only in server RAM - no database, no disk writes, no logs.
- ·Never transmitted beyond this server to any third party.
- ·Used for one purpose: signing Kalshi API requests with RSA-PSS.
- ·Erased on logout or server restart - we can't access it after either.
The relevant server-side code, verbatim:
# sessions.py - key lives in a plain dict, nothing else
class SessionStore:
def __init__(self):
self._sessions: dict[str, UserSession] = {}
# signing.py - the only thing done with your key
def auth_headers(private_key, key_id, method, path):
msg = (timestamp_ms + method + path).encode()
sig = private_key.sign(msg, PSS(...), SHA256())
return {"KALSHI-ACCESS-KEY": key_id,
"KALSHI-ACCESS-TIMESTAMP": timestamp_ms,
"KALSHI-ACCESS-SIGNATURE": base64(sig)}Full source: sessions.py · signing.py