Prerequisites
- Python 3.9 or higher
- An Unkey account (free at unkey.com)
1. Install the SDK
2. Set up your Unkey credentials
- Create a keyspace in the Unkey Dashboard
- Create a root key at Settings → Root Keys
3. FastAPI Integration
Here’s how to protect your FastAPI endpoints using the v2 SDK:4. Flask Integration
For Flask applications using the v2 SDK:5. Django Integration
For Django, create a custom middleware using the v2 SDK:Creating and Managing Keys
Here’s how to create API keys programmatically using the v2 SDK:Error Handling
Always handle Unkey errors gracefully:What’s next?
Add rate limiting
Protect your endpoints from abuse
Python SDK Reference
Complete Python SDK documentation
Authorization
Add roles and permissions
Cookbook
More Python recipes and examples