How to authenticate with the Klen AI API
The Klen AI API uses API keys to authenticate requests. You can view and manage your API keys from your Klen AI dashboard.
All API requests must include an API key in one of the following ways:
Send your API key as a Bearer token in the Authorization header:
Alternatively, you can use the X-API-Key header:
For testing or simple applications, you can include your API key as a query parameter:
Security Note: Using query parameters is less secure as API keys may be logged in server access logs. Use the header methods for production applications.
To create a new API key:
Make sure to copy and store your API key securely. For security reasons, you won’t be able to view the full key again after creation.
When creating an API key, you can grant specific permissions:
Permission | Description |
---|---|
can_read_calls | Allows retrieving call information |
can_initiate_calls | Allows initiating new calls |
can_read_agents | Allows retrieving agent information |
can_read_contacts | Allows retrieving contact information |
can_read_calendar | Allows retrieving calendar events and availability |
can_write_calendar | Allows creating, updating, and canceling calendar events |
API keys have rate limits applied:
requests_per_minute_limit
: Maximum number of API requests per minute (default: 60)calls_per_day_limit
: Maximum number of calls that can be initiated per day (default: 100)calendar_events_per_day_limit
: Maximum number of calendar events that can be created per day (default: 50)If you exceed these limits, you’ll receive a 429 Too Many Requests
response.
Keep your API keys secure:
To revoke an API key:
Note that revoking a key is immediate and permanent. Any applications using the revoked key will lose access to the API.
If you encounter authentication errors, you may see the following responses:
Status Code | Error Code | Description |
---|---|---|
401 | authentication_required | No API key was provided |
401 | invalid_key | The API key is invalid or inactive |
403 | permission_denied | The API key doesn’t have the required permission |
429 | rate_limit_exceeded | Rate limit has been exceeded |