Overview
elizaOS supports multiple authentication methods to secure API access. Authentication ensures that only authorized users and applications can interact with your agents.Authentication Methods
API Key Authentication
The primary authentication method uses API keys passed in request headers.Using API Keys
Include your API key in theAuthorization header:
Setting API Keys
Configure API keys in your character’s settings:No Authentication (Development)
For local development and testing, you can run elizaOS without authentication:Request Headers
Required Headers
Set to
application/json for all POST, PUT, and PATCH requestsOptional Headers
Bearer token for authentication:
Bearer YOUR_API_KEYTarget a specific agent by ID
Authentication Examples
Node.js
Python
cURL
Security Best Practices
Store Keys Securely
Never hardcode API keys in your source code. Use environment variables:Rotate Keys Regularly
Change your API keys periodically to minimize security risks:- Generate a new API key
- Update your applications to use the new key
- Revoke the old key after migration
Use HTTPS in Production
Always use HTTPS in production to encrypt API requests:Implement Rate Limiting
Protect your API from abuse by implementing rate limiting at the reverse proxy or application level.Error Handling
401 Unauthorized
Returned when authentication credentials are missing or invalid:403 Forbidden
Returned when authentication succeeds but the user lacks permissions:Next Steps
List Agents
Start making authenticated API requests
Send Message
Send your first message to an agent