Authenticate Using Bearer Token
Learn how to authenticate your API requests using Bearer token authentication.Overview
All Eden AI V3 API requests require authentication using a Bearer token. This token identifies your account and tracks usage for billing and rate limiting purposes.Getting Your API Token
- Sign up or log in to your Eden AI Dashboard
- Navigate to API Keys section
- Copy your API key
- Keep it secure - never commit it to version control or share publicly
Authentication Header
Include your API token in theAuthorization header with the Bearer scheme:
Examples
cURL
Best Practices
Store Tokens Securely
Never hardcode API tokens in your source code. Use environment variables or secret management systems:Add to .gitignore
Ensure your.env file and any files containing API keys are excluded from version control:
Rotate Keys Regularly
For security, periodically rotate your API keys:- Generate a new key in the dashboard
- Update your application with the new key
- Delete the old key after confirming the new one works
Use Different Keys for Different Environments
Create separate API keys for development, staging, and production environments to:- Track usage separately
- Revoke access independently
- Maintain security isolation
Authentication Errors
401 Unauthorized
Cause: Invalid or missing API token Solutions:- Verify your token is correct
- Check the
Authorizationheader format:Bearer YOUR_TOKEN - Ensure the token hasn’t been revoked
- Confirm there are no extra spaces or newline characters
402 Payment Required
Cause: Insufficient credits in your account Solutions:- Add credits to your account in the dashboard
- Check your current balance
- Review your usage patterns