This API allows you to get the details of all the calls of a Campaign. It's like a summary page or Inbox per campaign.
The call level data consists of Name (if saved in Contacts), Number, Duration, Date Created, Status, Digits, Recording URL, Start Time, End Time, Caller ID, Direction & CallSid
https://<your_api_key>:<your_api_token><subdomain>/v2/accounts/<your_sid>/campaign/<campaign_id>/call-details
This API supports JSON response only
<your_api_key>
and <your_api_token>
with the API key and token created by you.<your_sid>
with your “Account sid”<subdomain>
with the region of your account
<your_api_key>
, <your_api_token>
and <your_sid>
are available in the API settings page of your Exotel Dashboard
The following are the Query parameters:
Parameter Name | Mandatory/Optional | Value |
offset |
optional |
This is the position in the dataset of a particular record. By specifying offset, you retrieve a subset of records starting with the offset value. Offset is zero-based i.e. the 10th record is at offset 9 |
limit |
optional |
number of records on single page default:20 |
status |
optional |
completed, failed, busy, no-answer |
sort_by |
optional |
Date_created:asc, date_created:desc |
curl https://<your_api_key>:<your_api_token><subdomain>/v2/accounts/<your_sid>/campaigns/call-details?status=no-answer,failed&sort_by=date_created:desc&limit=3&offset=0
var request = require("request"); var accountSid = "XXXXXXXXX"; var accountToken = "YYYYYYYYY"; var authKey = "ZZZZZZZZZZ"; var encoding = Buffer.from(authKey + ':' + accountToken).toString('base64') var options = { method: 'GET', url: 'https://api.exotel.com/v2/accounts/'+ accountSid +'/campaigns/491dd6c97d64475ba0ce346a18530ce5/call-details?status=no-answer,failed&sort_by=date_created:desc&limit=3&offset=0', headers: { Authorization: 'Basic ' + encoding } }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
<?php $curl = curl_init(); $accountSid = "XXXXXXXXXX"; $accountToken = "YYYYYYYYYY"; $authKey = "ZZZZZZZZZZ"; $encoding = base64_encode($authKey .":". $accountToken); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.exotel.com/v2/accounts/".$accountSid."/campaigns/491dd6c97d64475ba0ce346a18530ce5/call-details?status=no-answer,failed&sort_by=date_created:desc&limit=3&offset=0", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_POSTFIELDS => "", CURLOPT_HTTPHEADER => array( "Authorization: Basic ".$encoding ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }
import requests, base64, json accountSid = "XXXXXXXXX" authToken = "YYYYYYYYY" authKey = "ZZZZZZZZZZ" encoding = base64.b64encode(authKey + ":" + authToken) url = "https://api.exotel.com/v2/accounts/"+ accountSid +"/campaigns/491dd6c97d64475ba0ce346a18530ce5/call-details?status=no-answer,failed&sort_by=date_created:desc&limit=3&offset=0" payload = "" headers = { 'Authorization': "Basic " + encoding } response = requests.request("DELETE", url, data=payload, headers=headers) print(response.text) print(json.dumps(json.loads(response.text), indent = 4, sort_keys = True))
package main import ( b64 "encoding/base64" "fmt" "io/ioutil" "net/http" ) func main() { // Please provide accountSid, authToken from your Exotel account accountSid := "XXXXXXXXX" authToken := "YYYYYYYY" authKey := "ZZZZZZZZZZ" // Encoding the accountSid and authToken, used in Authorization header encoding := b64.StdEncoding.EncodeToString([]byte(authKey + ":" + authToken)) url := "https://api.exotel.com/v2/accounts/" + accountSid + "/campaigns/491dd6c97d64475ba0ce346a18530ce5/call-details?status=no-answer,failed&sort_by=date_created:desc&limit=3&offset=0" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Basic "+encoding) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) }
{ "request_id": "a0e05cd2d3b8419caba589b5278269c3", "method": "GET", "http_code": 200, "metadata": { "count": 3, "offset": 0, "total": 19, "limit": 3 }, "response": [ { "code": 200, "error_data": null, "status": "success", "data": { "number": "+919449141947", "name": "NA", "duration": 3, "date_created": "2021-07-11T12:08:01+05:30", "status": "failed", "digit": null, "recording_url": "", "start_time": "2021-07-11T12:08:00+05:30", "end_time": "2021-07-11T12:08:00+05:30", "caller_id": "08088919888", "direction": "Outgoing", "call_sid": "e03f3cf9b27cea6108d1195c5753157b" } }, { "code": 200, "error_data": null, "status": "success", "data": { "number": "+919946986806", "name": "NA", "duration": 51, "date_created": "2021-07-11T12:08:01+05:30", "status": "no-answer", "digit": null, "recording_url": "", "start_time": "2021-07-11T12:08:00+05:30", "end_time": "2021-07-11T12:08:00+05:30", "caller_id": "08088919888", "direction": "Outgoing", "call_sid": "f93248f8e1a8e8b28b649ad5150a157b" } }, { "code": 200, "error_data": null, "status": "success", "data": { "number": "+919310398307", "name": "NA", "duration": 18, "date_created": "2021-07-11T12:08:01+05:30", "status": "failed", "digit": null, "recording_url": "", "start_time": "2021-07-11T12:08:00+05:30", "end_time": "2021-07-11T12:08:00+05:30", "caller_id": "08088919888", "direction": "Outgoing", "call_sid": "71ff290dc61eb39518af202ce37f157b" } } ] }