Skip to main content
All URIs are relative to https://api.elections.kalshi.com/trade-api/v2
MethodHTTP requestDescription
createApiKeyPOST /api_keysCreate API Key
deleteApiKeyDELETE /api_keys/Delete API Key
generateApiKeyPOST /api_keys/generateGenerate API Key
getApiKeysGET /api_keysGet API Keys

createApiKey

CreateApiKeyResponse createApiKey(createApiKeyRequest)
Endpoint for creating a new API key with a user-provided public key. This endpoint allows users with Premier or Market Maker API usage levels to create API keys by providing their own RSA public key. The platform will use this public key to verify signatures on API requests.

Parameters

NameTypeDescriptionNotes
createApiKeyRequestCreateApiKeyRequest

Return type

CreateApiKeyResponse

Authorization

kalshiAccessSignature, kalshiAccessKey, kalshiAccessTimestamp

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
201API key created successfully-
400Bad request - invalid input-
401Unauthorized-
403Forbidden - insufficient API usage level-
500Internal server error-

deleteApiKey

deleteApiKey()
Endpoint for deleting an existing API key. This endpoint permanently deletes an API key. Once deleted, the key can no longer be used for authentication. This action cannot be undone.

Parameters

NameTypeDescriptionNotes
apiKey[string]API key ID to deletedefaults to undefined

Return type

void (empty response body)

Authorization

kalshiAccessSignature, kalshiAccessKey, kalshiAccessTimestamp

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

HTTP response details

Status codeDescriptionResponse headers
204API key successfully deleted-
400Bad request - invalid API key ID-
401Unauthorized-
404API key not found-
500Internal server error-

generateApiKey

GenerateApiKeyResponse generateApiKey(generateApiKeyRequest)
Endpoint for generating a new API key with an automatically created key pair. This endpoint generates both a public and private RSA key pair. 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.

Parameters

NameTypeDescriptionNotes
generateApiKeyRequestGenerateApiKeyRequest

Return type

GenerateApiKeyResponse

Authorization

kalshiAccessSignature, kalshiAccessKey, kalshiAccessTimestamp

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
201API key generated successfully-
400Bad request - invalid input-
401Unauthorized-
500Internal server error-

getApiKeys

GetApiKeysResponse getApiKeys()
Endpoint for retrieving all API keys associated with the authenticated user. API keys allow programmatic access to the platform without requiring username/password authentication. Each key has a unique identifier and name.

Parameters

This endpoint does not have any parameters.

Return type

GetApiKeysResponse

Authorization

kalshiAccessSignature, kalshiAccessKey, kalshiAccessTimestamp

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200List of API keys retrieved successfully-
401Unauthorized-
500Internal server error-