API Key Authentication
Agentbase uses API keys to authenticate requests. All API requests must include a valid API key in theAuthorization header.
Getting Your API Key
1
Sign Up
Create an account at base.agentbase.sh/sign-up
2
Access Dashboard
Log in to your dashboard at base.agentbase.sh
3
Copy API Key
Find your API key in the dashboard under Settings or API Keys
Using Your API Key
- REST API
- TypeScript SDK
- Python SDK
Include your API key in the
Authorization header:Security Best Practices
Never Commit API Keys
Never Commit API Keys
Don’t do this:Do this instead:Why: Committing API keys to version control exposes them to anyone with repository access.
Use Environment Variables
Use Environment Variables
Store API keys in environment variables:Note: Add
.env to your .gitignore file.Rotate Keys Regularly
Rotate Keys Regularly
Rotate your API keys periodically:Recommended schedule: Every 90 days or when team members leave
1
Create New Key
Generate a new API key in the dashboard
2
Update Applications
Update all applications to use the new key
3
Test Thoroughly
Verify all integrations work with the new key
4
Revoke Old Key
Once confirmed, revoke the old API key
Server-Side Only
Server-Side Only
Never expose API keys in client-side code:Instead, proxy through your backend:
Monitor Usage
Monitor Usage
Regularly review API usage in your dashboard:
- Check for unexpected spikes
- Monitor cost trends
- Review active sessions
- Identify anomalies
- Sudden usage increases
- Cost threshold exceeded
- Failed authentication attempts
Error Handling
Handle authentication errors gracefully:- TypeScript
- Python
Common Errors
| Error Code | Meaning | Solution |
|---|---|---|
401 Unauthorized | Invalid or missing API key | Check your API key is correct and properly formatted |
403 Forbidden | API key lacks permissions | Verify your account is active and has credits |
429 Too Many Requests | Rate limit exceeded | Implement backoff and retry logic |
Rate Limiting
Agentbase implements rate limiting to ensure fair usage:- Rate limits are applied per account
- Limits vary by account tier
- Headers include rate limit information: