×

This API allows you update name and tag of multiple lists.

It's a bulk API and which supports 5000 lists in one request.

PUT

https://<your_api_key>:<your_api_token><subdomain>/v2/accounts/<your_sid>/lists

  • 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
    1. <subdomain> of Singapore cluster is @api.exotel.com
    2. <subdomain> of Mumbai cluster is @api.in.exotel.com

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

curl -X PUT 'https://<your_api_key>:<your_api_token>@<subdomain>/v2/accounts/<account_sid>/lists' 
--header 'Content-Type: application/json' 
--data-raw '{
    "lists": [
        { 
           "sid": "d49b7a4781ea45dcb702825ce30494ba", 
           "name": "list_123" },
        {
           "sid": "e59b7a4781ea45dcb702825ce30495cd", 
           "name": "list_456" 
        }
    ]
}'
var unirest = require('unirest');
var unirest = require('unirest');
var accountSid = "XXXXXXXXX";
var accountToken = "YYYYYYYYY";
var authKey = "ZZZZZZZZZZ";

var encoding = Buffer.from(authKey + ':' + accountToken).toString('base64');
var req = unirest('PUT', 'https://<subdomain>/v2/accounts/<account_sid>/lists')
  .headers({
      Authorization: 'Basic ' + encoding,
      'Content-Type': 'application/json'
  })
  .send(JSON.stringify({ "lists": [{ 
"sid": "d49b7a4781ea45dcb702825ce30494ba", 
"name": "list_123" }
{
"sid": "e59b7a4781ea45dcb702825ce30495cd", 
"name": "list_456" 
}]}))
  .end(function (res) { 
    if (res.error) throw new Error(res.error); 
    console.log(res.raw_body);
  });
<?php

$curl = curl_init();
$accountSid = "XXXXXXXXXX";
$accountToken = "YYYYYYYYYY";
$authKey = "ZZZZZZZZZZ";

$encoding = base64_encode($authKey .":". $accountToken);
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<subdomain>/v2/accounts/exotel8u3/lists',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'PUT',
  CURLOPT_POSTFIELDS =>'{
    "lists": [
        { 
            "sid": "d49b7a4781ea45dcb702825ce30494ba", 
            "name": "list_123" }
        {
            "sid": "e59b7a4781ea45dcb702825ce30495cd", 
            "name": "list_456" 
         }
    ]
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    "Authorization: Basic ".$encoding
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import requests
import base64 
import json
accountSid = "XXXXXXXXX"
authToken = "YYYYYYYYY"
authKey = "ZZZZZZZZZZ"

encoding = base64.b64encode(authKey + ":" + authToken)

url = "https://<subdomain>/v2/accounts/exotel8u3/lists"

payload = json.dumps({"lists": [
        { 
          "sid": "d49b7a4781ea45dcb702825ce30494ba", 
          "name": "list_123" }
        {
          "sid": "e59b7a4781ea45dcb702825ce30495cd", 
          "name": "list_456" 
        }
    ]})
headers = {
  'Content-Type': 'application/json',
  'Authorization': "Basic " + encoding
}

response = requests.request("PUT", url, headers=headers, data=payload)

print(response.text)
package main

import (
	b64 "encoding/base64"
	"fmt"
	"io/ioutil"
	"net/http"
	"strings"
)

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://<subdomain>/v2/accounts/" + accountSid + "/lists"
	method := "PUT"

	payload := strings.NewReader(`{
	  "lists": [
		  {
			"sid": "d49b7a4781ea45dcb702825ce30494ba",  
                        "name": "list_123"
		  }
                  {
                        "sid": "e59b7a4781ea45dcb702825ce30495cd", 
                        "name": "list_456" 
                  }

	  ]
  }`)

	client := &http.Client{}
	req, err := http.NewRequest(method, url, payload)

	if err != nil {
		fmt.Println(err)
		return
	}
	req.Header.Add("Content-Type", "application/json")
	req.Header.Add("Authorization", "Basic "+encoding)

	res, err := client.Do(req)
	if err != nil {
		fmt.Println(err)
		return
	}
	defer res.Body.Close()

	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(string(body))
}
{
    "request_id": "b45f202e1ec14b37bc459235a65f8712",
    "method": "POST",
    "http_code": 207,
    "metadata": {
        "failed": 0,
        "total": 2,
        "success": 2     },
    "response": [
        {
            "code": 200,
            "error_data": null,
            "status": "success",
            "data": {
                "sid": "d49b7a4781ea45dcb702825ce30494ba",
                "date_created": "2021-05-23T14:09:32.143446635+05:30",
                "date_updated": "2021-05-23T14:09:32.143446635+05:30",
                "account_sid": "exotel8u3",
                "name": "list_123",
                "uri": "/v2/accounts/exotel8u3/lists/46cd9106113f4920be56811382ebefba",
                "tag": null,
                "contact_count": null
            }
        }
        {
            "code": 200,
            "error_data": null,
            "status": "success",
            "data": {
                "sid": "e59b7a4781ea45dcb702825ce30495cd",
                "date_created": "2021-05-23T14:09:32.143446635+05:30",
                "date_updated": "2021-05-23T14:09:32.143446635+05:30",
                "account_sid": "exotel8u3",
                "name": "list_456",
                "uri": "/v2/accounts/exotel8u3/lists/46cd9106113f4920be56811382ebefba",
                "tag": null,
                "contact_count": null
            }
        }
 ] }