API – Click-to-Call
Use the VoiceB API to trigger outbound calls automatically. Ideal for form submissions, lead callbacks, or click-to-call features from your website or CRM.
To enable API-triggered outbound calls in VoiceB.ai, the configuration is done at the agent level.
Before you can access your API credentials and endpoint:
Go to your agent’s configuration screen
Set the Type to
Click to Call
Click Save
The "Show Credentials & Instructions" button will then appear
Clicking that button reveals your API Token, Secret, and full usage instructions — all specific to that agent.
⚠️ Each agent has its own credentials and endpoint. Make sure you configure and save the correct agent before using the API.

Once configured, you’ll be able to securely trigger real-time outbound calls from your backend or product flows.
🔐 API Authentication
You’ll need:
API Token
API Secret
📌 Credentials are available in Agent -> Show Credentials & Instructions in your VoiceB.ai dashboard.
Always trigger calls from your backend to avoid exposing secrets.
📍 Endpoint
POST https://app.voiceb.ai/api/click-to-call
🧪 Sample Request Payload
{
"phone": "+34612345678"
}
🔐 Headers
api-key
: your API Tokensignature
: HMAC SHA256 of the request body using your API Secret
🧰 Error Codes
Code
Message
Status
ctc:001
Missing headers
400
ctc:002
Error fetching agent
500
ctc:003
Invalid API key
403
ctc:004
Agent is disabled
400
ctc:005
Agent not configured
400
ctc:006
Invalid signature
403
ctc:007
Call already in progress
400
ctc:008
Error initiating call
500
🔧 Code Samples
Node.js
const axios = require('axios');
const crypto = require('crypto');
const API_KEY = process.env.API_KEY;
const SECRET_KEY = process.env.SECRET_KEY;
const ENDPOINT = process.env.ENDPOINT;
function generateSignature(secret, data) {
return crypto.createHmac('sha256', secret).update(data).digest('hex');
}
async function makeRequest() {
const body = {
phone: '+34612345678',
};
const textBody = JSON.stringify(body);
const signature = generateSignature(SECRET_KEY, textBody);
try {
const response = await axios.post(ENDPOINT, body, {
headers: {
'api-key': API_KEY,
'signature': signature,
'Content-Type': 'application/json',
},
});
console.log('Response:', response.data);
} catch (error) {
console.error('Error making request:', error.response ? error.response.data : error.message);
}
}
makeRequest();
Python
import os
import hmac
import hashlib
import requests
import json
API_KEY = os.getenv('API_KEY')
SECRET_KEY = os.getenv('SECRET_KEY')
ENDPOINT = os.getenv('ENDPOINT')
def generate_signature(secret, data):
return hmac.new(secret.encode(), data.encode(), hashlib.sha256).hexdigest()
def make_request():
body = {
'phone': '+34612345678',
}
text_body = json.dumps(body)
signature = generate_signature(SECRET_KEY, text_body)
headers = {
'api-key': API_KEY,
'signature': signature,
'Content-Type': 'application/json',
}
response = requests.post(ENDPOINT, headers=headers, data=text_body)
print('Response:', response.json())
if __name__ == '__main__':
make_request()
Last updated
Was this helpful?