api-keys

Generate API Key

Changed on

Endpoint for generating a new API key with an automatically created key pair. This endpoint generates a key pair of the requested key_type (RSA when omitted). The public key is stored on the platform, while the private key is returned to the user and must be stored securely. The private key cannot be retrieved again.

post/api_keys/generate

Request

  • Base URL
    https://external-api.kalshi.com/trade-api/v2
  • URL
    https://external-api.kalshi.com/trade-api/v2/api_keys/generate
  • Auth
    API key in header KALSHI-ACCESS-KEY and API key in header KALSHI-ACCESS-SIGNATURE and API key in header KALSHI-ACCESS-TIMESTAMP

Request body

namestring required

Name for the API key. This helps identify the key's purpose

key_type'rsa' | 'ed25519'

Signature algorithm of an API key pair. rsa - 2048-bit RSA; requests are signed with RSA-PSS SHA-256. ed25519 - Ed25519 (RFC 8032) signatures over the same pre-sign text, with lower client-side signing cost. Defaults to rsa when omitted from a generate request, for compatibility with existing clients.

scopesApiKeyScope[]

List of scopes to grant to the API key. If the broad write parent scope is included, read must also be included. Child scopes may be granted without the broad parent scope. Defaults to full access (read, write) if not provided.

subaccountinteger

If set, restricts the API key to a single sub-account (0-63) that you own. A restricted key may only read and trade on that sub-account; it cannot act on other sub-accounts, transfer funds between sub-accounts, or create sub-accounts. Omit to leave the key unrestricted. Mutually exclusive with fcm_subtrader_id.

fcm_subtrader_idstring

FCM members only. If set, binds the API key to a single FCM subtrader that you own, spelled {your_user_id}_{suffix} with a suffix of 1-16 case-sensitive ASCII alphanumeric characters. The subtrader must already exist. A bound key is the institution's trading credential for that subtrader - FIX order-entry and market-data sessions, plus margin WebSocket sessions scoped to the subtrader's own data - and is denied on every REST endpoint, including key management. Mutually exclusive with subaccount.

Response

API key generated successfully

api_key_idstring required

Unique identifier for the newly generated API key

key_type'rsa' | 'ed25519'

Signature algorithm of an API key pair. rsa - 2048-bit RSA; requests are signed with RSA-PSS SHA-256. ed25519 - Ed25519 (RFC 8032) signatures over the same pre-sign text, with lower client-side signing cost. Defaults to rsa when omitted from a generate request, for compatibility with existing clients.

private_keystring required

Private key in PEM format - PKCS#1 (-----BEGIN RSA PRIVATE KEY-----) for rsa, PKCS#8 (-----BEGIN PRIVATE KEY-----) for ed25519. This must be stored securely and cannot be retrieved again after this response

warningstring nullable

Present only when the minted key is bound to an FCM subtrader that is missing a per-subtrader risk control - the initial-margin cap (margin lane) or the event-contract daily cap. The mint still succeeds; the warning names each missing control - an event-contract subtrader without a daily cap has its event-contract orders rejected until one is set, while a margin subtrader without an initial-margin cap is bounded only by firm-level risk limits.

Changes

    • info

      added the new optional request property

    • info

      added the optional property to the response with the status

    • info

      added the new write::fcm_risk enum value to the request property /