Skip to main content

Overview

The Calls API allows you to initiate outbound calls, create web call tokens, and access call logs and recordings.

List Calls

Get call logs with optional filtering.
curl -X GET "https://api.getsmartalex.com/v1/calls" \
  -H "Authorization: Bearer YOUR_API_KEY"

Query Parameters

ParameterTypeDescription
agent_idstringFilter by agent
campaign_idstringFilter by campaign
directionstringinbound, outbound, or web
statusstringcompleted, voicemail, no_answer, failed
sentimentstringpositive, neutral, negative
from_datestringStart date (ISO 8601)
to_datestringEnd date (ISO 8601)
pageintegerPage number
per_pageintegerItems per page

Response

{
  "data": [
    {
      "id": "call_abc123",
      "direction": "inbound",
      "agent_id": "agent_def456",
      "phone_number": "+15551234567",
      "contact": {
        "id": "contact_xyz789",
        "first_name": "John",
        "last_name": "Smith"
      },
      "status": "completed",
      "duration": 245,
      "sentiment": "positive",
      "cost": 0.45,
      "created_at": "2024-01-15T14:30:00Z"
    }
  ],
  "meta": {
    "total": 150,
    "page": 1,
    "per_page": 20
  }
}

Get Call

Retrieve detailed information about a specific call.
curl -X GET "https://api.getsmartalex.com/v1/calls/call_abc123" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

{
  "data": {
    "id": "call_abc123",
    "direction": "inbound",
    "agent_id": "agent_def456",
    "campaign_id": null,
    "phone_number": "+15551234567",
    "contact": {
      "id": "contact_xyz789",
      "first_name": "John",
      "last_name": "Smith",
      "email": "john@example.com"
    },
    "status": "completed",
    "duration": 245,
    "sentiment": "positive",
    "cost": 0.45,
    "recording_url": "https://recordings.getsmartalex.com/call_abc123.mp3",
    "transcript": [
      {
        "speaker": "agent",
        "text": "Hello, thank you for calling ABC Company. This is Alex, how can I help you today?",
        "timestamp": 0
      },
      {
        "speaker": "caller",
        "text": "Hi, I'd like to schedule an appointment.",
        "timestamp": 5
      }
    ],
    "summary": "Caller requested to schedule an appointment for next Tuesday at 2pm. Collected contact information and confirmed booking.",
    "created_at": "2024-01-15T14:30:00Z",
    "ended_at": "2024-01-15T14:34:05Z"
  }
}

Create Outbound Call

Initiate an outbound call to a phone number.
curl -X POST "https://api.getsmartalex.com/v1/calls" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "agent_def456",
    "phone_number": "+15551234567",
    "contact": {
      "first_name": "John",
      "last_name": "Smith"
    }
  }'

Parameters

ParameterTypeRequiredDescription
agent_idstringYesAgent to make the call
phone_numberstringYesNumber to call (E.164 format)
contactobjectNoContact information for personalization
contact.first_namestringNoContact first name
contact.last_namestringNoContact last name
metadataobjectNoCustom data to attach to call

Response

{
  "data": {
    "id": "call_new789",
    "direction": "outbound",
    "agent_id": "agent_def456",
    "phone_number": "+15551234567",
    "status": "initiating",
    "created_at": "2024-01-16T10:00:00Z"
  }
}

Create Web Call Token

Generate a token for initiating web-based calls (for widgets and embedded calling).
curl -X POST "https://api.getsmartalex.com/v1/calls/web-token" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "agent_def456",
    "expires_in": 3600
  }'

Parameters

ParameterTypeRequiredDescription
agent_idstringYesAgent to handle the call
expires_inintegerNoToken validity in seconds (default: 3600)
metadataobjectNoCustom data for the session

Response

{
  "data": {
    "token": "wct_eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "expires_at": "2024-01-16T11:00:00Z",
    "websocket_url": "wss://calls.getsmartalex.com/v1/connect"
  }
}

End Call

Terminate an active call.
curl -X POST "https://api.getsmartalex.com/v1/calls/call_abc123/end" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

{
  "data": {
    "id": "call_abc123",
    "status": "completed",
    "ended_at": "2024-01-16T10:05:00Z"
  }
}

Get Call Recording

Get the recording URL for a completed call.
curl -X GET "https://api.getsmartalex.com/v1/calls/call_abc123/recording" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

{
  "data": {
    "url": "https://recordings.getsmartalex.com/call_abc123.mp3",
    "duration": 245,
    "expires_at": "2024-01-16T12:00:00Z"
  }
}
Recording URLs are temporary and expire after 1 hour. Request a new URL if the previous one has expired.

Get Call Transcript

Get the full transcript for a completed call.
curl -X GET "https://api.getsmartalex.com/v1/calls/call_abc123/transcript" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

{
  "data": {
    "call_id": "call_abc123",
    "transcript": [
      {
        "speaker": "agent",
        "text": "Hello, thank you for calling ABC Company. This is Alex, how can I help you today?",
        "timestamp": 0
      },
      {
        "speaker": "caller",
        "text": "Hi, I'd like to schedule an appointment for next week.",
        "timestamp": 5
      },
      {
        "speaker": "agent",
        "text": "Of course! I'd be happy to help you schedule an appointment. What day works best for you?",
        "timestamp": 8
      }
    ],
    "summary": "Caller requested to schedule an appointment. Booked for Tuesday at 2pm."
  }
}

Call Status

StatusDescription
initiatingCall is being set up
ringingPhone is ringing
in_progressCall is connected and active
completedCall ended normally
voicemailReached voicemail
no_answerNo one answered
busyLine was busy
failedCall could not be completed

Error Codes

CodeDescription
call_not_foundCall ID doesn’t exist
agent_not_foundSpecified agent doesn’t exist
agent_not_readyAgent is not in ready status
invalid_phone_numberPhone number is invalid
no_available_slotsNo call slots available
recording_not_availableRecording doesn’t exist or has expired