Table of Contents
Calls API #
The Calls API lets you trigger AI voice calls and retrieve call data programmatically.
Trigger a Call #
Endpoint: POST /api/v1/calls
Request #
curl -X POST "https://app.voxpria.com/api/v1/calls" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agentId": "agent_abc123",
"toNumber": "+14155551234",
"variables": {
"customerName": "John Doe",
"accountNumber": "12345"
}
}'
Response #
{
"success": true,
"data": {
"callId": "call_xyz789",
"status": "queued",
"toNumber": "+14155551234",
"agentId": "agent_abc123",
"createdAt": "2025-02-09T12:00:00Z"
}
}
Get Call Details #
Endpoint: GET /api/v1/calls/:id
curl -X GET "https://app.voxpria.com/api/v1/calls/call_xyz789" \ -H "Authorization: Bearer YOUR_API_KEY"
Response #
{
"success": true,
"data": {
"callId": "call_xyz789",
"status": "completed",
"duration": 127,
"recording": "https://...",
"transcript": "...",
"outcome": "successful",
"startedAt": "2025-02-09T12:00:00Z",
"completedAt": "2025-02-09T12:02:07Z"
}
}
List Calls #
Endpoint: GET /api/v1/calls
curl -X GET "https://app.voxpria.com/api/v1/calls?page=1&limit=50" \ -H "Authorization: Bearer YOUR_API_KEY"
Call Statuses #
| Status | Description |
|---|---|
queued |
Call is queued for processing |
ringing |
Phone is ringing |
in_progress |
Call is active |
completed |
Call finished successfully |
failed |
Call failed |
no_answer |
No answer |
busy |
Line was busy |
Code Example – Trigger Call #
JavaScript #
const axios = require('axios');
async function triggerCall(agentId, phoneNumber, variables = {}) {
const response = await axios.post(
'https://app.voxpria.com/api/v1/calls',
{
agentId,
toNumber: phoneNumber,
variables
},
{
headers: {
'Authorization': `Bearer ${process.env.VOXPRIA_API_KEY}`,
'Content-Type': 'application/json'
}
}
);
return response.data;
}
// Usage
const result = await triggerCall(
'agent_abc123',
'+14155551234',
{ customerName: 'John Doe' }
);
console.log('Call ID:', result.data.callId);
Python #
import requests
import os
def trigger_call(agent_id, phone_number, variables=None):
response = requests.post(
'https://app.voxpria.com/api/v1/calls',
json={
'agentId': agent_id,
'toNumber': phone_number,
'variables': variables or {}
},
headers={
'Authorization': f'Bearer {os.getenv("VOXPRIA_API_KEY")}',
'Content-Type': 'application/json'
}
)
return response.json()
# Usage
result = trigger_call(
'agent_abc123',
'+14155551234',
{'customerName': 'John Doe'}
)
print('Call ID:', result['data']['callId'])
💡 Pro Tip: Use webhooks to receive real-time call status updates instead of polling the API.

Leave A Comment