ThunderPhone v3 is live.Self-serve, from 2¢/min.Read the announcement

Developer cookbook

Place outbound calls (API)

Trigger an AI-driven outbound call from your own code — survey, follow-up, or confirmation flows.

Outbound calling lets you hand a destination number and an agent configuration to ThunderPhone and have the AI place the call on your behalf. Typical use cases:

  • Appointment confirmations
  • Survey callbacks
  • "Second-try" follow-ups after a missed call
  • Dispatch-style notifications

Prerequisites

  1. Choose an outbound-enabled number

    Use a number you own through a VoIP connection, or request outbound calling for your ThunderPhone numbers on Phone & web (Zeus can ask the questions and send the request for you). ThunderPhone numbers start inbound-only. ThunderPhone reviews each request by hand and approves it only when every number you'll call belongs to someone who agreed to be called, or is a business landline. Once approved, those numbers can place calls up to the approved daily limit (resetting at 00:00 UTC) and run campaigns, and you can ask for a higher limit. Customer VoIP numbers need no approval, so we recommend them for outbound calling. Every outbound call counts toward one daily limit, from any carrier (100 calls a day to start), and an hourly limit. See Daily and hourly limits, Get a phone number and Bring your own numbers.

  2. Create an agent

    An outbound-flavoured prompt tends to start with the agent identifying itself and its purpose — "Hi, this is Acme calling to confirm your appointment for tomorrow at 3pm…" Set outbound_speak_order to agent_first (the default).

  3. Keep a positive balance

    Outbound calls return 402 Payment Required if balance is ≤ $0.00. Top up or turn on auto-recharge on Billing in the app. Your sk_live_ key can check the balance with GET /v1/billing but can't top up or change auto-reload.

Place a call with a saved agent

The simplest path — reference an agent by id:

curl -X POST https://api.thunderphone.com/v1/call \
  -H "Authorization: Bearer sk_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from_number": "+15551234567",
    "to_number":   "+14155552671",
    "agent_id":    12
  }'

Response:

{ "call_id": 987654321, "status": "initiated" }

Place a call with inline config

If you want a one-off prompt that isn't worth saving as an agent, pass config instead. The shape matches the response schema of the call.incoming webhook:

curl -X POST https://api.thunderphone.com/v1/call \
  -H "Authorization: Bearer sk_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from_number": "+15551234567",
    "to_number":   "+14155552671",
    "config": {
      "prompt":  "You are confirming Jane Doe appointment for 3pm tomorrow…",
      "voice":   "john",
      "product": "bolt"
    }
  }'

Control what happens after the last silence check-in

You can also pass the same silence final-action settings in inline config that saved agents use:

{
  "from_number": "+15551234567",
  "to_number": "+14155552671",
  "config": {
    "silence_final_action": "hang_up"
  }
}

Use silence_final_action to choose what happens after the last silence check-in. You can also pass silence_final_message, and when the final action is transfer, silence_transfer_destination.

Add a words list to inline config

Inline outbound calls can include the same words list as saved agents. Use this when you want the call to follow custom pronunciation or hearing rules without saving an agent first.

{
  "from_number": "+15551234567",
  "to_number": "+14155552671",
  "config": {
    "prompt": "You are confirming Jane Doe appointment for 3pm tomorrow…",
    "voice": "john",
    "product": "bolt",
    "words": []
  }
}

Set voice speed for this call

Inline config can include voice_speed to make the agent speak slower or faster on that call.

{
  "from_number": "+[REDACTED_PHONE]",
  "to_number": "+[REDACTED_PHONE]",
  "config": {
    "prompt": "[REDACTED_LITERAL]",
    "voice": "john",
    "product": "bolt",
    "voice_speed": 1.1
  }
}

Saved agents can also have a voice speed setting. If you set it on both the saved agent and the outbound call request, the per-call inline config value is used for that call.

Follow the call

A response with a queued_at time means ThunderPhone's outbound capacity is in use: the call dials when there is room, within 10 minutes, and ends with end_reason outbound_queue_timeout if there is none. You don't need to retry. See queued calls.

In parallel, subscribe to the telephony.complete webhook — the fastest way to know a call finished. You can also subscribe to call.status_changed for live progress updates such as dialing, answered, voicemail, and hold changes. If you can't accept inbound webhooks, poll GET /v1/calls/{call_id} every couple of seconds; the record includes end_reason, duration_seconds, and the recording URL once the call ends.

If your agent is set up to extract structured data after the call, that data is delivered separately after finalization completes.

If the person asks not to be called again, the agent ends the call and ThunderPhone adds the number to your opt-out list, so later calls to it are refused. See do-not-call.

Pass per-call variables to a saved agent

Saved agents can use placeholders like {{name}} or {{name|there}} in prompt text. When you place an outbound call with agent_id, pass variables with the values for that call:

{
  "from_number": "+15551234567",
  "to_number": "+14155552671",
  "agent_id": 12,
  "variables": {
    "name": "Jordan"
  }
}

Use string values keyed by placeholder name. These variables apply to saved agents; this guide's inline config example does not use them.

Failure modes worth handling

ErrorFix
402 Payment RequiredTop up the balance or enable auto-reload
400 with code: destination_not_allowedThunderPhone does not call that number: invalid numbers, emergency numbers, premium-rate numbers, short codes, sanctioned countries, a number on your opt-out list (contact_opted_out), or a US state your organization has blocked for outbound calling (state_blocked). From ThunderPhone numbers, ordinary US and Canadian numbers are allowed, and some international destinations are allowed and billed at the destination's rate. reason says which; see blocked destinations
409 with retryable: false for a ThunderPhone numberFollow the code: request outbound calling on Phone & web, wait for a pending review, use another eligible number, or clear a held-account pause on calls
429 with code: platform_outbound_daily_limit_reachedThe organization used today's outbound calls, from any carrier. Wait for resets_at (00:00 UTC) or request a higher limit on Phone & web
429 with code: outbound_hourly_limit_reachedThe organization used this hour's outbound calls. Wait for resets_at, or request a higher daily limit, which brings a higher hourly one
429 with code: concurrent_call_limit_reachedThe organization has as many calls in progress as its concurrent-call limit (20 by default, counting inbound, outbound, web and test calls). Retry after the Retry-After header's seconds or when a call ends; email support@thunderphone.com to raise the limit
429 with code: outbound_queue_fullThe organization has 50 queued calls waiting. Retry after the Retry-After header's seconds
429 with code: same_number_too_soonYou called the same to_number less than 10 seconds ago. Retry after the Retry-After header's seconds
409 with retryable: false for a customer VoIP numberCorrect the state named by code; for verification failures, run POST /v1/phone-numbers/{id}/verify-voip
409 idempotency conflictReuse the key only with the original normalized request, or send a new key
404 from_number is not registered to this organizationConfirm the from_number matches an active phone number in your organization. A number that is already provisioning, failed, releasing, or released also returns this response
500 with only a detail fieldNo outbound trunk is configured. Contact support; this is not a number-state problem you can correct
502 Bad GatewayTransient SIP / LiveKit failure; safe to retry

See the outbound calls reference for the complete stable eligibility-code list and both 409 response shapes. If an active number becomes ineligible after the request is accepted but before the call is placed, the final check returns the non-retryable 409 payload.

Controlling hold time

Outbound calls that run long because the callee is slow to respond (IVR trees, queues) can be capped with max_hold_seconds on the call, or by setting it on the saved agent:

{
  "from_number": "+15551234567",
  "to_number":   "+14155552671",
  "agent_id":    12,
  "max_hold_seconds": 120
}

The agent hangs up if no human audio has been received in the last N seconds. Default is 900 seconds (15 minutes).

If you set max_hold_seconds on both the saved agent and the outbound call request, the per-call value is used for that call.


Next steps