Skip to main content

API Keys

All requests to the Samurai AI API must include your API key as a Bearer token in the Authorization header.

Getting Your API Key

  1. Log in to your Dashboard
  2. Navigate to Settings → API Keys
  3. Click + Create API Key
  4. Give it a name (e.g., “Production”, “Development”)
  5. 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
Never expose your API key in:
  • Client-side JavaScript / browser code
  • Public GitHub repositories
  • Log files or error messages
  • Mobile app bundles

Error Responses

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