Authentication

Authenticate API requests with Bearer tokens using your API key.

All API requests require authentication using a Bearer token. Generate an API key from your dashboard and include it in the Authorization header.

Note: API access requires a Hobby plan or above with active billing.

Generating an API Key

  1. Go to your team workspace dashboard
  2. Click API Keys in the sidebar
  3. Click Create API Key
  4. Copy the generated key

Using Your API Key

Include the key in the Authorization header:

curl -X POST 'https://your-domain.com/api/v1/chat' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"chatbotId": "uuid", "messages": [{"role": "user", "content": "Hello"}]}'

Header Format

Authorization: Bearer YOUR_API_KEY

Testing Your Key

Verify your API key works with the auth endpoint:

curl 'https://your-domain.com/api/v1/auth' \
  -H 'Authorization: Bearer YOUR_API_KEY'

Success Response (200):

{
  "id": "account-uuid",
  "name": "Your Workspace",
  "email": "[email protected]"
}

Invalid Key (401):

{
  "message": "Missing or invalid Authorization header"
}

API Key Security

Best Practices

  1. Never expose keys in client-side code - API keys should only be used server-side
  2. Use environment variables - Don't hardcode keys in your code
  3. Rotate keys periodically - Delete old keys and create new ones
  4. Use descriptive names - Know which key is used where

Key Format

Keys are 32 random bytes encoded as base64url.

Managing API Keys

View All Keys

See all keys in Workspace > API Keys.

Delete Keys

Remove keys you no longer need:

  1. Go to API Keys
  2. Find the key
  3. Click Delete
  4. Confirm deletion

Deleted keys stop working immediately.

Error Responses

StatusMessageCause
401Missing or invalid Authorization headerHeader not provided
401Invalid API keyKey is incorrect
403API access requires a Hobby plan or above with active billingPlan or billing status does not allow API access
403Chatbot does not belong to this accountAgent ID does not belong to the API key's account

Environment Setup

Node.js

const API_KEY = process.env.AGENTKIT_API_KEY;

const response = await fetch('https://your-domain.com/api/v1/chat', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    chatbotId: 'your-chatbot-id',
    messages: [{ role: 'user', content: 'Hello' }],
  }),
});

Python

import os
import requests

API_KEY = os.environ.get('AGENTKIT_API_KEY')

response = requests.post(
    'https://your-domain.com/api/v1/chat',
    headers={
        'Authorization': f'Bearer {API_KEY}',
        'Content-Type': 'application/json',
    },
    json={
        'chatbotId': 'your-chatbot-id',
        'messages': [{'role': 'user', 'content': 'Hello'}],
    },
)

cURL

export AGENTKIT_API_KEY="your-api-key"

curl -X POST 'https://your-domain.com/api/v1/chat' \
  -H "Authorization: Bearer $AGENTKIT_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"chatbotId": "uuid", "messages": [{"role": "user", "content": "Hello"}]}'

Next Steps