API Key Authentication
All API requests require authentication using an API key. Include your API key in theAuthorization header of every request.
Getting Your API Key
- Log in to your EnviaAI Dashboard
- Navigate to Developer Portal > API Keys
- Click Create New Key
- Give your key a descriptive name
- Copy and securely store your API key
API Key Best Practices
Use Environment Variables
Never hardcode API keys in your source code
Rotate Regularly
Rotate your API keys periodically for security
Use Separate Keys
Use different keys for development and production
Monitor Usage
Track API usage to detect unauthorized access
Example Request
Rate Limits
API rate limits vary by plan. Rate limit information is included in response headers.Rate Limit Headers
| Header | Description |
|---|---|
X-RateLimit-Limit | Maximum requests allowed in the current window |
X-RateLimit-Remaining | Requests remaining in the current window |
X-RateLimit-Reset | Unix timestamp when the rate limit resets |
Rate Limits by Plan
- Free
- Starter
- Pro
- Enterprise
| Endpoint | Limit | Window |
|---|---|---|
| Messages | 100 requests | per minute |
| Instances | 50 requests | per minute |
| Webhooks | 100 requests | per minute |
| General | 500 requests | per minute |
Handling Rate Limits
When you exceed your rate limit, you’ll receive a429 Too Many Requests response:
Error Responses
Authentication Errors
| Status | Code | Description |
|---|---|---|
| 401 | invalid_api_key | The API key is invalid or has been revoked |
| 401 | missing_api_key | No API key was provided in the request |
| 401 | expired_api_key | The API key has expired |
| 403 | insufficient_permissions | The API key doesn’t have permission for this action |
Example Error Response
API Key Scopes
When creating an API key, you can specify scopes to limit its permissions:| Scope | Description |
|---|---|
messages:read | Read message history and status |
messages:write | Send messages |
instances:read | View instance information |
instances:write | Manage instances (connect, disconnect) |
webhooks:read | View webhook configurations |
webhooks:write | Create and manage webhooks |
billing:read | View billing and usage information |
Keys without specified scopes have full access to all endpoints available on your plan.
Security Recommendations
- Never expose API keys in client-side code - API calls should be made from your backend server
- Use HTTPS - All API requests must be made over HTTPS
- Implement IP allowlisting - Restrict API access to known IP addresses (available on Pro and Enterprise plans)
- Monitor for anomalies - Set up alerts for unusual API usage patterns
- Revoke unused keys - Delete API keys that are no longer needed