Authentication
Maniac uses API keys for authentication. This guide covers how to obtain, configure, and manage your API keys securely.
Getting Your API Key
1. Sign Up for Maniac
Visit maniac.ai and create an account:
Click "Sign Up"
Currently, we support sign ins with GitHub and Google.
2. Create an API Key
In the Maniac dashboard:
Create a new organization and project.
Navigate to Project → Settings → API Keys
Click "Create a Key"
Give your key a descriptive name (e.g., "Production API", "Development")
Click "Submit," and copy your key.
⚠️ Important: API keys are scoped per user and project.
Configuring Authentication
Method 1: Environment Variables (Recommended)
Set your API key as an environment variable:
Linux/macOS:
Windows:
Python Code:
Method 2: Configuration File
Create a configuration file at ~/.maniac/config.yaml:
Python Code:
Method 3: Direct in Code
⚠️ Security Warning: Never hardcode API keys in production code or commit them to version control.
Security Best Practices
1. Environment-Specific Keys
Use different API keys for different environments:
2. Key Rotation
Regularly rotate your API keys:
Generate a new API key
Update your environment variables/config
Test the new key
Delete the old key
3. Least Privilege Access
Create keys with minimal required permissions:
4. Monitoring Usage
Monitor your API key usage in the dashboard:
Track request volumes
Monitor error rates
Set up usage alerts
Review access patterns
Managing Multiple Keys
Team Environments
For team development, consider:
Troubleshooting Authentication
Common Error Messages
Invalid API Key
Solution: Check that your API key is correct and hasn't been revoked.
Permission Denied
Solution: Check your key's permissions in the dashboard.
Rate Limit Exceeded
Solution: Implement rate limiting in your code or upgrade your plan.
Debugging Authentication Issues
Enable debug logging:
Environment Variables Reference
MANIAC_API_KEY
Your API key
Yes
MANIAC_ENVIRONMENT
Environment (production/sandbox)
No
MANIAC_REGION
Preferred region
No
MANIAC_TIMEOUT
Request timeout (seconds)
No
MANIAC_MAX_RETRIES
Max retry attempts
No
Next Steps
Explore the Python SDK
Last updated