Authorization header.
Authentication methods
Aiven supports three types of tokens:- Session tokens: Created when you log in to the Aiven Console or CLI. Automatically revoked when you log out.
- Personal tokens: Created manually for API and CLI access. Can be configured with custom session durations and IP restrictions.
- Application tokens: Linked to application users for non-human access. Recommended for automated systems and integrations.
Creating a personal token
Using the Aiven Console
- Click User information in the top right
- Select Tokens
- Click Generate token
- Enter a description and set the session duration
- Click Generate token
- Copy the token and store it securely
Using the Aiven CLI
Using tokens in API requests
Include your token in theAuthorization header with the aivenv1 prefix:
Examples
Token security best practices
Set appropriate session durations
Set appropriate session durations
Configure session durations based on your security requirements. Shorter durations limit the impact of token exposure but require more frequent rotation.
Restrict by IP address
Restrict by IP address
Limit token usage to trusted networks by specifying allowed IP address ranges when creating the token.
Rotate tokens regularly
Rotate tokens regularly
Implement a token rotation schedule to minimize security risks. Create a new token before revoking the old one to avoid service interruptions.
Use application users for automation
Use application users for automation
For non-human access like CI/CD pipelines, use application users instead of personal tokens. This provides better audit trails and access control.
Never share tokens
Never share tokens
Store tokens securely
Store tokens securely
- Never commit tokens to version control
- Use environment variables or secret management systems
- Encrypt tokens at rest
- Use vault services like AWS Secrets Manager or HashiCorp Vault
Authentication errors
Common authentication-related errors:The token is missing, invalid, or expired. Verify the token is correct and hasn’t been revoked.
The token is valid but doesn’t have permission to access the requested resource. Check your organization and project permissions.
Example error response
Application users and tokens
For automated systems and integrations, use application users:- Create an application user in your organization
- Generate an application token
- Assign appropriate permissions to the application user
- Use the token in your automated systems
Application tokens provide better security and audit capabilities compared to personal tokens for non-human access.