← Back to API Reference

Calls API

Initiate, manage, and monitor AI voice calls programmatically.

POST/calls/initiate

Initiate a Call

Start an AI-powered voice call to a specified phone number.

Request

javascript
const call = await client.calls.initiate({
to: '+1234567890',
agentId: 'agent-uuid',
metadata: {
customerId: 'cust_123',
campaign: 'summer-sale'
}
});

Parameters

ParameterTypeDescription
tostringPhone number in E.164 format
agentIdstringID of the AI agent to use
metadataobjectOptional custom metadata
GET/calls/:id

Get Call Details

Retrieve information about a specific call.

javascript
const call = await client.calls.get('call-uuid');
console.log(call.status); // 'in-progress' | 'completed' | 'failed'
console.log(call.duration); // Duration in seconds
POST/calls/:id/end

End a Call

Terminate an active call.

javascript
await client.calls.end('call-uuid');
GET/logs/:id

Get Call Transcript

Retrieve the transcript of a completed call.

javascript
const transcript = await client.calls.transcript('call-uuid');
console.log(transcript.messages); // Array of conversation messages