Authentication
How to authenticate with the Chatbase API using API keys
Authentication
The Chatbase API uses Bearer token authentication. Every request must include your API key in the Authorization header.
Getting Your API Key
- Log in to your CRM dashboard
- Navigate to API Manage in the sidebar
- Click Create API Client
- Enter a descriptive name (e.g.
production-server,crm-integration) - Optionally set IP allowlist and route restrictions
- Click Create — copy the key immediately, it is shown only once
Using the API Key
Include the key as a Bearer token in every request:
Authorization: Bearer wpapi_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
cURL example
curl https://chatbase.in/api/v1/whatsapp/me \
-H "Authorization: Bearer wpapi_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
JavaScript (fetch)
const response = await fetch('https://chatbase.in/api/v1/whatsapp/messages/send', {
method: 'POST',
headers: {
'Authorization': 'Bearer wpapi_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'Content-Type': 'application/json',
},
body: JSON.stringify({
to: '919876543210',
type: 'text',
text: { body: 'Hello from Chatbase API!' },
}),
});
Node.js (axios)
const axios = require('axios');
const api = axios.create({
baseURL: 'https://chatbase.in/api/v1/whatsapp',
headers: {
Authorization: 'Bearer wpapi_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
},
});
const { data } = await api.post('/messages/send', {
to: '919876543210',
type: 'text',
text: { body: 'Hello from Chatbase!' },
});
Key Properties
| Property | Description |
|---|---|
| Name | Human-readable label for the client |
| Project ID | Identifies which WhatsApp Business account to use |
| Allowed IPs | Restrict requests to specific IP addresses (optional) |
| Allowed Routes | Restrict which API endpoints the key can access (optional) |
| Rate Limit | Maximum requests per minute (set by your plan) |
Rotating Keys
If a key is compromised, go to API Manage → find the client → click Rotate Key. The old key is immediately invalidated and a new key is shown once.
Security Best Practices
- Never expose your API key in client-side code (browser JavaScript, mobile apps)
- Store keys in environment variables, not source code
- Use IP allowlists in production
- Create separate API clients for each environment (dev, staging, production)
- Rotate keys periodically and immediately if suspected compromise
Error Responses
| Status | Meaning |
|---|---|
401 Unauthorized | Missing or malformed Authorization header |
403 Forbidden | Valid key but access denied (IP/route restriction, feature not in plan) |
429 Too Many Requests | Rate limit exceeded — back off and retry |