This API will connect the two numbers given for the agent and customer. It will connect ‘From’ number first. Once the person at ‘From’ end picks up the phone, it will connect to the number provided in the ‘To’. You can choose which number to be connected first by giving that number in the ‘From’ field.

An HTTP POST request to https://<your_api_key>:<your_api_token>@<subdomain>/v1/Accounts/<your_sid>/Calls/connect has to be made

  • Replace <your_api_key> and <your_api_token> with the API key and token created by you.
  • Replace <your_sid> with your “Account sid”
  • Replace <subdomain> with the region of your account
    • <subdomain> of Singapore cluster is
    • <subdomain> of Mumbai cluster is

<your_api_key> , <your_api_token> and <your_sid> are available in the API settings page of your Exotel Dashboard

The following are the POST parameters:


The Agent phone # that will be called first
If mobile number, prefix the 10 digits with a 0; Ex:  09052161119.
If landline number, prefix it with STD code; Ex: 08030752400


Your customer's phone number.
If mobile number, prefix the 10 digits with a 0; Ex: 09052161119.
If landline number, prefix it with STD code; Ex: 08030752400


This is your Exotel Number (pick one from the 'Company Numbers' page)


"trans" - for Transactional Calls 
"promo" - for Promotional calls No longer supported by Exotel

The time limit (in seconds) that you want this call to last. The call will be cut after this time. (max. 14400 i.e. 4 hours)

The time (in seconds) to ring the called parties (both first and second call leg)


When the call completes, an HTTP POST will be made to the URL mentioned with the following four parameters:
CallSid - an alpha-numeric unique identifier
Status - One of: completed, failed, busy, no-answer.
RecordingUrl - link to the call recording (if it exists)
DateUpdated - time when the call state was updated last

MaxRetriesOptional    Number of times the call should be retried if we get failed or no-answer status from 1st leg.
(Default value: 3)

HTTP Response:

On success, 

  • the HTTP response status code will be 200
  • the HTTP body will contain an XML similar to the one below. The "Sid" is the unique identifier of the call and it will be useful to log this for future debugging purposes.
<?xml version="1.0" encoding="UTF-8"?>




  <DateCreated>2012-08-17 12:31:49</DateCreated>
  <DateUpdated>2012-08-17 12:31:49</DateUpdated>
  <StartTime>2012-08-17 12:31:49</StartTime>
  <EndTime>2012-08-17 12:32:57</EndTime>



On failure,

  • the HTTP response status code will be non-200.
  • the HTTP body will contain an XML (such as the one below) with details of why the request failed.

<Message>No matching results</Message>

Rate Limit:

This API is rate limited to 200 calls per minute. Once this limit has been crossed, your requests will be rejected with an HTTP 429 'Too Many Requests' code.

Sample PHP Code:

An example PHP code for this is available in Github 

Sample Ruby Code:

Sample code available at Github and Ruby Gem available at

Need a techie for this integration?
Check our Phone a Friend App