Overview
The Noxus Client SDK uses API key-based authentication to securely connect to the Noxus AI platform. This guide covers everything you need to know about managing authentication in your applications.API Key Basics
API keys are unique identifiers that authenticate your application with the Noxus platform. Each key is tied to a specific workspace and has defined permissions.Workspace-Specific
Each API key belongs to a specific workspace
Permission-Based
Keys inherit permissions from your workspace role
Revocable
Keys can be revoked at any time from the dashboard
Trackable
Usage is tracked and can be monitored
Getting Your API Key
1
Access Workspace Settings
Log in to your Noxus account and navigate to your workspace
2
Open Organization Settings
Go to Settings → Organization → Workspaces
3
Select Your Workspace
Choose the workspace you want to create an API key for
4
Navigate to API Keys
Click on the API Keys tab
5
Create New Key
Click Create API Key and give it a descriptive name
6
Copy and Store
Copy the generated key immediately - it won’t be shown again
API keys are only displayed once during creation. Make sure to copy and store
them securely immediately.
Using API Keys
Direct Initialization
The most straightforward way to use an API key:Environment Variables (Recommended)
Store your API key in environment variables for better security:Using python-dotenv
For local development, use python-dotenv to load environment variables:Security Best Practices
Never Hardcode API Keys
Never Hardcode API Keys
❌ Don’t do this:✅ Do this instead:
Use Environment Variables
Use Environment Variables
Store API keys in environment variables or secure configuration systems:
Rotate Keys Regularly
Rotate Keys Regularly
Regularly rotate your API keys for better security:
- Create a new API key in the dashboard
- Update your environment variables
- Test your application with the new key
- Revoke the old key
Use Different Keys for Different Environments
Use Different Keys for Different Environments
Use separate API keys for development, staging, and production:
Monitor API Key Usage
Monitor API Key Usage
Regularly check your API key usage in the Noxus dashboard to detect any unusual activity.
Configuration Management
Using Configuration Classes
Create a configuration class to manage your settings:Using Pydantic Settings
For more advanced configuration management:Error Handling
Handle authentication errors gracefully:Testing Authentication
Mock Authentication for Tests
When writing tests, mock the authentication:Integration Tests with Test Keys
For integration tests, use dedicated test API keys:Troubleshooting
Invalid API Key
Invalid API Key
Error:
401 Unauthorized
Solutions:- Verify your API key is correct
- Check if the key has been revoked
- Ensure you’re using the right workspace key
Insufficient Permissions
Insufficient Permissions
Error:
403 Forbidden
Solutions:- Check your workspace role and permissions
- Contact your workspace admin
- Verify you’re accessing the correct workspace
Network Issues
Network Issues
Error: Connection timeouts or network errorsSolutions:
- Check your internet connection
- Verify the backend URL is correct
- Check if you’re behind a corporate firewall