To get the details of a specific campaign in your account, make an HTTP GET request to:

GET

https://<your_api_key>:<your_api_token><subdomain>/v2/accounts/<your_sid>/campaigns/<id>

Replace <your_api_key> and <your_api_token> with the API key and token created by you. Similarly, replace <your_sid> with your “Account sid” value. These values are available in the API settings page of your Exotel Dashboard. Replace <id> with the campaign id.

curl -X GET https://<your_api_key>:<your_api_token><subdomain>/v2/accounts/<your_sid>/campaigns/<id>
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',
  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",
  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"

payload = ""
headers = {
    'Authorization': "Basic " + encoding
    }

response = requests.request("GET", 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"

	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))
}

HTTP Response:

  • On success, the HTTP response status code will be 200
  • HTTP body will contain an JSON similar to the one below
  • Response parameters are described above
{
    "request_id": "c4af89edd51e4b359365dd7909d16061",
    "method": "GET",
    "http_code": 200,
    "response": [
        {
            "code": 200,
            "error_data": null,
            "status": "success",
            "data": {
                "id": "2832361b93e2b0b0ee0a3fe9961f10631579",
                "account_sid": "Exotel",
                "name": "campaigns_bulk",
                "type": "trans",
                "from": [
                    "+917987616844",
                    "+917987616844",
                    "+917987616844",
                    "+917987616844",
                    "+917987616844"
                ],
                "caller_id": "8088919888",
                "url": "http://my.exotel.com/Exotel/exoml/start_voice/305925",
                "retries": {
                    "number_of_retries": 1,
                    "interval_mins": 15,
                    "mechanism": "Exponential",
                    "on_status": [
                        "busy",
                        "no-answer",
                        "failed"
                    ]
                },
                "schedule": {
                    "send_at": "2021-07-09T01:49:03+05:30",
                    "end_at": "2021-08-08T01:49:03+05:30"
                },
                "status_callback": "https://webhook.site/a5b59df3-c1b6-4a93-aa1a-75f2c8a3721c",
                "call_status_callback": "https://webhook.site/a5b59df3-c1b6-4a93-aa1a-75f2c8a3721c",
                "call_schedule_callback": "https://webhook.site/a5b59df3-c1b6-4a93-aa1a-75f2c8a3721c",
                "date_created": "2021-07-09T01:48:03+05:30",
                "date_updated": "2021-07-09T09:55:17+05:30",
                "status": "Completed",
                "report_url": "https://campaigns-reports.s3.ap-southeast-1.amazonaws.com/2832361b93e2b0b0ee0a3fe9961f10631579.csv",
                "call_status_callback_params": null,
                "call_duplicate_numbers": true,
                "stats": {
                    "created": 0,
                    "in-progress": 0,
                    "retry": 0,
                    "retrying": 0,
                    "failed": 2,
                    "failed-dnd": 0,
                    "invalid": 0,
                    "paused": 0,
                    "failed-no-attempt": 0,
                    "completed": 3
                }
            },
            "summary": {
                "campaign_sid": "2832361b93e2b0b0ee0a3fe9961f10631579",
                "call_scheduled": 0,
                "call_initialized": 8,
                "call_completed": 3,
                "call_failed": 5,
                "call_inprogress": 0,
                "DateCreated": "2021-07-09T01:48:03+05:30"
            }
        }
    ]
}