🔑 License Keys
Manage license keys for embedding AI chat widgets on your websites.
Overview
License Keys allow you to:
- Generate secure keys for embedded chat widgets
- Control access per data source and agent
- Set usage limits and expiration dates
- Track widget usage and analytics
- Restrict access to specific domains
📦 Plan Requirement
License Keys are available in Growth plan and higher.
Creating a License Key
- Navigate to License Keys in the admin panel
- Click Create License Key
- Configure the key settings:
- Name: Descriptive name (e.g., "Company Website Widget")
- Data Source: Restrict to specific database (optional)
- Agent: Restrict to specific AI agent (optional)
- Allowed Domains: Comma-separated list of domains (optional)
- Monthly Limit: Maximum queries per month (optional)
- Expiration Date: When the key expires (optional)
- Click Create and copy your license key
⚠️ Important
Save your license key securely. You cannot retrieve it later (only regenerate).
Using License Keys
Once created, embed the license key in your website:
Basic Implementation
<script>
window.CHAT_WIDGET_CONFIG = {
apiUrl: 'https://api.datixlab.com',
licenseKey: 'XXXX-XXXX-XXXX-XXXX',
position: 'bottom-right'
};
</script>
<script src="https://cdn.datixlab.com/chat-widget.js"></script>
With Custom Styling
<script>
window.CHAT_WIDGET_CONFIG = {
apiUrl: 'https://api.datixlab.com',
licenseKey: 'XXXX-XXXX-XXXX-XXXX',
position: 'bottom-right',
theme: 'light', // or 'dark'
primaryColor: '#5D87FF',
welcomeMessage: 'Hello! How can I help you today?'
};
</script>
<script src="https://cdn.datixlab.com/chat-widget.js"></script>
License Key Features
Usage Tracking
Monitor how your chat widget is being used:
- Total queries executed
- Monthly usage count
- Usage by domain
- Response times
- Success/error rates
Usage Limits
Control costs with monthly limits:
- Unlimited: No restrictions (default)
- Fixed Limit: Set maximum monthly queries
- Auto-reset: Limits reset on the 1st of each month
- Notification: Get alerts when approaching limits
Domain Restrictions
Prevent unauthorized use by restricting domains:
Allowed Domains: example.com, www.example.com, app.example.com
The widget will only work on specified domains.
Data Source & Agent Binding
Control what data the widget can access:
- No binding: Access any data source with any agent
- Data Source: Restrict to specific database
- Agent: Restrict to specific AI agent
- Both: Most secure option
Managing License Keys
Viewing Usage
- Go to License Keys page
- Click the History icon next to a key
- View detailed usage logs:
- Timestamp of each query
- Question asked
- Response time
- IP address and referrer
Updating a License Key
You can update:
- Name and description
- Monthly usage limits
- Expiration date
- Active/inactive status
- Allowed domains
💡 Tip
Instead of deleting keys, mark them inactive to preserve usage history for auditing.
Revoking Access
To immediately stop a widget from working:
- Find the license key
- Toggle Active to OFF
- The widget will stop working immediately
Security Best Practices
- Use domain restrictions: Always specify allowed domains
- Set usage limits: Prevent abuse with monthly caps
- Monitor usage: Check logs regularly for anomalies
- Rotate keys: Regenerate keys periodically
- Bind to agent: Restrict access to specific data
- Set expiration: Use expiring keys for trials
API Reference
Create License Key
POST /api/license-keys
Authorization: Bearer {token}
{
"name": "My Website Widget",
"data_source_id": "abc-123",
"agent_id": "agent-456",
"allowed_domains": "example.com",
"monthly_usage_limit": 1000,
"expires_at": "2026-12-31T23:59:59Z"
}
List License Keys
GET /api/license-keys
Authorization: Bearer {token}
Update License Key
PATCH /api/license-keys/{key_id}
Authorization: Bearer {token}
{
"is_active": false,
"monthly_usage_limit": 2000
}
Get Usage History
GET /api/license-keys/{key_id}/usage?limit=100
Authorization: Bearer {token}
Troubleshooting
Widget Not Showing
- Check if license key is active
- Verify domain is in allowed list
- Check browser console for errors
- Ensure script URL is correct
Queries Not Working
- Check monthly usage limit
- Verify key hasn't expired
- Ensure data source/agent are active
- Check query execution permissions
Usage Not Tracking
- Wait a few minutes for sync
- Check if queries are actually executing
- Verify license key is correct in widget