Using the Chatbeam API
Chatbeam provides a simple REST API that allows you to integrate AI-powered messaging capabilities into your applications. With our API, you can send messages to your AI assistant and receive responses based on your knowledge base, just like with the chat widget.
Authentication
All API requests require authentication using your organization's API key. You can find your API key in the Settings > API tab of your dashboard.
Include your API key in the Authorization header of your requests:
Authorization: Bearer YOUR_API_KEY
Basic Usage
Sending a Message
To send a message to your AI assistant, make a POST request to the messages endpoint
POST /api/v1/messages
Content-Type: application/json
{
"content": "What services do you offer?"
}
Response Format
The API will return a JSON response containing:
- The conversation ID (for maintaining context in subsequent messages)
- The original message
- The AI response based on your knowledge base
{
"conversation_id": "conversation-identifier",
"message": "What services do you offer?",
"response": "We offer a range of services including..."
}
Maintaining Conversation Context
To continue a conversation, include the conversation_id
from a previous response in your next request
POST /api/v1/messages
Content-Type: application/json
{
"content": "Tell me more about that",
"conversation_id": "conversation-identifier"
}
Usage Limits
Each API call consumes one credit from your account, just like a chat widget interaction. Free accounts have limited credits, while paid plans include higher message limits.
Integration Examples
cURL
curl -X POST \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"content": "What services do you offer?"}' \
https://www.chatbeam.com/api/v1/messages
JavaScript
fetch('https://www.chatbeam.com/api/v1/messages', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
content: 'What services do you offer?'
})
})
.then(response => response.json())
.then(data => console.log(data));
Next Steps
With the Chatbeam API, you can build custom integrations for your website, mobile app, or business tools. Common use cases include:
- Adding AI capabilities to your own chat interfaces
- Building integrations with platforms like Zapier or Make
- Creating custom support workflows in your existing systems