Skip to main content

Making Outbound Calls

The Audian API makes it easy to initiate outbound calls to any phone number. You can control how calls are placed, set up call actions, and track call progress through webhooks.

Basic Outbound Call​

The simplest way to make a call:

curl -X POST https://api.audian.com:8443/v2/calls \
-H "X-Auth-Token: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "+14155552671",
"to": "+14155552672"
}'

Response:

{
"call_id": "call_xyz789",
"call_uuid": "550e8400-e29b-41d4-a716-446655440000",
"from": "+14155552671",
"to": "+14155552672",
"status": "initiated",
"created_at": "2024-01-15T10:30:00Z"
}

Call Parameters​

Required Parameters​

ParameterTypeDescription
fromstringCaller ID (must be a phone number your account owns)
tostringDestination phone number (E.164 format recommended)

Optional Parameters​

ParameterTypeDefaultDescription
call_typestringoutboundType of call (always outbound for this endpoint)
timeoutinteger30Ring timeout in seconds
max_durationinteger3600Maximum call duration in seconds
tagsobject{}Custom tags for tracking
custom_fieldsobject{}Custom data to store with call
recordingobject{}Recording configuration
call_controlobject{}Call control and actions

Example: Call with Timeout and Tags​

curl -X POST https://api.audian.com:8443/v2/calls \
-H "X-Auth-Token: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "+14155552671",
"to": "+14155552672",
"timeout": 45,
"max_duration": 600,
"tags": {
"campaign": "winter_sale",
"agent_id": "agent_123",
"priority": "high"
},
"custom_fields": {
"customer_id": "cust_456",
"order_id": "ord_789"
}
}'

Response:

{
"call_id": "call_xyz789",
"call_uuid": "550e8400-e29b-41d4-a716-446655440000",
"from": "+14155552671",
"to": "+14155552672",
"status": "initiated",
"timeout": 45,
"max_duration": 600,
"tags": {
"campaign": "winter_sale",
"agent_id": "agent_123",
"priority": "high"
},
"custom_fields": {
"customer_id": "cust_456",
"order_id": "ord_789"
},
"created_at": "2024-01-15T10:30:00Z"
}

Call Control Actions​

Use call_control to define actions that happen during the call:

curl -X POST https://api.audian.com:8443/v2/calls \
-H "X-Auth-Token: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "+14155552671",
"to": "+14155552672",
"call_control": {
"on_answered": [
{
"action": "play_audio",
"audio_url": "https://example.com/greeting.mp3",
"message": "Hello! Thank you for calling."
}
],
"on_no_answer": [
{
"action": "play_audio",
"message": "Sorry, no one is available right now. Please leave a message."
}
]
}
}'

Supported Actions​

ActionDescriptionParameters
play_audioPlay audio file or TTS messageaudio_url, message, language
record_audioRecord the callmax_duration, beep_start
transferTransfer call to another numberdestination, caller_id
hangupEnd the call-
gather_dtmfCollect DTMF inputmax_digits, timeout, finish_key

Example: Call with IVR Menus​

curl -X POST https://api.audian.com:8443/v2/calls \
-H "X-Auth-Token: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "+14155552671",
"to": "+14155552672",
"call_control": {
"on_answered": [
{
"action": "play_audio",
"message": "Welcome to support. Press 1 for billing, 2 for technical support, or 3 for sales."
},
{
"action": "gather_dtmf",
"max_digits": 1,
"timeout": 10,
"routes": [
{
"digit": "1",
"action": "transfer",
"destination": "+14155552673"
},
{
"digit": "2",
"action": "transfer",
"destination": "+14155552674"
},
{
"digit": "3",
"action": "transfer",
"destination": "+14155552675"
}
]
}
]
}
}'

Recording Calls​

Enable call recording by adding the recording parameter:

curl -X POST https://api.audian.com:8443/v2/calls \
-H "X-Auth-Token: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "+14155552671",
"to": "+14155552672",
"recording": {
"enabled": true,
"format": "mp3",
"participant": "all"
}
}'

Recording Parameters​

ParameterTypeOptionsDescription
enabledboolean-Enable/disable recording
formatstringwav, mp3, opusAudio format
participantstringall, caller, calleeWho to record
bitrateinteger-Audio bitrate in kbps

When recording completes, you'll receive a recording.completed webhook event with the download URL.

Using Text-to-Speech​

Instead of pre-recorded audio, use TTS messages:

curl -X POST https://api.audian.com:8443/v2/calls \
-H "X-Auth-Token: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "+14155552671",
"to": "+14155552672",
"call_control": {
"on_answered": [
{
"action": "play_audio",
"message": "Hello! You have a $50 credit available. Would you like to use it?",
"language": "en-US",
"voice": "female"
}
]
}
}'

TTS Parameters​

ParameterTypeOptionsDescription
messagestring-Text to speak
languagestringen-US, en-GB, es-ES, etc.Language code
voicestringmale, femaleVoice gender
ratefloat0.5 - 2.0Speech rate multiplier

Scheduled Calls​

Schedule calls to be placed at a future time:

curl -X POST https://api.audian.com:8443/v2/calls \
-H "X-Auth-Token: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "+14155552671",
"to": "+14155552672",
"scheduled_for": "2024-01-15T15:00:00Z",
"call_control": {
"on_answered": [
{
"action": "play_audio",
"message": "This is your appointment reminder for tomorrow at 2 PM."
}
]
}
}'

Response:

{
"call_id": "call_scheduled_123",
"status": "scheduled",
"scheduled_for": "2024-01-15T15:00:00Z",
"created_at": "2024-01-15T10:30:00Z"
}

Batching Multiple Calls​

Create multiple calls in one request:

curl -X POST https://api.audian.com:8443/v2/calls/batch \
-H "X-Auth-Token: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"calls": [
{
"from": "+14155552671",
"to": "+14155552672",
"tags": { "batch_id": "batch_123" }
},
{
"from": "+14155552671",
"to": "+14155552673",
"tags": { "batch_id": "batch_123" }
},
{
"from": "+14155552671",
"to": "+14155552674",
"tags": { "batch_id": "batch_123" }
}
]
}'

Response:

{
"batch_id": "batch_123abc",
"total": 3,
"queued": 3,
"failed": 0,
"calls": [
{
"call_id": "call_1",
"status": "initiated"
},
{
"call_id": "call_2",
"status": "initiated"
},
{
"call_id": "call_3",
"status": "initiated"
}
]
}

Retrieve Call Status​

Get information about a call in progress:

curl https://api.audian.com:8443/v2/calls/call_xyz789 \
-H "X-Auth-Token: YOUR_API_KEY"

Response:

{
"call_id": "call_xyz789",
"call_uuid": "550e8400-e29b-41d4-a716-446655440000",
"from": "+14155552671",
"to": "+14155552672",
"status": "answered",
"duration": 45,
"initiated_at": "2024-01-15T10:30:00Z",
"answered_at": "2024-01-15T10:30:05Z",
"tags": {
"campaign": "winter_sale"
}
}

Call Progress Monitoring​

Monitor call progress through webhooks:

{
"id": "evt_1234567890abcdef",
"timestamp": "2024-01-15T10:30:00Z",
"event": "call.initiated",
"data": {
"call_id": "call_xyz789",
"status": "initiated"
}
}

Events you'll receive:

  1. call.initiated - Call created
  2. call.ringing - Destination is ringing
  3. call.answered - Call was answered
  4. call.completed - Call ended normally
  5. call.failed - Call failed to connect

Handling Call Failures​

If a call fails, you'll receive a call.failed webhook:

{
"event": "call.failed",
"data": {
"call_id": "call_xyz789",
"reason": "no_answer",
"reason_code": 408
}
}

Possible failure reasons:

ReasonCodeDescription
no_answer408Destination didn't answer within timeout
declined603Call was explicitly declined
invalid_number404Invalid destination number
busy486Destination line is busy
network_error503Network connectivity issue

Error Responses​

Common error scenarios:

Invalid Destination Number​

{
"error": "invalid_number",
"message": "The destination number format is invalid",
"code": 400
}

Unauthorized Caller ID​

{
"error": "unauthorized_caller_id",
"message": "You are not authorized to use this caller ID",
"code": 403
}

Rate Limited​

{
"error": "rate_limited",
"message": "Too many concurrent calls. Maximum: 100",
"code": 429
}

Best Practices​

  1. Always use E.164 format: +14155552671 not (415) 555-2671
  2. Handle retries: Implement exponential backoff for failed calls
  3. Set appropriate timeouts: 30-45 seconds for most use cases
  4. Monitor webhooks: Track call progress asynchronously
  5. Test with test numbers: Use test destinations before production
  6. Limit call duration: Set max_duration to prevent runaway calls
  7. Use tags: Tag calls for easy tracking and filtering

Code Examples​

Node.js​

const axios = require('axios');

async function makeCall() {
try {
const response = await axios.post('https://api.audian.com:8443/v2/calls', {
from: '+14155552671',
to: '+14155552672',
call_control: {
on_answered: [
{
action: 'play_audio',
message: 'Hello! Thank you for calling.'
}
]
}
}, {
headers: {
'Authorization': `Bearer ${process.env.AUDIAN_API_KEY}`
}
});

console.log('Call created:', response.data.call_id);
} catch (error) {
console.error('Error creating call:', error.response?.data);
}
}

makeCall();

Python​

import requests
import os

def make_call():
url = 'https://api.audian.com:8443/v2/calls'
headers = {
'Authorization': f"Bearer {os.getenv('AUDIAN_API_KEY')}",
'Content-Type': 'application/json'
}
payload = {
'from': '+14155552671',
'to': '+14155552672',
'call_control': {
'on_answered': [
{
'action': 'play_audio',
'message': 'Hello! Thank you for calling.'
}
]
}
}

try:
response = requests.post(url, json=payload, headers=headers)
response.raise_for_status()
print(f"Call created: {response.json()['call_id']}")
except requests.exceptions.RequestException as e:
print(f"Error creating call: {e.response.json()}")

make_call()

Next Steps​