Api_Keys API Reference¶
Endpoints¶
Create Api Key¶
Synchronous API Call
kalshi_py.api.api_keys.create_api_key.sync(*, client: Union[AuthenticatedClient, Client], body: ModelUserCreateApiKeyRequest) -> Optional[ModelUserCreateApiKeyResponse]
¶
Create API Key
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:
Name | Type | Description | Default |
---|---|---|---|
body
|
ModelUserCreateApiKeyRequest
|
|
required |
Raises:
Type | Description |
---|---|
UnexpectedStatus
|
If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. |
TimeoutException
|
If the request takes longer than Client.timeout. |
Returns:
Type | Description |
---|---|
Optional[ModelUserCreateApiKeyResponse]
|
ModelUserCreateApiKeyResponse |
Source code in kalshi_py/api/api_keys/create_api_key.py
Asynchronous API Call
kalshi_py.api.api_keys.create_api_key.asyncio(*, client: Union[AuthenticatedClient, Client], body: ModelUserCreateApiKeyRequest) -> Optional[ModelUserCreateApiKeyResponse]
async
¶
Create API Key
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:
Name | Type | Description | Default |
---|---|---|---|
body
|
ModelUserCreateApiKeyRequest
|
|
required |
Raises:
Type | Description |
---|---|
UnexpectedStatus
|
If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. |
TimeoutException
|
If the request takes longer than Client.timeout. |
Returns:
Type | Description |
---|---|
Optional[ModelUserCreateApiKeyResponse]
|
ModelUserCreateApiKeyResponse |
Source code in kalshi_py/api/api_keys/create_api_key.py
Synchronous Detailed Response
kalshi_py.api.api_keys.create_api_key.sync_detailed(*, client: Union[AuthenticatedClient, Client], body: ModelUserCreateApiKeyRequest) -> Response[ModelUserCreateApiKeyResponse]
¶
Create API Key
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:
Name | Type | Description | Default |
---|---|---|---|
body
|
ModelUserCreateApiKeyRequest
|
|
required |
Raises:
Type | Description |
---|---|
UnexpectedStatus
|
If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. |
TimeoutException
|
If the request takes longer than Client.timeout. |
Returns:
Type | Description |
---|---|
Response[ModelUserCreateApiKeyResponse]
|
Response[ModelUserCreateApiKeyResponse] |
Source code in kalshi_py/api/api_keys/create_api_key.py
Asynchronous Detailed Response
kalshi_py.api.api_keys.create_api_key.asyncio_detailed(*, client: Union[AuthenticatedClient, Client], body: ModelUserCreateApiKeyRequest) -> Response[ModelUserCreateApiKeyResponse]
async
¶
Create API Key
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:
Name | Type | Description | Default |
---|---|---|---|
body
|
ModelUserCreateApiKeyRequest
|
|
required |
Raises:
Type | Description |
---|---|
UnexpectedStatus
|
If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. |
TimeoutException
|
If the request takes longer than Client.timeout. |
Returns:
Type | Description |
---|---|
Response[ModelUserCreateApiKeyResponse]
|
Response[ModelUserCreateApiKeyResponse] |
Source code in kalshi_py/api/api_keys/create_api_key.py
Delete Api Key¶
Synchronous Detailed Response
kalshi_py.api.api_keys.delete_api_key.sync_detailed(api_key: str, *, client: Union[AuthenticatedClient, Client]) -> Response[Any]
¶
Delete API Key
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:
Name | Type | Description | Default |
---|---|---|---|
api_key
|
str
|
API key ID to delete |
required |
Raises:
Type | Description |
---|---|
UnexpectedStatus
|
If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. |
TimeoutException
|
If the request takes longer than Client.timeout. |
Returns:
Type | Description |
---|---|
Response[Any]
|
Response[Any] |
Source code in kalshi_py/api/api_keys/delete_api_key.py
Asynchronous Detailed Response
kalshi_py.api.api_keys.delete_api_key.asyncio_detailed(api_key: str, *, client: Union[AuthenticatedClient, Client]) -> Response[Any]
async
¶
Delete API Key
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:
Name | Type | Description | Default |
---|---|---|---|
api_key
|
str
|
API key ID to delete |
required |
Raises:
Type | Description |
---|---|
UnexpectedStatus
|
If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. |
TimeoutException
|
If the request takes longer than Client.timeout. |
Returns:
Type | Description |
---|---|
Response[Any]
|
Response[Any] |
Source code in kalshi_py/api/api_keys/delete_api_key.py
Generate Api Key¶
Synchronous API Call
kalshi_py.api.api_keys.generate_api_key.sync(*, client: Union[AuthenticatedClient, Client], body: ModelUserGenerateApiKeyRequest) -> Optional[ModelUserGenerateApiKeyResponse]
¶
Generate API Key
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:
Name | Type | Description | Default |
---|---|---|---|
body
|
ModelUserGenerateApiKeyRequest
|
|
required |
Raises:
Type | Description |
---|---|
UnexpectedStatus
|
If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. |
TimeoutException
|
If the request takes longer than Client.timeout. |
Returns:
Type | Description |
---|---|
Optional[ModelUserGenerateApiKeyResponse]
|
ModelUserGenerateApiKeyResponse |
Source code in kalshi_py/api/api_keys/generate_api_key.py
Asynchronous API Call
kalshi_py.api.api_keys.generate_api_key.asyncio(*, client: Union[AuthenticatedClient, Client], body: ModelUserGenerateApiKeyRequest) -> Optional[ModelUserGenerateApiKeyResponse]
async
¶
Generate API Key
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:
Name | Type | Description | Default |
---|---|---|---|
body
|
ModelUserGenerateApiKeyRequest
|
|
required |
Raises:
Type | Description |
---|---|
UnexpectedStatus
|
If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. |
TimeoutException
|
If the request takes longer than Client.timeout. |
Returns:
Type | Description |
---|---|
Optional[ModelUserGenerateApiKeyResponse]
|
ModelUserGenerateApiKeyResponse |
Source code in kalshi_py/api/api_keys/generate_api_key.py
Synchronous Detailed Response
kalshi_py.api.api_keys.generate_api_key.sync_detailed(*, client: Union[AuthenticatedClient, Client], body: ModelUserGenerateApiKeyRequest) -> Response[ModelUserGenerateApiKeyResponse]
¶
Generate API Key
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:
Name | Type | Description | Default |
---|---|---|---|
body
|
ModelUserGenerateApiKeyRequest
|
|
required |
Raises:
Type | Description |
---|---|
UnexpectedStatus
|
If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. |
TimeoutException
|
If the request takes longer than Client.timeout. |
Returns:
Type | Description |
---|---|
Response[ModelUserGenerateApiKeyResponse]
|
Response[ModelUserGenerateApiKeyResponse] |
Source code in kalshi_py/api/api_keys/generate_api_key.py
Asynchronous Detailed Response
kalshi_py.api.api_keys.generate_api_key.asyncio_detailed(*, client: Union[AuthenticatedClient, Client], body: ModelUserGenerateApiKeyRequest) -> Response[ModelUserGenerateApiKeyResponse]
async
¶
Generate API Key
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:
Name | Type | Description | Default |
---|---|---|---|
body
|
ModelUserGenerateApiKeyRequest
|
|
required |
Raises:
Type | Description |
---|---|
UnexpectedStatus
|
If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. |
TimeoutException
|
If the request takes longer than Client.timeout. |
Returns:
Type | Description |
---|---|
Response[ModelUserGenerateApiKeyResponse]
|
Response[ModelUserGenerateApiKeyResponse] |
Source code in kalshi_py/api/api_keys/generate_api_key.py
Get Api Keys¶
Synchronous API Call
kalshi_py.api.api_keys.get_api_keys.sync(*, client: Union[AuthenticatedClient, Client]) -> Optional[ModelUserGetApiKeysResponse]
¶
Get API Keys
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.
Raises:
Type | Description |
---|---|
UnexpectedStatus
|
If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. |
TimeoutException
|
If the request takes longer than Client.timeout. |
Returns:
Type | Description |
---|---|
Optional[ModelUserGetApiKeysResponse]
|
ModelUserGetApiKeysResponse |
Source code in kalshi_py/api/api_keys/get_api_keys.py
Asynchronous API Call
kalshi_py.api.api_keys.get_api_keys.asyncio(*, client: Union[AuthenticatedClient, Client]) -> Optional[ModelUserGetApiKeysResponse]
async
¶
Get API Keys
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.
Raises:
Type | Description |
---|---|
UnexpectedStatus
|
If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. |
TimeoutException
|
If the request takes longer than Client.timeout. |
Returns:
Type | Description |
---|---|
Optional[ModelUserGetApiKeysResponse]
|
ModelUserGetApiKeysResponse |
Source code in kalshi_py/api/api_keys/get_api_keys.py
Synchronous Detailed Response
kalshi_py.api.api_keys.get_api_keys.sync_detailed(*, client: Union[AuthenticatedClient, Client]) -> Response[ModelUserGetApiKeysResponse]
¶
Get API Keys
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.
Raises:
Type | Description |
---|---|
UnexpectedStatus
|
If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. |
TimeoutException
|
If the request takes longer than Client.timeout. |
Returns:
Type | Description |
---|---|
Response[ModelUserGetApiKeysResponse]
|
Response[ModelUserGetApiKeysResponse] |
Source code in kalshi_py/api/api_keys/get_api_keys.py
Asynchronous Detailed Response
kalshi_py.api.api_keys.get_api_keys.asyncio_detailed(*, client: Union[AuthenticatedClient, Client]) -> Response[ModelUserGetApiKeysResponse]
async
¶
Get API Keys
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.
Raises:
Type | Description |
---|---|
UnexpectedStatus
|
If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. |
TimeoutException
|
If the request takes longer than Client.timeout. |
Returns:
Type | Description |
---|---|
Response[ModelUserGetApiKeysResponse]
|
Response[ModelUserGetApiKeysResponse] |