My App

POST /api/v1/make-call

Outbound call initiation with DNC compliance, wallet check, and number pool

Make Call

Initiates outbound phone calls via Telnyx — handles number resolution, DNC compliance, wallet balance check, number validation, and dynamic variable filling.

Volume: ~661K runs/week | Auth: None (internal service call)

Request

POST /api/v1/make-call
Content-Type: application/json

Body Parameters

FieldTypeRequiredDescription
location_idstringGHL location ID
assistant_idstringInternal assistant ID
contact_idstringGHL contact ID (to resolve phone)
phone_numberstringDirect phone number to call
number_poolstringNumber pool ID for caller ID rotation
workflow_idstringWorkflow ID
custom_onestringCustom variable 1
custom_twostringCustom variable 2
custom_threestringCustom variable 3
custom_fourstringCustom variable 4
custom_fivestringCustom variable 5

Responses

Success

{
  "status": "success",
  "call": {
    "call_id": "telnyx_call_uuid",
    "call_control_id": "control_uuid"
  },
  "from": "+15551234567",
  "to": "+15559876543"
}

No Access Token

{ "error": "No access token", "status": "failed" }

Assistant Not Found

{ "error": "Assistant not found", "status": "failed" }

No Phone Number

{ "error": "No phone number available", "status": "failed" }

DNC Blocked (Internal)

{ "error": "Number on internal DNC list", "status": "blocked" }

DNC Blocked (National)

{ "error": "Number on national DNC list", "status": "blocked" }

Wallet Depleted

{ "error": "Wallet depleted", "status": "blocked" }

Invalid Number

{ "error": "Invalid phone number", "status": "blocked" }

Test with cURL

curl -X POST http://localhost:3000/api/v1/make-call \
  -H "Content-Type: application/json" \
  -d '{
    "location_id": "loc_123",
    "assistant_id": "asst_456",
    "phone_number": "+15559876543"
  }'

With contact resolution

curl -X POST http://localhost:3000/api/v1/make-call \
  -H "Content-Type: application/json" \
  -d '{
    "location_id": "loc_123",
    "assistant_id": "asst_456",
    "contact_id": "contact_789",
    "number_pool": "pool_001",
    "custom_one": "Campaign A"
  }'

Pipeline Flow

  1. Rate limit check (non-blocking)
  2. Fetch SubAccount access token (Prisma)
  3. Parallel: validate assistant + fetch GHL contact
  4. Resolve phone number (direct or from contact)
  5. Number pool resolution (random from pool, or fallback to assistant's number)
  6. DNC compliance: internal DB (CrmContact.DO_NOT_CONTACT) + freednclist.com
  7. Wallet balance check (aggregate transactions, threshold: -$100)
  8. Number validation (api.assistable.ai)
  9. Voice variable filling
  10. SIP trunk lookup
  11. Initiate call via Telnyx
  12. Record call in DB

On this page