Skip to main content

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

  1. Log in to your Kaie dashboard
  2. Navigate to Settings > API Keys
  3. Click Create New API Key
  4. Give your key a descriptive name
  5. Select the appropriate permissions
  6. 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 the Authorization header of your requests:

API Key Permissions

API keys can be configured with different permission levels:
  • View workflows and analytics
  • Access read-only endpoints
  • Cannot modify or create resources
  • All read permissions
  • Create and update workflows
  • Manage triggers and integrations
  • Cannot delete resources
  • 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

  1. Authorization Request: Redirect users to the authorization endpoint
  2. User Consent: Users grant permission to your application
  3. Authorization Code: Receive an authorization code
  4. Token Exchange: Exchange the code for access and refresh tokens
  5. API Access: Use the access token to make API requests

Authorization Endpoint

Parameters:
  • client_id: Your application’s client ID
  • redirect_uri: Where to redirect after authorization
  • response_type: Must be code
  • scope: Requested permissions (space-separated)
  • state: Random string to prevent CSRF attacks

Token Endpoint

Parameters:
  • grant_type: Must be authorization_code
  • code: Authorization code from the previous step
  • redirect_uri: Same redirect URI used in authorization
  • client_id: Your application’s client ID
  • client_secret: Your application’s client secret

Using Access Tokens

Include the access token in the Authorization 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 the Authorization header:

Webhook Authentication

Webhooks use HMAC-SHA256 signatures to verify the authenticity of incoming requests.

Verifying Webhook Signatures

The webhook signature is included in the X-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 a 429 Too Many Requests response:
Wait for the specified retry_after seconds before making new requests.

Security Best Practices

API Key Security

  • Store API keys securely (environment variables, secret management)
  • Never commit API keys to version control
  • Use different keys for different environments
  • Rotate keys regularly
  • Always use HTTPS for API requests
  • Include API keys in headers, not URLs
  • Use secure communication channels
  • Validate SSL certificates

Token Security

  • Store access tokens securely
  • Use short-lived access tokens
  • Implement token refresh logic
  • Revoke tokens when no longer needed
  • 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:

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

Next Steps

Now that you understand authentication, explore the API endpoints:

Workflows API

Manage workflows programmatically

Analytics API

Access analytics data via API

Webhooks API

Set up webhook integrations

Triggers API

Manage workflow triggers