Guides
Make Your First Call
Make an AI-powered voice call in under 5 minutes using the Trunx API.
Place an outbound call with an AI agent that handles the entire conversation. You provide the prompt — the agent does the talking.
Get your API key
Create an API key from the dashboard with the voice:call scope.
export TRUNX_API_KEY="tk_live_..."Make a call
curl -X POST https://api.trunx.io/voice/call \
-H "Authorization: Bearer $TRUNX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "+14155551234",
"from": "415",
"agent_id": "american_female",
"prompt": "You are calling to confirm a dental appointment for tomorrow at 2pm. Be friendly and professional. If they want to reschedule, collect their preferred date and time."
}'const response = await fetch("https://api.trunx.io/voice/call", {
method: "POST",
headers: {
Authorization: "Bearer tk_live_...",
"Content-Type": "application/json",
},
body: JSON.stringify({
to: "+14155551234",
from: "415",
agent_id: "american_female",
prompt:
"You are calling to confirm a dental appointment for tomorrow at 2pm. Be friendly and professional. If they want to reschedule, collect their preferred date and time.",
}),
});
const call = await response.json();
console.log(call.id); // call_xyz789import requests
response = requests.post(
"https://api.trunx.io/voice/call",
headers={"Authorization": "Bearer tk_live_..."},
json={
"to": "+14155551234",
"from": "415",
"agent_id": "american_female",
"prompt": (
"You are calling to confirm a dental appointment for tomorrow at 2pm. "
"Be friendly and professional. If they want to reschedule, collect "
"their preferred date and time."
),
},
)
call = response.json()
print(call["id"]) # call_xyz789Response:
{
"id": "call_xyz789",
"to": "+14155551234",
"from": "+14155559876",
"status": "initiated",
"agent_id": "american_female",
"created_at": "2026-03-09T16:00:00.000Z"
}The Trunx voice AI handles the entire conversation. You provide the prompt — the agent does the talking.
Check the result
Once the call completes, retrieve the transcript and summary.
curl https://api.trunx.io/voice/calls/call_xyz789 \
-H "Authorization: Bearer $TRUNX_API_KEY"const result = await fetch("https://api.trunx.io/voice/calls/call_xyz789", {
headers: { Authorization: "Bearer tk_live_..." },
}).then((r) => r.json());
console.log(result.transcript);
console.log(result.summary);result = requests.get(
"https://api.trunx.io/voice/calls/call_xyz789",
headers={"Authorization": "Bearer tk_live_..."},
).json()
print(result["transcript"])
print(result["summary"])Listen to events
Stream real-time call events using Server-Sent Events (SSE).
curl -N https://api.trunx.io/events?channels=voice \
-H "Authorization: Bearer $TRUNX_API_KEY"Events you'll see:
event: voice.call.initiated
data: {"id":"call_xyz789","status":"initiated"}
event: voice.call.ringing
data: {"id":"call_xyz789","status":"ringing"}
event: voice.call.answered
data: {"id":"call_xyz789","status":"in_progress"}
event: voice.call.completed
data: {"id":"call_xyz789","status":"completed","duration":47}Pass Last-Event-ID to replay missed events after a disconnect.
Calls route through SIP trunk to PSTN. Trunx handles all routing automatically — you never need to configure trunks or dial plans.