API Keys
Egg API uses API keys for authentication. Each request must include your API key in theAuthorization header.
Getting Your API Key
Sign up
Create an account at eggapi.ai
Go to Dashboard
Navigate to the API Keys section
Using Your API Key
Include your API key in theAuthorization header with the Bearer prefix:
Security Best Practices
Do’s
- Store API keys in environment variables
- Use server-side code to make API calls
- Rotate keys periodically
- Create separate keys for different environments (dev, staging, prod)
Don’ts
- Hardcode API keys in your source code
- Commit API keys to version control
- Share API keys in chat or email
- Use the same key for all environments
Environment Variables
Store your API key in an environment variable:.env
Authentication Errors
If authentication fails, you’ll receive a401 Unauthorized response:
- Missing
Authorizationheader - Missing
Bearerprefix - Invalid or revoked API key
- Typo in the API key
Managing API Keys
From your dashboard, you can:- Create new API keys
- View existing keys (partial display only)
- Revoke compromised keys
- Track usage per key
If you suspect your API key has been compromised, revoke it immediately and create a new one.