API Reference
Build powerful integrations with the BotHero REST API. Simple, predictable, and developer-friendly.
Base URL
https://api.bothero.ai/v1All API requests must use HTTPS. HTTP requests will be rejected.
Authentication
Authenticate using Bearer tokens in the Authorization header. Get your API key from the dashboard.
Authorization: Bearer YOUR_API_KEYAPI Endpoints
Authentication
/auth/loginAuthenticate and get access token
/auth/refreshRefresh expired access token
/auth/logoutRevoke access token
Bots
/botsList all bots
/botsCreate a new bot
/bots/:idGet bot details
/bots/:idUpdate bot configuration
/bots/:idDelete a bot
/bots/:id/deployDeploy bot to Telegram
Messages
/messagesList conversation messages
/messagesSend a message
/messages/:idGet message details
/messages/:id/handoffTransfer to human agent
Analytics
/analytics/overviewGet overview metrics
/analytics/conversationsConversation statistics
/analytics/leadsLead capture data
/analytics/sentimentSentiment analysis
Code Examples
Create a Bot
cURLcurl -X POST https://api.bothero.ai/v1/bots \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Support Bot",
"telegram_token": "YOUR_TELEGRAM_TOKEN",
"personality": "friendly and helpful"
}'Create a Bot
JavaScriptconst response = await fetch('https://api.bothero.ai/v1/bots', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Support Bot',
telegram_token: 'YOUR_TELEGRAM_TOKEN',
personality: 'friendly and helpful'
})
});
const bot = await response.json();Create a Bot
Pythonimport requests
response = requests.post(
'https://api.bothero.ai/v1/bots',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'name': 'Support Bot',
'telegram_token': 'YOUR_TELEGRAM_TOKEN',
'personality': 'friendly and helpful'
}
)
bot = response.json()Rate Limits
Enterprise customers can request higher rate limits. Contact sales for details.
Error Responses
The API uses standard HTTP response codes. Errors include a JSON body with details.
{
"error": {
"code": "invalid_request",
"message": "Missing required field: name",
"field": "name"
}
}Official SDKs Coming Soon
We're working on official SDKs for JavaScript, Python, Go, and PHP to make integration even easier.
Need Help?
Check out our full documentation or contact support for assistance.