REST API: SIP Domains

Overview

A SIP domain is a custom DNS hostname that can accept SIP traffic for your account. If anyone makes a SIP request to that domain, for example to “sip:alice@example.sip.twilio.com”, it will route to Twilio. When that request hits Twilio, it’s authenticated, and then Twilio requests TwiML from your server. The VoiceUrl of the SIP domain tells Twilio what URL to request.

Twilio has two built-in authentication methods for your SIP Domain: IpAccessControlLists and CredentialLists. You must have at least one mapped to your Domain or else all requests will be blocked. You may apply one or multiple of each type to each SIP Domain.

The IpAccessControlListMappings and CredentialListMappings subresources of the SIP Domain show which lists are mapped to your SIP Domain.

Resource Properties

A Domain instance resource has the following properties:

Property Description
Sid A 34 character string that uniquely identifies the SIP domain in Twilio.
FriendlyName A human readable descriptive text, up to 64 characters long.
AccountSid The unique id of the Account that sent this message.
ApiVersion The version of the Twilio API used to process the message.
DomainName The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and “-”.
AuthType The types of authentication you have mapped to your domain. The possible values are “IP_ACL” and “CREDENTIAL_LIST”. If you have both setup for your domain, both will be returned comma delimited. If you do not, have one setup for your domain, it will not be able to receive any traffic.
VoiceUrl The URL Twilio will request when this domain receives a call.
VoiceMethod The HTTP method Twilio will use when requesting the above Url. Either GET or POST.
VoiceFallbackUrl The URL that Twilio will request if an error occurs retrieving or executing the TwiML requested by VoiceUrl.
VoiceFallbackMethod The HTTP method Twilio will use when requesting the VoiceFallbackUrl. Either GET or POST.
VoiceStatusCallbackUrl The URL that Twilio will request to pass status parameters (such as call ended) to your application.
VoiceStatusCallbackMethod The HTTP method Twilio will use to make requests to the StatusCallback URL. Either GET or POST.
DateCreated The date that this resource was created, given as GMT in RFC 2822 format.
DateUpdated The date that this resource was last updated, given as GMT in RFC 2822 format.
Uri The URI for this resource, relative to https://api.twilio.com

SIP Domain List Resource

The list resource allows you to view the domains in an account as well as create new domains.

Resource URI

/2010-04-01/Accounts/{AccountSid}/SIP/Domains

HTTP GET

GET /2010-04-01/Accounts/{AccountSid}/SIP/Domains

Returns a paged list of the domains for an account.

Example

Get a list of all domains.

get-domains
  • C#
  • Java
  • Node.js
  • PHP
  • Python
  • Ruby
  • curl
SDK Version:
  • 4.x
  • 5.x
Response Format:
  • json
  • xml
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

// Loop over the list of domains and echo a property for each one
foreach ($client->account->sip->domains as $domain) {
    echo $domain->domain_name;
}
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SIP/Domains \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;

class Example
{
  static void Main(string[] args)
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    var domains = twilio.ListDomains();

    foreach (var domain in domains.Domains)
    {
      Console.WriteLine(domain.DomainName);
    }
  }
}
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.sip.Domain;
import com.twilio.sdk.resource.list.sip.DomainList;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    
    
    DomainList domains = client.getAccount().getDomains();
    
    // Loop over domains and print out a property for each one.
    for (Domain domain : domains) {
      System.out.println(domain.getDomainName());
    }
    
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.sip.domains.list(function(err, data) {
    data.domains.forEach(function(domain) {
        console.log(domain.DomainName);
    });
});
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

# A list of domain objects with the properties described above
domains = client.sip.domains.list()
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token


# Loop over domains and print out a property for each one
@client.account.sip.domains.list.each do |domain|
    puts domain.domain_name
end
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SIP/Domains.json \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

// Loop over the list of domains and echo a property for each one
foreach ($client->account->sip->domains->read() as $domain) {
    echo $domain->domainName;
}

HTTP POST

Creates a new Domain and returns its instance resource. You must pick a unique domain name that ends in “.sip.twilio.com”. After creating a Domain, you must map it to an authentication method before the domain is ready to receive traffic.

POST /2010-04-01/Accounts/{AccountSid}/SIP/Domains

You must POST at least the following to create a new Domain:

Parameter Description
DomainName The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and “-”.

You may also set the following when creating your Domain. We recommend that you at least set the VoiceUrl of your Domain when creating it.

Parameter Description
FriendlyName A human readable descriptive text, up to 64 characters long.
VoiceUrl The URL Twilio will request when this domain receives a call.
VoiceMethod The HTTP method Twilio will use when requesting the above Url. Either GET or POST.
VoiceFallbackUrl The URL that Twilio will request if an error occurs retrieving or executing the TwiML requested by VoiceUrl.
VoiceFallbackMethod The HTTP method Twilio will use when requesting the VoiceFallbackUrl. Either GET or POST.
VoiceStatusCallbackUrl The URL that Twilio will request to pass status parameters (such as call ended) to your application.
VoiceStatusCallbackMethod The HTTP method Twilio will use to make requests to the StatusCallback URL. Either GET or POST.
Example
Create a SIP Domain
  • C#
  • Java
  • Node.js
  • PHP
  • Python
  • Ruby
  • curl
SDK Version:
  • 4.x
  • 5.x
Response Format:
  • json
  • xml
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

$domain = $client->account->sip->domains->create("My Domain", "marlo.sip.twilio.com", array(
        "VoiceUrl" => "https://demo.twilio.com/welcome",
    "AuthType" => "IP_ACL"
    ));
echo $domain->sid;
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SIP/Domains \
    -d "FriendlyName=My%20Domain" \
    -d "VoiceUrl=https://demo.twilio.com/welcome" \
    -d "AuthType=IP_ACL" \
    -d "DomainName=marlo.sip.twilio.com" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;

class Example
{
  static void Main(string[] args)
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    var options = new DomainOptions();
    options.FriendlyName = "My Domain";
    options.VoiceUrl = "https://demo.twilio.com/welcome";
    options.AuthType = "IP_ACL";
    options.DomainName = "marlo.sip.twilio.com";
    var domain = twilio.CreateDomain(options);

    Console.WriteLine(domain.Sid);
  }
}
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.factory.sip.DomainFactory;
import com.twilio.sdk.resource.instance.sip.Domain;
import com.twilio.sdk.resource.list.sip.DomainList;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Build a filter for the DomainList
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    params.add(new BasicNameValuePair("FriendlyName", "My Domain"));
    params.add(new BasicNameValuePair("VoiceUrl", "https://demo.twilio.com/welcome"));
    params.add(new BasicNameValuePair("AuthType", "IP_ACL"));
    params.add(new BasicNameValuePair("DomainName", "marlo.sip.twilio.com"));
    
    
    DomainFactory domainFactory = client.getAccount().getDomainFactory();
    Domain domain = domainFactory.create(params);
    System.out.println(domain.getSid());
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.sip.domains.create({
    friendlyName: "My Domain",
    voiceUrl: "https://demo.twilio.com/welcome",
    authType: "IP_ACL",
    domainName: "marlo.sip.twilio.com"
}, function(err, domain) {
    process.stdout.write(domain.sid);
});
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

domain = client.sip.domains.create(friendly_name="My Domain",
    voice_url="https://demo.twilio.com/welcome",
    auth_type="IP_ACL",
    domain_name="marlo.sip.twilio.com")
print(domain.sid)
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token

domain = @client.account.sip.domains.create(:friendly_name => "My Domain",
    :voice_url => "https://demo.twilio.com/welcome",
    :auth_type => "IP_ACL",
    :domain_name => "marlo.sip.twilio.com")
puts domain.domain_name
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SIP/Domains.json \
    -d "FriendlyName=My%20Domain" \
    -d "VoiceUrl=https://demo.twilio.com/welcome" \
    -d "AuthType=IP_ACL" \
    -d "DomainName=marlo.sip.twilio.com" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$domain = $client
    ->account
    ->sip
    ->domains
    ->create(
        "dunder-mifflin-scranton.sip.twilio.com",
        array(
            "friendlyName" => "Scranton Office",
            "voiceUrl" => "https://dundermifflin.example.com/twilio/app.php"
        )
    );

echo $ipAccessControlListMapping->sid;

HTTP PUT

Not supported.

HTTP DELETE

Not supported.

Domain Instance Resource

The SIP/Domain instance resource allows you to view, modify and delete a single domain.

The instance resource is represented by the properties above.

Resource URI

/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{SipDomainSid}

HTTP GET

Return a specific instance by Sid.

GET /2010-04-01/Accounts/{AccountSid}/SIP/Domains/{SipDomainSid}

Example
get-domain-instance
  • C#
  • Java
  • Node.js
  • PHP
  • Python
  • Ruby
  • curl
SDK Version:
  • 4.x
  • 5.x
Response Format:
  • json
  • xml
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$domain = $client->account->sip->domains->get("SD32a3c49700934481addd5ce1659f04d2");
echo $domain->voice_method;
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SIP/Domains/SD32a3c49700934481addd5ce1659f04d2 \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example
{
  static void Main(string[] args)
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    var domain = twilio.GetDomain("SD32a3c49700934481addd5ce1659f04d2");

    Console.WriteLine(domain.VoiceMethod);
  }
}
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.sip.Domain;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Get an object from its sid. If you do not have a sid,
    // check out the list resource examples on this page
    Domain domain = client.getAccount().getDomain("SD32a3c49700934481addd5ce1659f04d2");
    System.out.println(domain.getVoiceMethod());
    
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.sip.domains("SD32a3c49700934481addd5ce1659f04d2").get(function(err, domain) {
    console.log(domain.voiceMethod);
});
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

domain = client.sip.domains.get("SD32a3c49700934481addd5ce1659f04d2")
print(domain.voice_method)
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token

# Get an object from its sid. If you do not have a sid,
# check out the list resource examples on this page
@domain = @client.account.sip.domains.get("SD32a3c49700934481addd5ce1659f04d2")
puts @domain.voice_method
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SIP/Domains/SD32a3c49700934481addd5ce1659f04d2.json \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$domain = $client->account->sip
    ->domains("SD27f0288630a668bdfbf177f8e22f5ccc")
    ->fetch();

echo $domain->voiceMethod;

HTTP POST

Update the attributes of a domain.

POST /2010-04-01/Accounts/{AccountSid}/SIP/Domains/{SipDomainSid}
Example
Update an Instance of SIP Domain
  • C#
  • Java
  • Node.js
  • PHP
  • Python
  • Ruby
  • curl
SDK Version:
  • 4.x
  • 5.x
Response Format:
  • json
  • xml
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$domain = $client->account->sip->domains->get("SD32a3c49700934481addd5ce1659f04d2");
$domain->update(array(
        "FriendlyName" => "Little Kevin",
    "VoiceMethod" => "GET"
    ));
echo $domain->domain_name;
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SIP/Domains/SD32a3c49700934481addd5ce1659f04d2 \
    -d "FriendlyName=Little%20Kevin" \
    -d "VoiceMethod=GET" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;

class Example
{
  static void Main(string[] args)
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    var options = new DomainOptions();
    options.FriendlyName = "Little Kevin";
    options.VoiceMethod = "GET";

    twilio.UpdateDomain("SD32a3c49700934481addd5ce1659f04d2", options);
  }
}
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.sip.Domain;
import com.twilio.sdk.resource.list.sip.DomainList;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Get an object from its sid. If you do not have a sid,
    // check out the list resource examples on this page
    Domain domain = client.getAccount().getDomain("SD32a3c49700934481addd5ce1659f04d2");
    // Build a filter for the DomainList
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    params.add(new BasicNameValuePair("FriendlyName", "Little Kevin"));
    params.add(new BasicNameValuePair("VoiceMethod", "GET"));
    domain.update(params);
    
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.sip.domains("SD32a3c49700934481addd5ce1659f04d2").update({
    friendlyName: "Little Kevin",
    voiceMethod: "GET"
}, function(err, domain) {
    console.log(domain.domainName);
});
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

domain = client.sip.domains.update("SD32a3c49700934481addd5ce1659f04d2", friendly_name="Little Kevin",
    voice_method="GET")
print(domain.domain_name)
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token

# Get an object from its sid. If you do not have a sid,
# check out the list resource examples on this page
@domain = @client.account.sip.domains.get("SD32a3c49700934481addd5ce1659f04d2")
@domain.update(:friendly_name => "Little Kevin",
    :voice_method => "GET")
puts @domain.domain_name
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SIP/Domains/SD32a3c49700934481addd5ce1659f04d2.json \
    -d "FriendlyName=Little%20Kevin" \
    -d "VoiceMethod=GET" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$domain = $client->account->sip
    ->domains("SD27f0288630a668bdfbf177f8e22f5ccc")
    ->update(
        array(
            "friendlyName" => "Little Kevin",
            "voiceMethod" => "GET"
        )
    );

echo $domain->domainName;

HTTP PUT

Not supported.

HTTP DELETE

Delete a domain. If you have created subdomains of a domain, you will not be able to delete the domain until you first delete all subdomains of it.

If successful, Twilio will return an HTTP 204 response with no body.

DELETE /2010-04-01/Accounts/{AccountSid}/SIP/Domains/{SipDomainSid}
Example
Delete an Instance of SIP Domain
  • C#
  • Java
  • Node.js
  • PHP
  • Python
  • Ruby
  • curl
SDK Version:
  • 4.x
  • 5.x
Response Format:
  • json
  • xml
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

$client->account->sip->domains->delete("SD32a3c49700934481addd5ce1659f04d2");
$ curl -XDELETE https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SIP/Domains/SD32a3c49700934481addd5ce1659f04d2 \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example
{
  static void Main(string[] args)
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    twilio.DeleteDomain("SD32a3c49700934481addd5ce1659f04d2");
  }
}
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.sip.Domain;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Get an object from its sid. If you do not have a sid,
    // check out the list resource examples on this page
    Domain domain = client.getAccount().getDomain("SD32a3c49700934481addd5ce1659f04d2");
    
    domain.delete();
    
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.sip.domains("SD32a3c49700934481addd5ce1659f04d2").delete(function(err, data) {
    if (err) {
        console.log(err.status);
        throw err.message;
    } else {
        console.log("Sid SD32a3c49700934481addd5ce1659f04d2 deleted successfully.");
    }
});
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

client.sip.domains.delete("SD32a3c49700934481addd5ce1659f04d2")
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token

@domain = @client.account.sip.domains.get("SD32a3c49700934481addd5ce1659f04d2")
@domain.delete
$ curl -XDELETE https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SIP/Domains/SD32a3c49700934481addd5ce1659f04d2.json \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

$client->account->sip
    ->domains("SD32a3c49700934481addd5ce1659f04d2")
    ->delete();

Domain Instance Subresources

Domain IpAccessControlListMappings List Subresource

The IpAccessControlListMappings subresource contains the list of IpAccessControlList instances associated with this domain. If an INVITE is received for a domain, the source IP address must be in one of the mapped lists for the INVITE to be accepted.

Resource URI

/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/IpAccessControlListMappings

Resource Properties

An IpAccessControlListMappings resource is represented by the following properties:

Property Description
Sid A 34 character string that uniquely identifies an IpAccessControlList you have mapped to the domain
AccountSid The unique id of the Account that responsible for this resource.
FriendlyName A human readable descriptive text, up to 64 characters long.
DateCreated The date that this resource was created, given as GMT in RFC 2822 format.
DateUpdated The date that this resource was last updated, given as GMT in RFC 2822 format.
Uri The URI for this resource, relative to https://api.twilio.com

HTTP GET

Return the IpAccessControlListMappings that are associated to this domain.

GET /2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/IpAccessControlListMappings

Return a specific instance by Sid.

Example
Get an Instance of SIP Domain
  • C#
  • Java
  • Node.js
  • PHP
  • Python
  • Ruby
  • curl
SDK Version:
  • 4.x
  • 5.x
Response Format:
  • json
  • xml
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$ip_access_control_list_mapping = $client->account->sip->domains->get('SD32a3c49700934481addd5ce1659f04d2')->ip_access_control_list_mappings->get("AL95a47094615fe05b7c17e62a7877836c");
echo $ip_access_control_list_mapping->friendly_name;
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SIP/Domains/SD32a3c49700934481addd5ce1659f04d2/IpAccessControlListMappings/AL95a47094615fe05b7c17e62a7877836c \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    var ipAccessControlListMapping = twilio.GetIpAccessControlListMapping("SD32a3c49700934481addd5ce1659f04d2", "AL95a47094615fe05b7c17e62a7877836c");
    
    Console.WriteLine(ipAccessControlListMapping.FriendlyName);
  }
}
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.sip.IpAccessControlListMapping;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Get an object from its sid. If you do not have a sid,
    // check out the list resource examples on this page
    IpAccessControlListMapping ipAccessControlListMapping = client.getAccount().getDomain("SD32a3c49700934481addd5ce1659f04d2").getIpAccessControlListMapping("AL95a47094615fe05b7c17e62a7877836c");
    System.out.println(ipAccessControlListMapping.getFriendlyName());
    
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.sip.domains('SD32a3c49700934481addd5ce1659f04d2').ipAccessControlListMappings("AL95a47094615fe05b7c17e62a7877836c").get(function(err, ipAccessControlListMapping) {
    console.log(ipAccessControlListMapping.friendlyName);
});
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

ip_access_control_list_mapping = client.sip.ip_access_control_list_mappings("SD32a3c49700934481addd5ce1659f04d2").get("AL95a47094615fe05b7c17e62a7877836c")
print(ip_access_control_list_mapping.friendly_name)
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token

# Get an object from its sid. If you do not have a sid,
# check out the list resource examples on this page
@ip_access_control_list_mapping = @client.account.sip.domains.get('SD32a3c49700934481addd5ce1659f04d2').ip_access_control_list_mappings.get("AL95a47094615fe05b7c17e62a7877836c")
puts @ip_access_control_list_mapping.friendly_name
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SIP/Domains/SD32a3c49700934481addd5ce1659f04d2/IpAccessControlListMappings/AL95a47094615fe05b7c17e62a7877836c.json \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$ipAccessControlListMapping = $client->account->sip
    ->domains("SD32a3c49700934481addd5ce1659f04d2")
    ->ipAccessControlListMappings("AL95a47094615fe05b7c17e62a7877836c")
    ->fetch();

echo $ipAccessControlListMapping->friendlyName;

HTTP POST

Map an IpAccessControlList to this domain.

POST /2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/IpAccessControlListMappings
POST Parameters

The following parameters are required in your POST to IpAccessControlListMappings:

Parameter Description
IpAccessControlListSid The Sid of the IpAccessControlList that you want to associated with this domain. Once associated, Twilio will start authenticating access to the domain against this list.
Example
Map a CredentialList to the Domain
  • C#
  • Java
  • Node.js
  • PHP
  • Python
  • Ruby
  • curl
SDK Version:
  • 4.x
  • 5.x
Response Format:
  • json
  • xml
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

$ip_access_control_list_mapping = $client->account->sip->domains->get('SD32a3c49700934481addd5ce1659f04d2')->ip_access_control_list_mappings->create("AL95a47094615fe05b7c17e62a7877836c", array());
echo $ip_access_control_list_mapping->sid;
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SIP/Domains/SD32a3c49700934481addd5ce1659f04d2/IpAccessControlListMappings \
    -d "IpAccessControlListSid=AL95a47094615fe05b7c17e62a7877836c" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    
    var ipAccessControlListMapping = twilio.CreateIpAccessControlListMapping("SD32a3c49700934481addd5ce1659f04d2", "AL95a47094615fe05b7c17e62a7877836c");
    
    Console.WriteLine(ipAccessControlListMapping.Sid);
  }
}
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.factory.sip.IpAccessControlListMappingFactory;
import com.twilio.sdk.resource.instance.sip.IpAccessControlListMapping;
import com.twilio.sdk.resource.list.sip.IpAccessControlListMappingList;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Build a filter for the IpAccessControlListMappingList
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    params.add(new BasicNameValuePair("IpAccessControlListSid", "AL95a47094615fe05b7c17e62a7877836c"));
    
    
    IpAccessControlListMappingFactory ipAccessControlListMappingFactory = client.getAccount().getDomain("SD32a3c49700934481addd5ce1659f04d2").getIpAccessControlListMappingFactory();
    IpAccessControlListMapping ipAccessControlListMapping = ipAccessControlListMappingFactory.create(params);
    System.out.println(ipAccessControlListMapping.getSid());
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.sip.domains('SD32a3c49700934481addd5ce1659f04d2').ipAccessControlListMappings.create({
    ipAccessControlListSid: "AL95a47094615fe05b7c17e62a7877836c"
}, function(err, ipAccessControlListMapping) {
    process.stdout.write(ipAccessControlListMapping.sid);
});
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

ip_access_control_list_mapping = client.sip.ip_access_control_list_mappings("SD32a3c49700934481addd5ce1659f04d2").create(ip_access_control_list_sid="AL95a47094615fe05b7c17e62a7877836c")
print(ip_access_control_list_mapping.sid)
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token

ip_access_control_list_mapping = @client.account.sip.domains.get('SD32a3c49700934481addd5ce1659f04d2').ip_access_control_list_mappings.create(:ip_access_control_list_sid => "AL95a47094615fe05b7c17e62a7877836c")
puts ip_access_control_list_mapping.friendly_name
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SIP/Domains/SD32a3c49700934481addd5ce1659f04d2/IpAccessControlListMappings.json \
    -d "IpAccessControlListSid=AL95a47094615fe05b7c17e62a7877836c" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

$ipAccessControlListMapping = $client->account->sip
    ->domains("SD32a3c49700934481addd5ce1659f04d2")
    ->ipAccessControlListMappings
    ->create("AL95a47094615fe05b7c17e62a7877836c");

echo $ipAccessControlListMapping->sid;

HTTP PUT

Not supported.

HTTP DELETE

Remove a mapping from this domain.

DELETE /2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/IpAccessControlListMappings/{ALSid}
Example
Delete a CredentialListMapping from a Domain
  • C#
  • Java
  • Node.js
  • PHP
  • Python
  • Ruby
  • curl
SDK Version:
  • 4.x
  • 5.x
Response Format:
  • json
  • xml
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

$client->account->sip->domains->get('SD32a3c49700934481addd5ce1659f04d2')->ip_access_control_list_mappings->delete("AL95a47094615fe05b7c17e62a7877836c");
$ curl -XDELETE https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SIP/Domains/SD32a3c49700934481addd5ce1659f04d2/IpAccessControlListMappings/AL95a47094615fe05b7c17e62a7877836c \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    twilio.DeleteIpAccessControlListMapping("SD32a3c49700934481addd5ce1659f04d2", "AL95a47094615fe05b7c17e62a7877836c");
  }
}
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.sip.IpAccessControlListMapping;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Get an object from its sid. If you do not have a sid,
    // check out the list resource examples on this page
    IpAccessControlListMapping ipAccessControlListMapping = client.getAccount().getDomain("SD32a3c49700934481addd5ce1659f04d2").getIpAccessControlListMapping("AL95a47094615fe05b7c17e62a7877836c");
    
    ipAccessControlListMapping.delete();
    
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.sip.domains('SD32a3c49700934481addd5ce1659f04d2').ipAccessControlListMappings("AL95a47094615fe05b7c17e62a7877836c").delete(function(err, data) {
    if (err) {
        console.log(err.status);
        throw err.message;
    } else {
        console.log("Sid AL95a47094615fe05b7c17e62a7877836c deleted successfully.");
    }
});
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

client.sip.ip_access_control_list_mappings("SD32a3c49700934481addd5ce1659f04d2").delete("AL95a47094615fe05b7c17e62a7877836c")
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token

@ip_access_control_list_mapping = @client.account.sip.domains.get('SD32a3c49700934481addd5ce1659f04d2').ip_access_control_list_mappings.get("AL95a47094615fe05b7c17e62a7877836c")
@ip_access_control_list_mapping.delete
$ curl -XDELETE https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SIP/Domains/SD32a3c49700934481addd5ce1659f04d2/IpAccessControlListMappings/AL95a47094615fe05b7c17e62a7877836c.json \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

$client->account->sip
    ->domains("SD32a3c49700934481addd5ce1659f04d2")
    ->ipAccessControlListMappings("AL95a47094615fe05b7c17e62a7877836c")
    ->delete();

Domain CredentialListMappings List Subresource

The CredentialListMappings subresource represents the CredentialLists instances associated with this domain. If an INVITE is received for a domain with a Credential List mapped to it, Twilio will challenge the request. Your system will need to authenticate with a username and password. The username and password must be in one of the mapped lists for the INVITE to be accepted.

Resource URI

/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{SipDomainSid}/CredentialListMappings

Resource Properties

A CredentialListMappings resource is represented by the following properties:

Property Description
Sid A 34 character string that uniquely identifies a CredentialList you have mapped to the domain.
AccountSid The unique id of the Account that responsible for this resource.
FriendlyName A human readable descriptive text, up to 64 characters long.
DateCreated The date that this resource was created, given as GMT in RFC 2822 format.
DateUpdated The date that this resource was last updated, given as GMT in RFC 2822 format.
Uri The URI for this resource, relative to https://api.twilio.com

HTTP GET

Get the user lists mapped to this domain.

GET /2010-04-01/Accounts/{AccountSid}/SIP/Domains/{SipDomainSid}/CredentialListMappings
Example
Get a CredentialListMapping
  • C#
  • Java
  • Node.js
  • PHP
  • Python
  • Ruby
  • curl
SDK Version:
  • 4.x
  • 5.x
Response Format:
  • json
  • xml
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

// Loop over the list of credential_list_mappings and echo a property for each one
foreach ($client->account->sip->domains->get('SD32a3c49700934481addd5ce1659f04d2')->credential_list_mappings as $credential_list_mapping) {
    echo $credential_list_mapping->friendly_name;
}
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SIP/Domains/SD32a3c49700934481addd5ce1659f04d2/CredentialListMappings \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    var credentialListMappings = twilio.ListCredentialListMappings("SD32a3c49700934481addd5ce1659f04d2", null, null);
    
    foreach (var credentialListMapping in credentialListMappings.CredentialListMappings)
    {
      Console.WriteLine(credentialListMapping.FriendlyName);
    }
  }
}
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.sip.CredentialListMapping;
import com.twilio.sdk.resource.list.sip.CredentialListMappingList;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    
    
    CredentialListMappingList credentialListMappings = client.getAccount().getDomain("SD32a3c49700934481addd5ce1659f04d2").getCredentialListMappings();
    
    // Loop over credentialListMappings and print out a property for each one.
    for (CredentialListMapping credentialListMapping : credentialListMappings) {
      System.out.println(credentialListMapping.getFriendlyName());
    }
    
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.sip.domains('SD32a3c49700934481addd5ce1659f04d2').credentialListMappings.list(function(err, data) {
    data.credentialListMappings.forEach(function(credentialListMapping) {
        console.log(credentialListMapping.FriendlyName);
    });
});
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

# A list of credential_list_mapping objects with the properties described above
credential_list_mappings = client.sip.credential_list_mappings("SD32a3c49700934481addd5ce1659f04d2").list()
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token


# Loop over credential_list_mappings and print out a property for each one
@client.account.sip.domains.get('SD32a3c49700934481addd5ce1659f04d2').credential_list_mappings.list.each do |credential_list_mapping|
    puts credential_list_mapping.friendly_name
end
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SIP/Domains/SD32a3c49700934481addd5ce1659f04d2/CredentialListMappings.json \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

$credentialListMappings = $client->account->sip
    ->domains("SD32a3c49700934481addd5ce1659f04d2")
    ->credentialListMappings
    ->read();

// Loop over the list of credential_list_mappings and echo a property for each one
foreach ($credentialListMappings as $credentialListMapping) {
    echo $credentialListMapping->friendlyName;
}

HTTP POST

Map a CredentialList to the domain.

POST /2010-04-01/Accounts/{AccountSid}/SIP/Domains/{SipDomainSid}/CredentialListMappings
POST Parameters

The following parameters are required in your POST to CredentialListMappings:

Parameter Description
CredentialListSid The Sid of the CredentialList that you want to associated with this domain. Once associated, Twilio will start authenticating access to the domain against this list.
Example
Map a CredentialList for some domain
  • C#
  • Java
  • Node.js
  • PHP
  • Python
  • Ruby
  • curl
SDK Version:
  • 4.x
  • 5.x
Response Format:
  • json
  • xml
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

$credential_list_mapping = $client->account->sip->domains->get('SD32a3c49700934481addd5ce1659f04d2')->credential_list_mappings->create("CL32a3c49700934481addd5ce1659f04d2", array());
echo $credential_list_mapping->sid;
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SIP/Domains/SD32a3c49700934481addd5ce1659f04d2/CredentialListMappings \
    -d "CredentialListSid=CL32a3c49700934481addd5ce1659f04d2" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    
    var credentialListMapping = twilio.CreateCredentialListMapping("SD32a3c49700934481addd5ce1659f04d2", "CL32a3c49700934481addd5ce1659f04d2");
    
    Console.WriteLine(credentialListMapping.Sid);
  }
}
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.factory.sip.CredentialListMappingFactory;
import com.twilio.sdk.resource.instance.sip.CredentialListMapping;
import com.twilio.sdk.resource.list.sip.CredentialListMappingList;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Build a filter for the CredentialListMappingList
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    params.add(new BasicNameValuePair("CredentialListSid", "CL32a3c49700934481addd5ce1659f04d2"));
    
    
    CredentialListMappingFactory credentialListMappingFactory = client.getAccount().getDomain("SD32a3c49700934481addd5ce1659f04d2").getCredentialListMappingFactory();
    CredentialListMapping credentialListMapping = credentialListMappingFactory.create(params);
    System.out.println(credentialListMapping.getSid());
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.sip.domains('SD32a3c49700934481addd5ce1659f04d2').credentialListMappings.create({
    credentialListSid: "CL32a3c49700934481addd5ce1659f04d2"
}, function(err, credentialListMapping) {
    process.stdout.write(credentialListMapping.sid);
});
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

credential_list_mapping = client.sip.credential_list_mappings("SD32a3c49700934481addd5ce1659f04d2").create(credential_list_sid="CL32a3c49700934481addd5ce1659f04d2")
print(credential_list_mapping.sid)
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token

credential_list_mapping = @client.account.sip.domains.get('SD32a3c49700934481addd5ce1659f04d2').credential_list_mappings.create(:credential_list_sid => "CL32a3c49700934481addd5ce1659f04d2")
puts credential_list_mapping.friendly_name
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SIP/Domains/SD32a3c49700934481addd5ce1659f04d2/CredentialListMappings.json \
    -d "CredentialListSid=CL32a3c49700934481addd5ce1659f04d2" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

$credentialListMapping = $client->account->sip
    ->domains("SD32a3c49700934481addd5ce1659f04d2")
    ->credentialListMappings
    ->create("CL32a3c49700934481addd5ce1659f04d2");

echo $credentialListMapping->sid;

HTTP PUT

Not supported.

HTTP DELETE

DELETE /2010-04-01/Accounts/{AccountSid}/SIP/Domains/{SipDomainSid}/CredentialListMappings/{CLSid}

Remove a CredentialListMapping from a domain

Example
Delete a CredentialListMapping
  • C#
  • Java
  • Node.js
  • PHP
  • Python
  • Ruby
  • curl
SDK Version:
  • 4.x
  • 5.x
Response Format:
  • json
  • xml
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

$client->account->sip->domains->get('SD32a3c49700934481addd5ce1659f04d2')->credential_list_mappings->delete("CL32a3c49700934481addd5ce1659f04d2");
$ curl -XDELETE https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SIP/Domains/SD32a3c49700934481addd5ce1659f04d2/CredentialListMappings/CL32a3c49700934481addd5ce1659f04d2 \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    twilio.DeleteCredentialListMapping("SD32a3c49700934481addd5ce1659f04d2", "CL32a3c49700934481addd5ce1659f04d2");
  }
}
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.sip.CredentialListMapping;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Get an object from its sid. If you do not have a sid,
    // check out the list resource examples on this page
    CredentialListMapping credentialListMapping = client.getAccount().getDomain("SD32a3c49700934481addd5ce1659f04d2").getCredentialListMapping("CL32a3c49700934481addd5ce1659f04d2");
    
    credentialListMapping.delete();
    
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.sip.domains('SD32a3c49700934481addd5ce1659f04d2').credentialListMappings("CL32a3c49700934481addd5ce1659f04d2").delete(function(err, data) {
    if (err) {
        console.log(err.status);
        throw err.message;
    } else {
        console.log("Sid CL32a3c49700934481addd5ce1659f04d2 deleted successfully.");
    }
});
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

client.sip.credential_list_mappings("SD32a3c49700934481addd5ce1659f04d2").delete("CL32a3c49700934481addd5ce1659f04d2")
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token

@credential_list_mapping = @client.account.sip.domains.get('SD32a3c49700934481addd5ce1659f04d2').credential_list_mappings.get("CL32a3c49700934481addd5ce1659f04d2")
@credential_list_mapping.delete
$ curl -XDELETE https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SIP/Domains/SD32a3c49700934481addd5ce1659f04d2/CredentialListMappings/CL32a3c49700934481addd5ce1659f04d2.json \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

$client->account->sip
    ->domains("SD32a3c49700934481addd5ce1659f04d2")
    ->credentialListMappings("CL32a3c49700934481addd5ce1659f04d2")
    ->delete();