API Keys
All requests to the Samurai AI API must include your API key as a Bearer token in theAuthorization header.
Getting Your API Key
- Log in to your Dashboard
- Navigate to Settings → API Keys
- Click + Create API Key
- Give it a name (e.g., “Production”, “Development”)
- Copy and store it securely — it won’t be shown again
Using Your API Key
Environment Variables
Always store your API key in environment variables, never hardcode it:.env
Python
Error Responses
| Status | Error | Meaning |
|---|---|---|
401 | auth_error | Missing or invalid API key |
403 | permission_denied | Valid key but insufficient plan for this model |
402 | insufficient_credits | Your credit balance is depleted |
Managing API Keys
- Create multiple keys for different environments (dev, staging, prod)
- Rotate keys periodically for security
- Delete unused keys from your dashboard
- Keys can be revoked instantly if compromised