Skip to main content

API Key Management

The Limitly Python SDK provides comprehensive API key management capabilities for your application.

Creating API Keys

Create new API keys for your users:

Listing API Keys

Retrieve all API keys for the authenticated owner:

Getting API Key Details

Get detailed information about a specific API key:

Updating API Keys

Update API key properties:

Deleting API Keys

Delete API keys when they’re no longer needed:

Regenerating API Keys

Regenerate an existing API key to get a new key value:

API Key Usage

Get usage statistics for an API key:

API Key Requests History

Get detailed request history for an API key:

FastAPI Example

Here’s a complete example of API key management in a FastAPI application:

Flask Example

Here’s a complete example of API key management in a Flask application:

Error Handling

Handle API key management errors:

CLI Management

Use the CLI tool for API key management:

API Key Properties

The SDK supports the following API key properties:
  • id: Unique identifier for the API key
  • name: Human-readable name for the API key
  • status: Either ‘active’ or ‘inactive’
  • created_at: Timestamp when the API key was created
  • last_used_at: Timestamp of last usage (optional)
  • user_id: Associated user ID (optional)
  • plan_id: Associated plan ID (optional)
  • api_key: The actual API key value (only included in creation/regeneration)

Next Steps