Open in
Handle inbound calls (API)
End-to-end: configure an agent, assign it to a phone number, take a call, and inspect the transcript.
The canonical "answer a phone with an AI" flow, from your terminal. You'll:
- Create an agent with a prompt and voice.
- Provision (or bring) a phone number and assign the agent as its inbound handler.
- Call the number. Observe the call log, transcript, and recording.
Total API calls: four. Total time: under five minutes.
1. Create an agent
An agent bundles the prompt, voice, and product tier that will drive
the call. You can also set call limits such as max_call_duration_seconds
and ring_duration_seconds on the agent. For outbound calls, you can also set
max_hold_seconds to limit how long the agent waits on hold before ending the
call. Agents also support audio_tier, endpointing, intelligence,
speech_detection, and voice_speed to control how they listen and reply:
intelligence is core or pro, audio_tier (Hearing) is lite, standard, plus or max
(Max is not generally available), speech_detection is standard or
enhanced, and voice_speed is from 0.8 to 1.3 with 1.0 as the normal
pace. The older values (lite and standard for
intelligence; lean, hearing and deep_hearing for hearing) are still
accepted. Full duplex agents keep the same voice across supported languages,
so per-language voice switching does not apply on those calls. Agents also
support an intro_clip and intro_ring_count to play a prerecorded intro and
up to two rings before the agent speaks. New agents also need a time zone. If
your agent is multilingual, you can set language_switching to control
whether it asks before switching languages or follows the caller's language.
You can also set words on the agent to control how it says specific terms
and which terms it listens for.
See Agents for every configuration field; the
minimum is:
curl -X POST https://api.thunderphone.com/v1/agents \
-H "Authorization: Bearer sk_live_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Acme Support",
"prompt": "You are a friendly support agent for Acme. Help callers with orders and returns. Keep answers short.",
"voice": "john",
"product": "bolt"
}'Save the returned id — you'll need it in step 2.
2. Get a phone number
If you just need something to dial against, get a ThunderPhone number from ThunderPhone's pool:
curl -X POST https://api.thunderphone.com/v1/phone-numbers \
-H "Authorization: Bearer sk_live_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"area_code": "415"}'ThunderPhone sells numbers in supported countries. The first month and the one-time setup fee are
paid from your balance (free call credit can cover your first number, released after 7
days unless you add funds), so the request returns 402 until the
balance can pay for it. The response includes an id and
a number in E.164. ThunderPhone
numbers start in status="provisioning" and become active within a few
seconds — poll
GET /v1/phone-numbers/{id}
to watch the transition if you care.
3. Assign the agent
Associate the agent from step 1 with the number's inbound direction:
curl -X PATCH https://api.thunderphone.com/v1/phone-numbers/{phone_id} \
-H "Authorization: Bearer sk_live_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"inbound_agent_id": 12}'That's it — the number is live. After outbound calling is approved for your
organization, you can also set outbound_agent_id in the same PATCH. Until
then, the API rejects that assignment with 400.
If you route inbound calls through a config webhook instead of a fixed
inbound_agent_id, that webhook can return a per-call timezone along
with agent_id, variables, and overrides. Use overrides to change
supported agent settings for that call only, such as the voice. The API
still accepts the older eagerness name as an alias for endpointing.
If your agent uses API connections with trigger="call_start",
ThunderPhone can run those tools once at the start of each phone call, before
the greeting, using their saved call_start_arguments. Agents can also name one of their own custom HTTP tools in end_of_call_tool to run after each call ends. Agents also support the built-in stop_silence_checkins system tool, which can stop silence check-ins for the rest of a call when your prompt uses it. If your agent takes messages, make sure something delivers them after the call, such as email, SMS, a webhook, or a tool.
If your agent is flagged for collecting verification codes for another service, ThunderPhone refuses the change unless your account has a payment method on file or staff has allowed it. Verifying your business's own account on its own line is allowed once your account has a payment method on file.
Callbacks to your outbound calls
When someone calls back a number that called them in the last 30
days, the answering agent gets a short background note on that call:
when it was made, by which agent and what happened (no answer,
voicemail or a conversation). A number with no inbound agent sends
the same details to your config webhook as returning_call. If that
number has no webhook, or the webhook times out or cannot be reached,
the call goes to the agent that placed the earlier call instead of
ending. Caller ID can be faked, so the earlier call's summary and
variables are shared only if an admin turns on Details for returning
callers (Settings → All settings → Privacy & data). See
Callbacks.
4. Take a call
Dial the number from your phone. The agent picks up, introduces itself per your prompt, and the conversation begins.
While the call is in flight, it appears in
GET /v1/calls with
status="in_progress". When it ends, the record updates with
end_reason, duration_seconds, billable_minutes, and (eventually)
a recording URL and AI grade.
Inbound calls count toward your organization's
concurrent-call limit (20
calls in progress by default, shared with outbound, web and test
calls). A call that arrives at the limit is refused before the agent
answers and hung up, is not billed, and is recorded as a failed call
with end reason concurrent_call_limit_reached. Email support@thunderphone.com if you
need a higher limit.
5. Inspect the results
Fetch the list of recent calls:
curl 'https://api.thunderphone.com/v1/calls?limit=5' \
-H "Authorization: Bearer sk_live_YOUR_API_KEY"Grab the transcript:
curl https://api.thunderphone.com/v1/calls/{call_id}/transcript \
-H "Authorization: Bearer sk_live_YOUR_API_KEY"And the recording URL (short-lived, signed):
curl https://api.thunderphone.com/v1/calls/{call_id}/audio \
-H "Authorization: Bearer sk_live_YOUR_API_KEY"If you subscribed to the
telephony.complete webhook
you'll receive the same data as a POST to your server — see
call.complete.
If your agent has extraction fields configured, the completed call payload can also include structured extracted data. Call summaries are written in the language your organization uses in ThunderPhone, unless the agent overrides that setting.
Next steps
Pick a different agent per caller based on the phone number or custom logic in a webhook.
Let the agent call your APIs mid-conversation.
Route callers directly or screen the destination before connecting them.
Stream each finished call to your CRM / analytics pipeline.
Score every call automatically and route flagged ones for review.