Skip to content

Authentication

All MAIA API endpoints require authentication using API tokens. Tokens provide secure, long-lived access to the API without requiring interactive login.

Generating an API Token

  1. Log in to the MAIA dashboard
  2. Navigate to Settings > API Tokens
  3. Click Generate New Token
  4. Copy and securely store the token immediately

Important

The token is only displayed once when generated. If you lose it, you'll need to generate a new one (which revokes the old token).

Using the Token

Include the API token in the Authorization header as a Bearer token:

bash
curl -X POST "https://api.maiacompany.io/messages" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "channelId": "your-channel-id",
    "sessionId": "your-session-id",
    "content": "Hello from the API!"
  }'

Token Security

PracticeDescription
Store securelyUse environment variables or a secrets manager
Never commitDon't commit tokens to version control
Rotate regularlyGenerate new tokens periodically
Revoke if compromisedImmediately revoke tokens if exposed

Token Management

Check Token Status

View your token status in Settings > API Tokens to see:

  • Whether an active token exists
  • When it was created
  • When it was last used

Revoke a Token

If your token is compromised or no longer needed:

  1. Go to Settings > API Tokens
  2. Click Revoke Token
  3. The token is immediately invalidated

TIP

Generating a new token automatically revokes any existing token.

Error Responses

StatusErrorDescription
401UnauthorizedMissing or invalid token
401Token revokedToken has been revoked
403ForbiddenToken doesn't have access to this resource

Example Error Response

json
{
  "error": "Unauthorized",
  "message": "Invalid or missing API token"
}

Rate Limits

API requests are rate limited per account:

WindowDefault Limit
Per minute120 requests
Per hour3,000 requests

Successful responses include rate limit headers:

http
X-RateLimit-Limit: 120
X-RateLimit-Remaining: 118
X-RateLimit-Reset: 1704067260
HeaderDescription
X-RateLimit-LimitMaximum requests per window
X-RateLimit-RemainingRemaining requests in current window
X-RateLimit-ResetUnix timestamp when the window resets

When rate limited, you'll receive a 403 Forbidden response. Wait and retry with exponential backoff.

TIP

Contact your administrator to adjust rate limits for your account.

MAIA Platform Documentation