Skip to main content

Call Legs (Beta)

note

To enable this API in your account, please reach out to hello@exotel.com.

To get the different call legs associated with a call, make an HTTP GET request to the endpoint below.

Endpoint​

GET /v3/accounts/<your_sid>/calls/<call_sid>/legs

Regional URLs​

RegionURL
Singaporehttps://<your_api_key>:<your_api_token>@ccm-api.exotel.com/v3/accounts/<your_sid>/calls/<call_sid>/legs
Mumbaihttps://<your_api_key>:<your_api_token>@ccm-api.in.exotel.com/v3/accounts/<your_sid>/calls/<call_sid>/legs

Path Parameters​

  • Replace <your_api_key> and <your_api_token> with the API key and token created by you or use Basic Authentication.
  • Replace <your_sid> with your Account SID.
  • <subdomain> of Singapore cluster is @ccm-api.exotel.com; Mumbai cluster is @ccm-api.in.exotel.com.
  • Replace <call_sid> with the Call SID provided during the Click to Call API request.
  • <your_api_key>, <your_api_token>, and <your_sid> are available in the API settings page of your Exotel Dashboard.

Code Example​

curl -X GET \
'https://<your_api_key>@ccm-api.exotel.com/v3/accounts/<your_sid>/calls/<call_sid>/legs' \
-H 'content-type: application/json'

HTTP Response​

On success, the HTTP response status code will be 200.

Response Parameter Description​

Parameter NameType & Value
request_idUnique ID of the request. Useful for debugging and tracing.
methodHTTP method for the request (GET/POST/PUT etc.)
http_codeHTTP code for the request (200, 400, 500 etc.)
responseResponse block containing leg details for the call SID passed in the path parameter. Contains: code, error_data, status, leg_details

Parameters under leg_details block​

Parameter NameDescription
sidstring; an alpha-numeric unique identifier of the call
fromArray of JSON blocks containing information about the from leg. For outgoing calls, this contains all the user call leg(s) information. For incoming calls, this contains the customer call leg information. Each block contains: sid, name, contact_uri, date_created, date_updated, status
toArray of JSON blocks containing information about the to leg. For outgoing calls, this contains the customer call leg information. For incoming calls, this contains all the user call leg(s) information. Each block contains: sid, name, contact_uri, date_created, date_updated, status, group_id, group_name

From / To leg fields​

FieldDescription
sidstring; alpha-numeric unique identifier of the leg
namestring; name of the user (can be null if not an agent)
contact_uristring; contact number associated with the leg
date_createdstring; date and time when this leg was created
date_updatedstring; date and time when this leg was last updated
statusstring; in-progress / completed / failed / no-answer
group_idAssociated group ID for the user (if applicable). Only in to leg.
group_nameAssociated group name for the user (if applicable). Only in to leg.

Example Response​

{
"request_id": "faf6d9fd87eb4dd6aef3967c40e369ed",
"method": "GET",
"http_code": 200,
"metadata": null,
"response": {
"code": 200,
"error_data": null,
"status": "success",
"leg_details": {
"call_sid": "f1ca1057692d586b23b4e7ffcc3216mk",
"account_sid": "exotel",
"from": [
{
"sid": "213f2560d153d744cd61eb81a98616ak",
"name": "Aditya Sharma",
"contact_uri": "0987xxxxxxx",
"date_created": "2020-09-15 11:01:20+05:30",
"date_updated": "2020-09-15 11:02:20+05:30",
"status": "completed"
},
{
"sid": "813f2660d153d744cd61eb81a98616ak",
"name": null,
"contact_uri": "09976xxxxxx",
"date_created": "2020-09-15 11:03:20+05:30",
"date_updated": "2020-09-15 11:04:20+05:30",
"status": "completed"
}
],
"to": [
{
"sid": "913f2760d153d744cd61eb81a98616ak",
"name": "Customer",
"contact_uri": "09988xxxxxx",
"date_created": "2020-09-15 11:01:25+05:30",
"date_updated": "2020-09-15 11:04:20+05:30",
"status": "completed",
"group_id": null,
"group_name": null
}
]
}
}
}

Error Scenarios​

HTTP CodeError CodeDescription
4011010Authentication failed
4041017Tenant not found
40410744Call not found
42910724Too many requests
50010715Error retrieving leg details
50010743Legs not found
note

These error codes will be populated under the error_data block of the response.

Try It​