Skip to main content
The mycpaas Voice API lets you initiate outbound phone calls programmatically and control exactly what happens during each call using LaML XML documents. You can speak text, play audio, collect input, and receive real-time status updates via webhooks—all from a single API endpoint.

Make an outbound call

Send a POST request to the Calls resource to initiate an outbound call. mycpaas dials the destination number, then fetches the LaML XML document at the URL you provide to determine how the call is handled.

Required parameters

AccountSid
string
required
Your account SID. Found in the mycpaas dashboard. Included in the URL path.
To
string
required
The destination phone number to dial, in E.164 format (e.g. +491234567890).
From
string
required
Your mycpaas phone number to use as the caller ID, in E.164 format (e.g. +491098765432). The number must be active in your account.
Url
string
required
A publicly accessible URL that returns a LaML XML document. mycpaas fetches this URL once the call connects and follows the instructions in the document to control the call.

Optional parameters

StatusCallback
string
A URL that mycpaas sends a webhook POST request to when call status changes. Use this to track call progress in your application.
StatusCallbackEvent
string
A space-separated list of call events that trigger a webhook to StatusCallback. Defaults to completed if omitted. See the tip below for all available values.
StatusCallbackEvent accepts any combination of these values: initiated, ringing, answered, completed. For example, to receive a webhook at every stage of the call lifecycle, set StatusCallbackEvent to "initiated ringing answered completed".

Example request

Control the call with LaML XML

The Url parameter points to a LaML XML document that mycpaas fetches when the call connects. The document tells mycpaas what to do during the call—speak text, play audio, collect digits, and more. Your server must respond with a Content-Type of application/xml or text/xml.

Speak text with <Say>

Use <Say> to convert text to speech and play it to the caller.

Play an audio file with <Play>

Use <Play> to stream an audio file (MP3 or WAV) to the caller instead of synthesized speech.

Response fields

A successful POST returns HTTP 201 with a JSON object representing the created call.
sid
string
The unique identifier for this call (e.g. CAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx). Use this SID to look up or update the call later.
to
string
The destination phone number that was dialed.
from
string
The caller ID phone number used for this call.
status
string
The current status of the call. See the table below for all possible values.
direction
string
Indicates how the call was initiated. outbound-api for calls you create via the API; inbound for calls made to your mycpaas number.

Example response

Call status values

List and filter calls

Use GET on the Calls resource to retrieve a list of calls associated with your account. You can filter by status, direction, phone number, and paginate through large result sets.

Query parameters

Example: list recent calls

Example: filter calls to a specific number

Example response