Documentation
DocumentationGuides / API Keys

API Keys Guide

Learn how to generate, manage, and secure your API keys

Security
Authentication
Setup
What are API Keys?

API keys are unique identifiers that authenticate your application when making requests to our API. They act as a secure way to identify your project and ensure only authorized applications can access your bot configurations and data.

0
Create Your Bot First

Before generating API keys, you need to create a bot that the keys will authenticate access to.

Bot Creation Process:
  • Choose a unique bot name and description
  • Select an AI model (GPT-3.5, GPT-4, etc.)
  • Configure system prompts (optional)
  • Upload training data for context
Create New Bot

Need help creating a bot?

Check out our comprehensive bot creation guide.

Bot Creation Guide
1
Navigate to API Keys Dashboard

Access the API Keys management dashboard to view and create keys for your bots.

Dashboard → API Keys → Select Your Bot
Go to API Keys Dashboard
2
Generate Your API Key

Create a new API key with customizable security settings.

Configuration Options:
Key Name:

Descriptive identifier

Domain Restrictions:

Limit to specific domains

Rate Limiting:

Control usage frequency

Expiration:

Optional expiration date

Security Features:
Encrypted key generation

Secure key creation

Immediate revocation capability

Instantly disable keys

Usage analytics and monitoring

Track key activity

3
Store Your API Key Securely

Follow best practices for API key storage and management.

Do's

  • Store in environment variables
  • Use secure key management services
  • Rotate keys regularly
  • Use different keys for different environments

Don'ts

  • Commit keys to version control
  • Hardcode in application source
  • Share keys in plain text
  • Use in client-side code
# Environment Variables (.env) CHATBOT_API_KEY=cb_86dff3cd_d88c309be3490c5aa981cd0007a4d4c5ce95f88140becc2876480da17a5fe6f5 CHATBOT_BOT_ID=676c86dc0b95b800088f76a5 # Usage in your application const apiKey = process.env.CHATBOT_API_KEY; const botId = process.env.CHATBOT_BOT_ID;
4
Test Your API Key

Verify that your API key is working correctly.

# Test API key with curl curl -X GET \ -H "Authorization: Bearer cb_86dff3cd_d88c309be3490c5aa981cd0007a4d4c5ce95f88140becc2876480da17a5fe6f5" \ /api/auth/verify # Expected response { "valid": true, "keyId": "api_key_123", "permissions": ["chat", "training-data"], "rateLimit": { "requests": 1000, "window": "1h" } }

Quick Test

You can also use our SDK Test Page to quickly verify your API key and bot ID combination.

5
Use in SDK Integration

Integrate your API key with our JavaScript or React SDKs.

JavaScript SDK

// Initialize JavaScript SDK
ChatbotSDK.init({
apiKey: 'cb_86dff3cd_d88c309b...',
botId: '676c86dc0b95b800088f76a5'
});

React SDK

// Initialize React SDK
const chatbot = ChatbotReactSDK.init({
apiKey: 'cb_86dff3cd_d88c309b...',
botId: '676c86dc0b95b800088f76a5'
});
API Key Management

Regenerate Keys

Rotate your API keys regularly for security

Monitor Usage

Track API key usage and rate limits

Revoke Access

Immediately disable compromised keys