DialAnyone API

Programmatic Voice & SMS Communication

The DialAnyone API allows you to programmatically make phone calls and send SMS messages using your DialAnyone phone numbers. This RESTful API uses API key authentication and returns JSON responses.

Overview

The DialAnyone API enables developers to integrate voice calling and SMS messaging into their applications. Our API uses a conference-style calling approach perfect for programmatic use - we ring your phone first, then connect to the target number.

Voice Calls

Make international calls programmatically with our conference-style approach.

SMS Messages

Send and receive SMS messages with webhook notifications.

Base URL

https://dialanyone.com/api/v1

Authentication

All API requests must include your API key in the Authorization header. You can create and manage API keys in your dashboard.

Authentication Header
Authorization: Bearer dk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Security Note

Keep your API keys secure and never expose them in client-side code. Store them as environment variables in your server applications.

Rate Limiting

API requests are rate-limited to ensure fair usage:

100
Calls per minute
1,000
SMS per minute
10,000
Total per hour

Rate limit information is included in response headers:

  • X-RateLimit-Limit - Maximum requests allowed
  • X-RateLimit-Remaining - Requests remaining
  • X-RateLimit-Reset - Unix timestamp when limit resets

Get User Information

Get your account information including credit balance and available phone numbers.

GET /api/v1/me

Response

JSON Response (200 OK)
{
  "email": "user@example.com",
  "user": {
    "id": "user_abc123",
    "email": "user@example.com",
    "credits_balance": 1250.75
  },
  "phone_numbers": {
    "purchased": [
      {
        "id": "pn_def456",
        "number": "+14155551234",
        "capabilities": ["voice", "sms"],
        "created_at": "2024-01-01T12:00:00Z"
      }
    ],
    "ported": [
      {
        "id": "pn_ghi789",
        "number": "+14155555678",
        "capabilities": ["voice", "sms"],
        "created_at": "2024-01-01T14:00:00Z"
      }
    ],
    "outgoing_only": []
  },
  "totals": {
    "total_numbers": 2,
    "purchased_count": 1,
    "ported_count": 1,
    "outgoing_only_count": 0
  }
}

Phone Number Types

purchased: Numbers bought through DialAnyone

ported: Numbers transferred from another provider

outgoing_only: Numbers for outbound calls only

Make a Call

Initiate a conference call by first ringing the user number, then connecting to the target number. This approach works perfectly for API usage where no browser interface is available. You'll be billed for both numbers being called.

POST /api/v1/calls

Request Body

JSON Request
{
  "user_number": "+14155551234",
  "target_number": "+14155555678"
}

Response

JSON Response (201 Created)
{
  "call_id": "call_abc123def456",
  "status": "initiating",
  "user_number": "+14155551234",
  "target_number": "+14155555678",
  "estimated_cost_per_minute": 5.0,
  "created_at": "2024-01-01T12:00:00Z"
}

Error Responses

Insufficient Credits (402)
{
  "error": {
    "code": "insufficient_credits",
    "message": "Your account does not have enough credits to complete this operation",
    "details": {
      "required_credits": 50,
      "current_balance": 10
    }
  }
}

Send SMS

Send SMS messages from your DialAnyone phone numbers with automatic credit deduction.

POST /api/v1/sms

Request Body

JSON Request
{
  "from": "+14155551234",
  "to": "+14155555678",
  "body": "Hello from DialAnyone API!"
}

Response

JSON Response (201 Created)
{
  "message_id": "msg_xyz789abc123",
  "status": "sent",
  "from": "+14155551234",
  "to": "+14155555678",
  "segments": 1,
  "estimated_cost": 2.5,
  "created_at": "2024-01-01T12:00:00Z"
}

Webhooks

Configure webhook URLs in your API key settings to receive real-time notifications for incoming calls and SMS messages.

Webhook Configuration

You can configure separate webhook URLs for different event types:

  • Call Webhook URL: Receives incoming call notifications
  • SMS Webhook URL: Receives incoming SMS notifications
  • Legacy Webhook URL: For backward compatibility (receives both types)

Webhook Security

All webhooks include an X-DialAnyone-Signature header with an HMAC-SHA256 signature:

Webhook Verification (Python)
import hmac
import hashlib

def verify_webhook(body, signature, secret):
    expected = hmac.new(
        secret.encode(),
        body.encode(),
        hashlib.sha256
    ).hexdigest()
    return hmac.compare_digest(expected, signature)

Incoming Call Notification

Webhook Payload
{
  "event": "incoming_call",
  "call_id": "call_abc123def456",
  "from": "+14155555678",
  "to": "+14155551234",
  "timestamp": "2024-01-01T12:00:00Z"
}

Incoming SMS Notification

Webhook Payload
{
  "event": "incoming_sms",
  "message_id": "msg_xyz789abc123",
  "from": "+14155555678",
  "to": "+14155551234",
  "body": "Reply message text",
  "timestamp": "2024-01-01T12:00:00Z"
}

Webhook Subscriptions

Webhook subscriptions allow you to programmatically register webhook URLs to receive real-time notifications for incoming calls and SMS messages. Perfect for Zapier, Make.com, and other integration platforms.

Real-time Testing Included

Every webhook subscription automatically tests delivery to verify your endpoint is working correctly.

Subscribe to Webhook Events

Register a webhook URL to receive notifications for specific event types. Your webhook will be tested immediately to ensure it's working.

POST /api/v1/webhooks/subscribe

Request Body

JSON Request
{
  "webhook_url": "https://your-app.com/webhooks/dialanyone",
  "event_types": ["incoming_call", "incoming_sms"]
}

Optional Fields:webhook_secret can be included for HMAC signature verification, but it's not required for Zapier and most integration platforms.

Response with Real-time Test Results

JSON Response (201 Created)
{
  "success": true,
  "subscription": {
    "webhook_url": "https://your-app.com/webhooks/dialanyone",
    "event_types": ["incoming_call", "incoming_sms"],
    "created_at": "2024-01-01T12:00:00Z",
    "test_delivery_status": "success"
  },
  "test_results": {
    "call_test": {
      "success": true
    },
    "sms_test": {
      "success": true
    }
  }
}

Automatic Testing: When you subscribe, we immediately send test events to your webhook URL. If the tests fail, check your endpoint and use the dedicated test endpoint below.

List Active Subscriptions

Get all webhook subscriptions for your API key.

GET /api/v1/webhooks/subscriptions

Response

JSON Response (200 OK)
{
  "success": true,
  "subscriptions": {
    "call_webhook_url": "https://your-app.com/webhooks/calls",
    "sms_webhook_url": "https://your-app.com/webhooks/sms",
    "call_webhook_secret": "secret_for_calls",
    "sms_webhook_secret": "secret_for_sms"
  },
  "totals": {
    "total_subscriptions": 2,
    "has_call_webhook": true,
    "has_sms_webhook": true
  }
}

Test Webhook Delivery

Manually test webhook delivery to verify your endpoint is working correctly.

POST /api/v1/webhooks/test

Request Body

JSON Request
{
  "webhook_url": "https://your-app.com/webhooks/dialanyone",
  "event_types": ["incoming_call", "incoming_sms"]
}

Response

JSON Response (200 OK)
{
  "success": true,
  "webhook_url": "https://your-app.com/webhooks/dialanyone",
  "event_types": ["incoming_call", "incoming_sms"],
  "overall_success": true,
  "message": "All webhook tests completed successfully",
  "test_results": {
    "call_test": {
      "success": true
    },
    "sms_test": {
      "success": true
    }
  }
}

Use this endpoint to: Debug webhook issues, test new endpoints before subscribing, or verify that your webhook handling is working correctly.

Unsubscribe from Webhook Events

Remove a webhook subscription for specific event types or all events.

DELETE /api/v1/webhooks/unsubscribe

Request Body

JSON Request
{
  "webhook_url": "https://your-app.com/webhooks/dialanyone",
  "event_types": ["incoming_call", "incoming_sms"]
}

Note: If event_types is omitted, the webhook will be unsubscribed from all event types.

Response

JSON Response (200 OK)
{
  "success": true,
  "message": "Webhook subscription removed successfully",
  "removed_subscription": {
    "webhook_url": "https://your-app.com/webhooks/dialanyone",
    "event_types": ["incoming_sms"],
    "created_at": "2024-01-01T12:00:00Z"
  }
}

Webhook Event Payload

All subscription webhooks receive events in a standardized format:

Incoming Call Event

Webhook Payload
{
  "event_type": "incoming_call",
  "event_id": "evt_1640995200_abc123def",
  "timestamp": "2024-01-01T12:00:00Z",
  "data": {
    "event": "incoming_call",
    "call_id": "call_abc123def456",
    "from": "+14155555678",
    "to": "+14155551234",
    "timestamp": "2024-01-01T12:00:00Z"
  }
}

Incoming SMS Event

Webhook Payload
{
  "event_type": "incoming_sms",
  "event_id": "evt_1640995260_xyz789abc",
  "timestamp": "2024-01-01T12:01:00Z",
  "data": {
    "event": "incoming_sms",
    "message_id": "msg_xyz789abc123",
    "from": "+14155555678",
    "to": "+14155551234",
    "body": "Hello from integration platform!",
    "timestamp": "2024-01-01T12:01:00Z"
  }
}

Event Types

incoming_call

Triggered when someone calls one of your DialAnyone phone numbers

incoming_sms

Triggered when someone sends an SMS to one of your DialAnyone phone numbers

Zapier Integration Example

Here's how to set up DialAnyone webhooks with Zapier using REST Hook triggers:

✨ Perfect for Zapier

Our webhook subscription API is designed specifically for integration platforms like Zapier that use REST Hook triggers.

Step 1: Zapier REST Hook Configuration

Zapier REST Hook Trigger Setup
// In your Zapier app's trigger configuration:

const subscribeHook = async (z, bundle) => {
  const response = await z.request({
    url: 'https://dialanyone.com/api/v1/webhooks/subscribe',
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${bundle.authData.api_key}`,
      'Content-Type': 'application/json'
    },
    body: {
      webhook_url: bundle.targetUrl,
      event_types: ['incoming_call', 'incoming_sms']
    }
  });
  
  return response.data;
};

const unsubscribeHook = async (z, bundle) => {
  await z.request({
    url: 'https://dialanyone.com/api/v1/webhooks/unsubscribe', 
    method: 'DELETE',
    headers: {
      'Authorization': `Bearer ${bundle.authData.api_key}`,
      'Content-Type': 'application/json'
    },
    body: {
      webhook_url: bundle.targetUrl,
      event_types: ['incoming_call', 'incoming_sms']
    }
  });
  
  return {};
};

Step 2: Handle Webhook Data

Zapier Data Processing
// Process incoming webhook data in your Zapier trigger:

const parseWebhook = (z, bundle) => {
  const webhook = bundle.cleanedRequest;
  
  // Extract data based on event type
  if (webhook.event_type === 'incoming_call') {
    return [{
      id: webhook.data.call_id,
      caller: webhook.data.from,
      called_number: webhook.data.to,
      timestamp: webhook.timestamp,
      event_type: 'call'
    }];
  }
  
  if (webhook.event_type === 'incoming_sms') {
    return [{
      id: webhook.data.message_id,
      from: webhook.data.from,
      to: webhook.data.to,
      message: webhook.data.body,
      timestamp: webhook.timestamp,
      event_type: 'sms'
    }];
  }
  
  return [];
};

Integration Platform Usage

Webhook subscriptions are designed for integration platforms that need to dynamically register and manage webhook endpoints. Each subscription is tied to your API key and will receive events for phone numbers associated with your account.

Code Examples

Node.js

Node.js Example
const axios = require('axios');

const client = axios.create({
  baseURL: 'https://dialanyone.com/api/v1',
  headers: {
    'Authorization': 'Bearer dk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    'Content-Type': 'application/json'
  }
});

// Get user information
async function getUserInfo() {
  try {
    const response = await client.get('/me');
    console.log('User info:', response.data);
    console.log('Credit balance:', response.data.user.credits_balance);
    console.log('Phone numbers:', response.data.phone_numbers);
  } catch (error) {
    console.error('Error:', error.response.data);
  }
}

// Make a call
async function makeCall(userNumber, targetNumber) {
  try {
    const response = await client.post('/calls', {
      user_number: userNumber,
      target_number: targetNumber
    });
    console.log('Call initiated:', response.data.call_id);
  } catch (error) {
    console.error('Error:', error.response.data);
  }
}

// Send SMS
async function sendSMS(from, to, body) {
  try {
    const response = await client.post('/sms', {
      from: from,
      to: to,
      body: body
    });
    console.log('SMS sent:', response.data.message_id);
  } catch (error) {
    console.error('Error:', error.response.data);
  }
}

Python

Python Example
import requests

class DialAnyoneClient:
    def __init__(self, api_key):
        self.base_url = 'https://dialanyone.com/api/v1'
        self.headers = {
            'Authorization': f'Bearer {api_key}',
            'Content-Type': 'application/json'
        }
    
    def get_user_info(self):
        response = requests.get(
            f'{self.base_url}/me',
            headers=self.headers
        )
        response.raise_for_status()
        return response.json()
    
    def make_call(self, user_number, target_number):
        response = requests.post(
            f'{self.base_url}/calls',
            json={
                'user_number': user_number,
                'target_number': target_number
            },
            headers=self.headers
        )
        response.raise_for_status()
        return response.json()
    
    def send_sms(self, from_number, to_number, body):
        response = requests.post(
            f'{self.base_url}/sms',
            json={
                'from': from_number,
                'to': to_number,
                'body': body
            },
            headers=self.headers
        )
        response.raise_for_status()
        return response.json()

# Usage
client = DialAnyoneClient('dk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')

# Get user info
user_info = client.get_user_info()
print(f"Credit balance: {user_info['user']['credits_balance']}")

# Make a call
call = client.make_call('+14155551234', '+14155555678')
print(f"Call ID: {call['call_id']}")

cURL

cURL Examples
# Get user information
curl -X GET https://dialanyone.com/api/v1/me \
  -H "Authorization: Bearer dk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

# Make a call
curl -X POST https://dialanyone.com/api/v1/calls \
  -H "Authorization: Bearer dk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "user_number": "+14155551234",
    "target_number": "+14155555678"
  }'

# Send SMS
curl -X POST https://dialanyone.com/api/v1/sms \
  -H "Authorization: Bearer dk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "+14155551234",
    "to": "+14155555678",
    "body": "Hello from DialAnyone API!"
  }'

Best Practices

Store API keys securely

Never commit API keys to version control. Use environment variables in your server applications.

Implement webhook verification

Always verify webhook signatures to ensure requests are authentic.

Handle rate limits gracefully

Implement exponential backoff and respect rate limit headers.

Validate phone numbers

Ensure phone numbers are in E.164 format before sending requests.

Monitor your credit balance

Set up low balance alerts to avoid service interruptions.

Need Help?

Our support team is here to help you integrate the DialAnyone API.