Authentication Methods
The Kaie API supports multiple authentication methods to secure your API requests and ensure only authorized access to your workflows and data.API Key Authentication
The most common method for authenticating with the Kaie API is using API keys.Getting Your API Key
- Log in to your Kaie dashboard
- Navigate to Settings > API Keys
- Click Create New API Key
- Give your key a descriptive name
- Select the appropriate permissions
- Copy the generated API key
API keys are only shown once when created. Make sure to copy and store your API key securely.
Using API Keys
Include your API key in theAuthorization
header of your requests:
API Key Permissions
API keys can be configured with different permission levels:Read Only
Read Only
- View workflows and analytics
- Access read-only endpoints
- Cannot modify or create resources
Read/Write
Read/Write
- All read permissions
- Create and update workflows
- Manage triggers and integrations
- Cannot delete resources
Full Access
Full Access
- All read/write permissions
- Delete workflows and resources
- Manage API keys and settings
- Access admin endpoints
OAuth 2.0 Authentication
For applications that need to access user data on behalf of users, OAuth 2.0 is recommended.OAuth Flow
- Authorization Request: Redirect users to the authorization endpoint
- User Consent: Users grant permission to your application
- Authorization Code: Receive an authorization code
- Token Exchange: Exchange the code for access and refresh tokens
- API Access: Use the access token to make API requests
Authorization Endpoint
client_id
: Your application’s client IDredirect_uri
: Where to redirect after authorizationresponse_type
: Must becode
scope
: Requested permissions (space-separated)state
: Random string to prevent CSRF attacks
Token Endpoint
grant_type
: Must beauthorization_code
code
: Authorization code from the previous stepredirect_uri
: Same redirect URI used in authorizationclient_id
: Your application’s client IDclient_secret
: Your application’s client secret
Using Access Tokens
Include the access token in theAuthorization
header:
Refresh Tokens
Access tokens expire after 1 hour. Use refresh tokens to get new access tokens:JWT Authentication
For server-to-server communication, JWT (JSON Web Token) authentication is supported.Creating JWT Tokens
JWT tokens must be signed with your private key and include the following claims:Using JWT Tokens
Include the JWT token in theAuthorization
header:
Webhook Authentication
Webhooks use HMAC-SHA256 signatures to verify the authenticity of incoming requests.Verifying Webhook Signatures
The webhook signature is included in theX-Kaie-Signature
header:
Rate Limiting
API requests are subject to rate limiting to ensure fair usage and system stability.Rate Limits
- API Key: 1000 requests per hour
- OAuth Token: 1000 requests per hour
- JWT Token: 1000 requests per hour
- Webhook: 100 requests per minute
Rate Limit Headers
Rate limit information is included in response headers:Handling Rate Limits
When you exceed the rate limit, you’ll receive a429 Too Many Requests
response:
retry_after
seconds before making new requests.
Security Best Practices
API Key Security
Storage
Storage
- Store API keys securely (environment variables, secret management)
- Never commit API keys to version control
- Use different keys for different environments
- Rotate keys regularly
Transmission
Transmission
- Always use HTTPS for API requests
- Include API keys in headers, not URLs
- Use secure communication channels
- Validate SSL certificates
Token Security
Access Tokens
Access Tokens
- Store access tokens securely
- Use short-lived access tokens
- Implement token refresh logic
- Revoke tokens when no longer needed
Refresh Tokens
Refresh Tokens
- Store refresh tokens securely
- Use long-lived refresh tokens
- Implement secure token exchange
- Monitor token usage
Error Handling
Authentication Errors
Common authentication errors and their meanings:Status Code | Error Code | Description |
---|---|---|
401 | INVALID_API_KEY | API key is invalid or expired |
401 | MISSING_AUTHENTICATION | No authentication provided |
401 | INVALID_TOKEN | Access token is invalid or expired |
403 | INSUFFICIENT_PERMISSIONS | API key lacks required permissions |
403 | SCOPE_INSUFFICIENT | Token scope is insufficient |
Error Response Format
Testing Authentication
Test Your API Key
Test OAuth Flow
Use the OAuth playground to test your OAuth implementation:OAuth Playground
Test OAuth authentication flows