REST API: Lookup

The Lookup subdomain provides an API to retrieve additional information about a phone number. Lookup currently supports retrieval of Region-specific phone number formatting, Carrier Information and Caller Name information. You can specify one or more types of information you would like to purchase in the request. Lookup also supports Twilio Add-ons, enabling you to retrieve information from a multitude of 3rd party data sources, available via the Twilio Marketplace

Lookups Subdomain

Resource URI

lookups.twilio.com/v1/PhoneNumbers/{PhoneNumber}

{PhoneNumber} is the phone number you are requesting information about. Phone numbers can be specified either in national formatting or in standard E.164 format. If providing a number in local national format, please also specify the country as an optional parameter. If no country is provided, this will default to US. Twilio will use libphonenumber, Google’s open source phone number handling library, to properly format possible phone numbers for a given region, using length and prefix.

HTTP GET

Returns phone number information matching the specified request. Formatting information is standard. Carrier, Caller Name and phone number type information can be requested, in addition to using Add-ons to access 3rd party data sources.

Query Parameters

The following basic GET query string parameters allow you to specify the phone number you want information about and the types of information you’d like:

Parameter Description
CountryCode Optional ISO country code of the phone number. This is used to specify the country when the number is provided in a national format.
Type Indicates the type of information you would like returned with your request. Possible values are carrier or caller-name. If not specified, the default is null.
Carrier information costs $0.005 per phone number looked up.
Caller Name information costs $0.01 per phone number looked up, and is currently ONLY available in the US.
AddOns Indicates the particular Add-on you would like to use to get more information. Possible values are the Add-on Unique Names of Add-ons installed on your account. You can specify multiple instances of this parameter to invoke different Add-ons.
See Add-ons documentation for information on installing Add-ons. Add-on pricing is available in your list of Installed Add-ons in the Console.
AddOns.add_on_unique_name.parameter_name Optional. Passes additional data to the Add-on at request time. See Add-on documentation in Console to identify if the Add-on requires additional parameters. Note that this Add-on must be invoked in this request using the AddOns parameter above.

Resource Properties

The following properties are always returned:

Property Description
CountryCode The ISO country code for the phone number.
PhoneNumber The phone number, in E.164 format (i.e. "+1").
NationalFormat The phone number, in national format.
AddOns Results of any Add-ons you have specified using the AddOn parameter in the request, as a JSON dictionary. For the format of the dictionary, refer to Using Add-ons 6 section in the Add-ons documentation.

Only possible numbers (for a given region, using length and prefix information) will return formatting results. If you attempt to lookup a phone number which cannot exist, you will receive an HTTP 404 error.

Carrier Information

The following additional properties are returned if you requested carrier information in your GET request:

Property Description
MobileCountryCode The mobile country code of the carrier (for mobile numbers only).
MobileNetworkCode The mobile network code of the carrier (for mobile numbers only).
Name The name of the carrier. Please bear in mind that carriers rebrand themselves constantly and that the names used for carriers will likely change over time.
Type The phone number type. Possible values are landline, mobile, or voip. See 'Phone Number Type' below for more information.
ErrorCode The error code, if any, associated with your request.
Phone Number Types

The following are the possible values for the 'Type' property.

Type Description
landline The phone number is a landline number generally not capable of receiving SMS messages.
mobile The phone number is a mobile number generally capable of receiving SMS messages.
voip An internet based phone number that may or may not be capable of receiving SMS messages. For example, Google Voice.

Caller Name

The following additional properties are returned if you requested caller name in your GET request:

Property Description
CallerName String indicating the name of the owner of the phone number. If not available, this will return null.
CallerType String indicating whether this caller is a business or consumer. Possible values are business, consumer. If not available, this will return unavailable.
ErrorCode The error code, if any, associated with your request.

Note that Caller Name lookups for US numbers are billed per lookup, even if data may not be available. Currently, requesting Caller Name Lookup for international numbers will return null values, but will not be billed.

Examples

Find carrier information for an E.164 formatted phone number.

Lookup with E.164 Formatted Number
  • C#
  • curl
  • Java
  • Node.js
  • PHP
  • Python
  • Ruby
SDK Version:
  • 4.x
  • 5.x
SDK Version:
  • 6.x
  • 7.x
SDK Version:
  • 2.x
  • 3.x
SDK Version:
  • 4.x
  • 5.x
SDK Version:
  • 5.x
  • 6.x
SDK Version:
  • 4.x
  • 5.x
$ curl -XGET https://lookups.twilio.com/v1/PhoneNumbers/+15108675309?Type=carrier \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import java.util.HashMap;
import java.util.Map;

import com.twilio.Twilio;
import com.twilio.rest.lookups.v1.PhoneNumber;

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) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    PhoneNumber number = PhoneNumber
        .fetcher(new com.twilio.type.PhoneNumber("+15108675309"))
        .setType("carrier")
        .fetch();

    System.out.println(number.getCarrier().get("name"));
    System.out.println(number.getCarrier().get("type"));
  }
}
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.LookupsClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.lookups.PhoneNumber;

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 {
    LookupsClient client = new LookupsClient(ACCOUNT_SID, AUTH_TOKEN);

    PhoneNumber number = client.getPhoneNumber("+15108675309", true);

    System.out.println(number.getType());
    System.out.println(number.getCarrierName());
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

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

number = client.lookups.phone_numbers("+15108675309").fetch(type="carrier")

print(number.carrier['type'])
print(number.carrier['name'])
// 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 LookupsClient = require('twilio').LookupsClient;
var client = new LookupsClient(accountSid, authToken);

client.phoneNumbers('+15108675309').get({
  type: 'carrier'
}, function(error, number) {
  console.log(number.carrier.type);
  console.log(number.carrier.name);
});
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio.Lookups;

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

    // Look up a phone number in E.164 format
    var phoneNumber = lookupsClient.GetPhoneNumber("+15108675309", true);
    Console.WriteLine(phoneNumber.Carrier.Type);
    Console.WriteLine(phoneNumber.Carrier.Name);
  }
}
<?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 Lookups_Services_Twilio($sid, $token);

$number = $client->phone_numbers->get("+15108675309", array("Type" => "carrier"));

echo $number->carrier->type . "\r\n";
echo $number->carrier->name;
# Get twilio-ruby from twilio.com/docs/ruby/install
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::LookupsClient.new account_sid, auth_token

number = @client.phone_numbers.get('+15108675309', type: 'carrier')

puts number.carrier['type']
puts number.carrier['name']
// Download the Node helper library from twilio.com/docs/node/install
// These are your accountSid and authToken from https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';

const client = require('twilio')(accountSid, authToken);

client.lookups.v1
  .phoneNumbers('+15108675309')
  .fetch()
  .then((number) => console.log(number.carrier.type, number.carrier.name));
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using System.Collections.Generic;
using Twilio;
using Twilio.Rest.Lookups.V1;
using Twilio.Types;

public class Example
{
    public static void Main(string[] args)
    {
        // Find your Account SID and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";

        TwilioClient.Init(accountSid, authToken);

        // Look up a phone number in E.164 format
        var phoneNumber = PhoneNumberResource.Fetch(
            new PhoneNumber("+15108675309"),
            type: new List<string> { "carrier" });

        Console.WriteLine(phoneNumber.Carrier["name"]);
        Console.WriteLine(phoneNumber.Carrier["type"]);
    }
}
<?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);

$number = $client->lookups
    ->phoneNumbers("+15108675309")
    ->fetch(
        array("type" => "carrier")
    );

echo $number->carrier["type"] . "\r\n";
echo $number->carrier["name"];
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest.lookups import TwilioLookupsClient

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

number = client.phone_numbers.get("+15108675309", include_carrier_info=True)
print(number.carrier['type'])
print(number.carrier['name'])
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new(account_sid, auth_token)

number = @client.lookups.v1.phone_numbers('+15108675309').fetch(type: 'carrier')

puts number.carrier['type']
puts number.carrier['name']
{
    "url": "https://lookups.twilio.com/v1/PhoneNumbers/+15108675309?Type=carrier",
    "carrier": {
        "error_code": null,
        "type": "mobile",
        "name": "T-Mobile USA, Inc.",
        "mobile_network_code": "160",
        "mobile_country_code": "310"
    },
    "national_format": "(510) 867-5309",
    "phone_number": "+15108675309",
    "country_code": "US"
}
Lookup with E.164 Formatted Number

Look up a phone number in the E.164 format

Lookup with National Formatted Number
  • C#
  • curl
  • Java
  • Node.js
  • PHP
  • Python
  • Ruby
SDK Version:
  • 4.x
  • 5.x
SDK Version:
  • 6.x
  • 7.x
SDK Version:
  • 2.x
  • 3.x
SDK Version:
  • 4.x
  • 5.x
SDK Version:
  • 5.x
  • 6.x
SDK Version:
  • 4.x
  • 5.x
$ curl -XGET 'https://lookups.twilio.com/v1/PhoneNumbers/(510)%20867-5309?Type=carrier&CountryCode=US' \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import com.twilio.Twilio;
import com.twilio.rest.lookups.v1.PhoneNumber;

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 UnsupportedEncodingException {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    String nationalNumber = URLEncoder.encode("(510) 867-5309", "UTF-8").replaceAll("\\+", "%20");

    PhoneNumber number = PhoneNumber
        .fetcher(new com.twilio.type.PhoneNumber(nationalNumber))
        .setType("carrier")
        .setCountryCode("US")
        .fetch();

    System.out.println(number.getCarrier().get("name"));
    System.out.println(number.getCarrier().get("type"));
  }
}
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.LookupsClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.lookups.PhoneNumber;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

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, UnsupportedEncodingException {
    LookupsClient client = new LookupsClient(ACCOUNT_SID, AUTH_TOKEN);

    String nationalNumber = URLEncoder.encode("(510) 867-5309", "UTF-8")
                            .replaceAll("\\+", "%20");
    PhoneNumber number = client.getPhoneNumber(nationalNumber, "US", true);

    System.out.println(number.getType());
    System.out.println(number.getCarrierName());
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

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

number = client.lookups.phone_numbers("+15108675309").fetch(
    type="carrier",
    country_code="US"
)

print(number.carrier['type'])
print(number.carrier['name'])
// Download the Node helper library from twilio.com/docs/node/install
// These consts are your accountSid and authToken from twilio.com/user/account
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const LookupsClient = require('twilio').LookupsClient;
const client = new LookupsClient(accountSid, authToken);

client.phoneNumbers('(510) 867-5309').get({
  countryCode: 'US',
  type: 'carrier'
}, function(error, number) {
  console.log(number.carrier.type);
  console.log(number.carrier.name);
});
});
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio.Lookups;

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

    // Look up a phone number in local format
    var phoneNumber = lookupsClient.GetPhoneNumber("(510) 867-5309", "US", true);
    Console.WriteLine(phoneNumber.Carrier.Type);
    Console.WriteLine(phoneNumber.Carrier.Name); 
  }
}
<?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 Lookups_Services_Twilio($sid, $token);

$number = $client->phone_numbers->get("(510) 867-5309", array("CountryCode" => "US", "Type" => "carrier"));

echo $number->carrier->type . "\r\n";
echo $number->carrier->name;
# Get twilio-ruby from twilio.com/docs/ruby/install
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::LookupsClient.new account_sid, auth_token

number = @client.phone_numbers.get('(510) 867-5309', country_code: 'US', type: 'carrier')

puts number.carrier['type']
puts number.carrier['name']
// Download the Node helper library from twilio.com/docs/node/install
// These are your accountSid and authToken from https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';

const client = require('twilio')(accountSid, authToken);

client.lookups.v1
  .phoneNumbers('(510) 867-5309')
  .fetch({countryCode: 'US', type: 'carrier'})
  .then((number) => console.log(number.carrier.type, number.carrier.name));
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using System.Collections.Generic;
using Twilio;
using Twilio.Rest.Lookups.V1;
using Twilio.Types;

public class Example
{
    public static void Main(string[] args)
    {
        // Find your Account SID and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";

        TwilioClient.Init(accountSid, authToken);

        // Look up a phone number in local format
        var phoneNumber = PhoneNumberResource.Fetch(
            new PhoneNumber("(510) 867-5309"),
            "US",
            new List<string> { "carrier" });

        Console.WriteLine(phoneNumber.Carrier["name"]);
        Console.WriteLine(phoneNumber.Carrier["type"]);
    }
}
<?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);

$number = $client->lookups
    ->phoneNumbers("+15108675309")
    ->fetch(
        array("countryCode" => "US", "type" => "carrier")
    );

echo $number->carrier["type"] . "\r\n";
echo $number->carrier["name"];
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest.lookups import TwilioLookupsClient

try:
    # Python 3
    from urllib.parse import quote
except ImportError:
    # Python 2
    from urllib import quote

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

encoded_number = quote('(510) 867-5309')
number = client.phone_numbers.get(encoded_number, include_carrier_info=True,
                                  country_code="US")
print(number.carrier['type'])
print(number.carrier['name'])
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new(account_sid, auth_token)

encoded_phone_number = URI.encode('(510) 867-5309')
number = @client.lookups.v1
                .phone_numbers(encoded_phone_number)
                .fetch(country_code: 'US', type: 'carrier')

puts number.carrier['type']
puts number.carrier['name']
{
    "url": "https://lookups.twilio.com/v1/PhoneNumbers/+15108675309?Type=carrier",
    "carrier": {
        "error_code": null,
        "type": "mobile",
        "name": "T-Mobile USA, Inc.",
        "mobile_network_code": "160",
        "mobile_country_code": "310"
    },
    "national_format": "(510) 867-5309",
    "phone_number": "+15108675309",
    "country_code": "US"
}
Lookup with National Formatted Number

Note : The following examples use the Twilio Nextgen helper libraries.

Lookup with Caller Name
  • C#
  • curl
  • Java
  • PHP
  • Python
$ curl -XGET https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?Type=caller-name \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.rest.lookups.v1.PhoneNumber;

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) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    PhoneNumber number = PhoneNumber
        .fetcher(new com.twilio.type.PhoneNumber("+15108675309"))
        .setType("caller-name")
        .fetch();

    System.out.println(number.getCallerName());
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

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

number = client.lookups.phone_numbers("15108675309").fetch(
    type="caller-name",
)

print(number.carrier['type'])
print(number.carrier['name'])
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using System.Collections.Generic;
using Twilio;
using Twilio.Rest.Lookups.V1;
using Twilio.Types;

public class Example
{
	public static void Main(string[] args)
	{
		// Find your Account SID and Auth Token at twilio.com/console
		const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
		const string authToken = "your_auth_token";

		TwilioClient.Init(accountSid, authToken);

		var phoneNumber = PhoneNumberResource.Fetch(
		    new PhoneNumber("+15108675309"),
		    type: new List<string> { "caller-name" });

		Console.WriteLine(phoneNumber.CallerName["caller_name"]);
	}
}
<?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);

$number = $client->lookups
    ->phoneNumbers("+14157012311")
    ->fetch(
        array("type" => "caller-name")
    );

echo $number->callerName['caller_type'] . "\r\n";
echo $number->callerName['caller_name'];
{
  "caller_name": {
    "caller_name": "YOU TUBE",
    "caller_type": "BUSINESS",
    "error_code": null
  },
  "country_code": "US",
  "phone_number": "+16502530000",
  "national_format": "(650) 253-0000",
  "carrier": null,
  "url": "https://lookups.twilio.com/v1/PhoneNumbers/+16502530000"
}
Lookup with Caller Name
Lookup with Carrier Caller Name
  • C#
  • curl
  • Java
  • PHP
  • Python
$ curl -XGET "https://lookups.twilio.com/v1/PhoneNumbers/+15108675309/?Type=carrier&Type=caller-name" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.lookups.v1.PhoneNumber;

import java.util.Arrays;

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) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

        PhoneNumber number = PhoneNumber
                .fetcher(new com.twilio.type.PhoneNumber("+15108675309"))
                .setType(Arrays.asList("caller-name", "carrier"))
                .fetch();

        System.out.println(number.getCallerName());
    }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

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

number = client.lookups.phone_numbers("15108675309").fetch(
    type=["carrier", "caller-name"],
)

print(number.carrier['type'])
print(number.carrier['name'])
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using System.Collections.Generic;
using Twilio;
using Twilio.Rest.Lookups.V1;
using Twilio.Types;

public class Example
{
    public static void Main(string[] args)
    {
        // Find your Account SID and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";

        TwilioClient.Init(accountSid, authToken);

        var phoneNumber = PhoneNumberResource.Fetch(
            new PhoneNumber("+15108675309"),
            type: new List<string> { "caller-name", "carrier" });

        Console.WriteLine(phoneNumber.CallerName["caller_name"]);
    }
}
<?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);

$number = $client->lookups
    ->phoneNumbers("+15108675309")
    ->fetch(
        array(
            "type" => array("carrier", "caller-name")
        )
    );

echo $number->carrier["type"] . "\r\n";
echo $number->carrier["name"];
{
  "caller_name": {
    "caller_name": "YOU TUBE",
    "caller_type": "BUSINESS",
    "error_code": null
  },
  "country_code": "US",
  "phone_number": "+16502530000",
  "national_format": "(650) 253-0000",
  "carrier": {
    "mobile_country_code": null,
    "mobile_network_code": null,
    "name": "Level 3 Communications, LLC",
    "type": "landline",
    "error_code": null
  },
  "url": "https://lookups.twilio.com/v1/PhoneNumbers/+16502530000?Type=carrier"
}
Lookup with Carrier Caller Name
curl -X GET https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?AddOns=whitepages_pro_caller_id -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:{AuthToken}'
{
  "caller_name": null,
  "country_code": "US",
  "phone_number": "+16502530000",
  "national_format": "(650) 253-0000",
  "carrier": null,
  "add_ons": {
    "status": "successful",
    "message": null,
    "code": null,
    "results": {
      "whitepages_pro_caller_id": {
        "status": "successful",
        "message": null,
        "code": null,
        "result": {
          "results": [
            {
              "id": {
                "key": "Phone.77a16fef-a2e1-4b08-cfe3-bc7128b70729.Durable",
                "type": "Phone"
              },
              "line_type": "NonFixedVOIP",
              "belongs_to": [
                {
                  "id": {
                    "key": "Business.4b59c121-45ce-4750-9b5b-55ba1c15e037.Durable",
                    "type": "Business"
                  },
                  "name": "Captura Mexico",
                  "locations": null,
                  "phones": null
                }
              ],
              "associated_locations": [
                {
                  "id": {
                    "key": "Location.854f08f9-e083-4f54-8a8e-99ac6e5d034c.Durable",
                    "type": "Location"
                  },
                  "type": "Address",
                  "valid_for": null,
                  "legal_entities_at": null,
                  "city": "Mountain View",
                  "postal_code": "94043",
                  "zip4": "1351",
                  "state_code": "CA",
                  "country_code": "US",
                  "is_receiving_mail": true,
                  "not_receiving_mail_reason": null,
                  "usage": "Business",
                  "delivery_point": "SingleUnit",
                  "address_type": "Street",
                  "lat_long": {
                    "latitude": 37.42197,
                    "longitude": -122.084137,
                    "accuracy": "RoofTop"
                  },
                  "is_deliverable": true,
                  "standard_address_line1": "1600 Amphitheatre Pkwy",
                  "standard_address_line2": "",
                  "is_historical": false
                }
              ],
              "is_valid": true,
              "phone_number": "6502530000",
              "country_calling_code": "1",
              "carrier": "Level 3 Communications",
              "is_prepaid": false
            }
          ],
          "messages": []
        },
        "requestSid": "XR54a299cf993e4a243dffe355be134f91"
      }
    }
  },
  "url": "https://lookups.twilio.com/v1/PhoneNumbers/+16502530000"
}
Use Lookup Add-ons to get additional information for a phone number

Use the Whitepages Pro Add-on with Lookups. (You will need to install the Add-on via the Console before using it with Lookups)

Lookup with Add-on enabled
  • C#
  • curl
  • Java
  • Node.js
  • PHP
  • Python
  • Ruby
SDK Version:
  • 4.x
  • 5.x
SDK Version:
  • 6.x
  • 7.x
SDK Version:
  • 2.x
  • 3.x
SDK Version:
  • 4.x
  • 5.x
SDK Version:
  • 5.x
  • 6.x
SDK Version:
  • 4.x
  • 5.x
$ curl -XGET 'https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?AddOns=payfone_tcpa_compliance&AddOns.payfone_tcpa_compliance.RightPartyContactedDate=20160101' \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import java.util.HashMap;
import java.util.Map;

import com.twilio.Twilio;
import com.twilio.rest.lookups.v1.PhoneNumber;

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) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);


    Map<String, Object> complianceData = new HashMap<>();
    complianceData.put("RightPartyContactedDate", "20160101");

    Map<String, Object> addOnData = new HashMap<>();
    addOnData.put("payfone_tcpa_compliance", complianceData);

    PhoneNumber number = PhoneNumber
        .fetcher(new com.twilio.type.PhoneNumber("+15108675309"))
        .setType("carrier")
        .setAddOns("payfone_tcpa_compliance")
        .setAddOnsData(addOnData)
        .fetch();

    System.out.println(number.getCarrier());
  }
}
package org.apache.http.examples.client;

import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class Example {

    public static void main(String[] args) throws Exception {
        CredentialsProvider credsProvider = new BasicCredentialsProvider();
        credsProvider.setCredentials(
                new AuthScope("lookups.twilio.com", 80),
                new UsernamePasswordCredentials("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "your_auth_token"));
        CloseableHttpClient httpclient = HttpClients.custom()
                .setDefaultCredentialsProvider(credsProvider)
                .build();
        try {
            HttpGet httpget = new HttpGet("https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?AddOns=payfone_tcpa_compliance&AddOns.payfone_tcpa_compliance.RightPartyContactedDate=20160101");

            System.out.println("Executing request " + httpget.getRequestLine());
            CloseableHttpResponse response = httpclient.execute(httpget);
            try {
                System.out.println(response.getStatusLine());
                System.out.println(EntityUtils.toString(response.getEntity()));
            } finally {
                response.close();
            }
        } finally {
            httpclient.close();
        }
    }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

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

number = client.lookups.phone_numbers("+15108675309").fetch(
    type="carrier",
    add_ons="payfone_tcpa_compliance",
    add_ons_data={
        "payfone_tcpa_compliance": {
            "RightPartyContactedDate": "20160101"
        }
    }
)

print(number.carrier['type'])
print(number.carrier['name'])
var https = require('https');
var url = require('url').parse('https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?AddOns=payfone_tcpa_compliance&AddOns.payfone_tcpa_compliance.RightPartyContactedDate=20160101');
url.auth = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token';

https.get(url, (res) => {
  res.on('data', (jsonString) => {
    var lookup = JSON.parse(jsonString);
    console.log(`Phone Number ${lookup.phone_number} is currently owned : ${lookup.add_ons.results.payfone_tcpa_compliance.result.Response.NumberMatch}`);
  });
}).on('error', (e) => {
  console.log(`Got error: ${e.message}`);
});
using Newtonsoft.Json;
using RestSharp;
using RestSharp.Authenticators;
using Newtonsoft.Json.Serialization;
using System;

class Example
{
  static void Main(string[] args)
  {
    // The C# helper library will support Add-ons in June 2016, for now we'll use a simple RestSharp HTTP client
    var client = new RestClient("https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?AddOns=payfone_tcpa_compliance&AddOns.payfone_tcpa_compliance.RightPartyContactedDate=20160101");
    // Find your Account Sid and Auth Token at twilio.com/user/account
    client.Authenticator = new HttpBasicAuthenticator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "your_auth_token");
    var request = new RestRequest(Method.GET);
    request.AddHeader("content-type", "application/json");
    request.AddHeader("accept", "application/json");

    IRestResponse response = client.Execute(request);

    dynamic result = JsonConvert.DeserializeObject(response.Content, new JsonSerializerSettings { ContractResolver = new SnakeCaseContractResolver() });

    Console.WriteLine(result.add_ons.results.payfone_tcpa_compliance.result.Description);
    Console.WriteLine(result.add_ons.results.payfone_tcpa_compliance.result.Response.NumberMatch);
  }

  public class SnakeCaseContractResolver : DefaultContractResolver
  {
    protected override string ResolvePropertyName(string propertyName)
    {
      return GetSnakeCase(propertyName);
    }

    private string GetSnakeCase(string input)
    {
      if (string.IsNullOrEmpty(input))
        return input;

      var buffer = "";

      for (var i = 0; i < input.Length; i++)
      {
        var isLast = (i == input.Length - 1);
        var isSecondFromLast = (i == input.Length - 2);

        var curr = input[i];
        var next = !isLast ? input[i + 1] : '\0';
        var afterNext = !isSecondFromLast && !isLast ? input[i + 2] : '\0';

        buffer += char.ToLower(curr);

        if (!char.IsDigit(curr) && char.IsUpper(next))
        {
          if (char.IsUpper(curr))
          {
            if (!isLast && !isSecondFromLast && !char.IsUpper(afterNext))
              buffer += "_";
          }
          else
            buffer += "_";
        }

        if (!char.IsDigit(curr) && char.IsDigit(next))
          buffer += "_";
        if (char.IsDigit(curr) && !char.IsDigit(next) && !isLast)
          buffer += "_";
      }

      return buffer;
    }
  }
}
<?php

$url = 'https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?AddOns=payfone_tcpa_compliance&AddOns.payfone_tcpa_compliance.RightPartyContactedDate=20160101';

$process = curl_init($url);
curl_setopt($process, CURLOPT_HTTPHEADER, array('Content-Type: application/json', $additionalHeaders));
curl_setopt($process, CURLOPT_USERPWD, 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token');
curl_setopt($process, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
$response = curl_exec($process);
curl_close($process);
echo($response);

?>
require 'uri'
require 'net/http'

# Use Lookups API to get information about a phone number
url = URI("https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?AddOns=payfone_tcpa_compliance&AddOns.payfone_tcpa_compliance.RightPartyContactedDate=20160101")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
# All Twilio requests use HTTP basic auth -> http://en.wikipedia.org/wiki/Basic_access_authentication
request.basic_auth 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'your_auth_token'
request["accept"] = 'application/json'
request["content-type"] = 'application/json'

response = http.request(request)
puts response.read_body
const https = require('https');
const url = require('url').parse('https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?AddOns=payfone_tcpa_compliance&AddOns.payfone_tcpa_compliance.RightPartyContactedDate=20160101');
url.auth = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token';

https.get(url, (res) => {
  res.on('data', (jsonString) => {
    const lookup = JSON.parse(jsonString);
    console.log(`Phone Number ${lookup.phone_number} is currently owned : ${lookup.add_ons.results.payfone_tcpa_compliance.result.Response.NumberMatch}`);
  });
}).on('error', (e) => {
  console.log(`Got error: ${e.message}`);
});
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using System.Collections.Generic;
using Twilio;
using Twilio.Rest.Lookups.V1;
using Twilio.Types;

class Example
{
    static void Main(string[] args)
    {
        // Find your Account SID and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";

        TwilioClient.Init(accountSid, authToken);

        var addOns = new List<string> { "payfone_tcpa_compliance" };
        var addOnsData = new Dictionary<string, object>
        {
            { "payfone_tcpa_compliance.RightPartyContactedDate", "20160101" }
        };

        var phoneNumber = PhoneNumberResource.Fetch(
            new PhoneNumber("+16502530000"),
            addOns: addOns,
            addOnsData: addOnsData);

        Console.WriteLine(phoneNumber.Carrier);
    }
}
<?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);

$number = $client->lookups
    ->phoneNumbers("+15108675309")
    ->fetch(
        array(
            "type" => "carrier",
            "addOns" => "payfone_tcpa_compliance",
            "addOnsData" => array(
                "payfone_tcpa_compliance" => array(
                    "RightPartyContactedDate" => "20160101"
                )
            )
        )
    );

echo $number->carrier["type"] . "\r\n";
echo $number->carrier["name"];
import requests

url = "https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?AddOns=payfone_tcpa_compliance&AddOns.payfone_tcpa_compliance.RightPartyContactedDate=20160101"

headers = {
    'accept': "application/json",
    'content-type': "application/json"
}

response = requests.get(url, headers=headers, auth=('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'your_auth_token'))

print(response.text)
require 'uri'
require 'net/http'

# Use Lookups API to get information about a phone number
url = URI('https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?AddOns=payfone_tcpa_compliance&AddOns.payfone_tcpa_compliance.RightPartyContactedDate=20160101')

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
# All Twilio requests use HTTP basic auth -> http://en.wikipedia.org/wiki/Basic_access_authentication
request.basic_auth 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'your_auth_token'
request['accept'] = 'application/json'
request['content-type'] = 'application/json'

response = http.request(request)
puts response.read_body
{
  "caller_name": null,
  "country_code": "US",
  "phone_number": "+16502530000",
  "national_format": "(650) 253-0000",
  "carrier": null,
  "add_ons": {
    "status": "successful",
    "message": null,
    "code": null,
    "results": {
      "payfone_tcpa_compliance": {
        "status": "successful",
        "message": null,
        "code": null,
        "result": {
          "RequestId": "XR915eb8ea1d50cc671dc60c4fed78cfe5",
          "Status": 0,
          "Description": "Success.",
          "Response": {
            "VerifyNumberTransactionId": "1139195097",
            "PayfoneAlias": null,
            "MSISDNType": "Landline",
            "NumberMatch": "I"
          }
        },
        "requestSid": "XR915eb8ea1d50cc671dc60c4fed78cfe5"
      }
    }
  },
  "url": "https://lookups.twilio.com/v1/PhoneNumbers/+16502530000"
}
Lookup with Add-on enabled

Look up a phone number including the Payfone TCPA Compliance Add-on results.

1 / 1
Loading Code Samples...
SDK Version:
  • 4.x
  • 5.x
SDK Version:
  • 6.x
  • 7.x
SDK Version:
  • 2.x
  • 3.x
SDK Version:
  • 4.x
  • 5.x
SDK Version:
  • 5.x
  • 6.x
SDK Version:
  • 4.x
  • 5.x
Format:
  • JSON
$ curl -XGET https://lookups.twilio.com/v1/PhoneNumbers/+15108675309?Type=carrier \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import java.util.HashMap;
import java.util.Map;

import com.twilio.Twilio;
import com.twilio.rest.lookups.v1.PhoneNumber;

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) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    PhoneNumber number = PhoneNumber
        .fetcher(new com.twilio.type.PhoneNumber("+15108675309"))
        .setType("carrier")
        .fetch();

    System.out.println(number.getCarrier().get("name"));
    System.out.println(number.getCarrier().get("type"));
  }
}
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.LookupsClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.lookups.PhoneNumber;

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 {
    LookupsClient client = new LookupsClient(ACCOUNT_SID, AUTH_TOKEN);

    PhoneNumber number = client.getPhoneNumber("+15108675309", true);

    System.out.println(number.getType());
    System.out.println(number.getCarrierName());
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

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

number = client.lookups.phone_numbers("+15108675309").fetch(type="carrier")

print(number.carrier['type'])
print(number.carrier['name'])
// 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 LookupsClient = require('twilio').LookupsClient;
var client = new LookupsClient(accountSid, authToken);

client.phoneNumbers('+15108675309').get({
  type: 'carrier'
}, function(error, number) {
  console.log(number.carrier.type);
  console.log(number.carrier.name);
});
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio.Lookups;

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

    // Look up a phone number in E.164 format
    var phoneNumber = lookupsClient.GetPhoneNumber("+15108675309", true);
    Console.WriteLine(phoneNumber.Carrier.Type);
    Console.WriteLine(phoneNumber.Carrier.Name);
  }
}
<?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 Lookups_Services_Twilio($sid, $token);

$number = $client->phone_numbers->get("+15108675309", array("Type" => "carrier"));

echo $number->carrier->type . "\r\n";
echo $number->carrier->name;
# Get twilio-ruby from twilio.com/docs/ruby/install
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::LookupsClient.new account_sid, auth_token

number = @client.phone_numbers.get('+15108675309', type: 'carrier')

puts number.carrier['type']
puts number.carrier['name']
// Download the Node helper library from twilio.com/docs/node/install
// These are your accountSid and authToken from https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';

const client = require('twilio')(accountSid, authToken);

client.lookups.v1
  .phoneNumbers('+15108675309')
  .fetch()
  .then((number) => console.log(number.carrier.type, number.carrier.name));
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using System.Collections.Generic;
using Twilio;
using Twilio.Rest.Lookups.V1;
using Twilio.Types;

public class Example
{
    public static void Main(string[] args)
    {
        // Find your Account SID and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";

        TwilioClient.Init(accountSid, authToken);

        // Look up a phone number in E.164 format
        var phoneNumber = PhoneNumberResource.Fetch(
            new PhoneNumber("+15108675309"),
            type: new List<string> { "carrier" });

        Console.WriteLine(phoneNumber.Carrier["name"]);
        Console.WriteLine(phoneNumber.Carrier["type"]);
    }
}
<?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);

$number = $client->lookups
    ->phoneNumbers("+15108675309")
    ->fetch(
        array("type" => "carrier")
    );

echo $number->carrier["type"] . "\r\n";
echo $number->carrier["name"];
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest.lookups import TwilioLookupsClient

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

number = client.phone_numbers.get("+15108675309", include_carrier_info=True)
print(number.carrier['type'])
print(number.carrier['name'])
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new(account_sid, auth_token)

number = @client.lookups.v1.phone_numbers('+15108675309').fetch(type: 'carrier')

puts number.carrier['type']
puts number.carrier['name']
{
    "url": "https://lookups.twilio.com/v1/PhoneNumbers/+15108675309?Type=carrier",
    "carrier": {
        "error_code": null,
        "type": "mobile",
        "name": "T-Mobile USA, Inc.",
        "mobile_network_code": "160",
        "mobile_country_code": "310"
    },
    "national_format": "(510) 867-5309",
    "phone_number": "+15108675309",
    "country_code": "US"
}
SDK Version:
  • 4.x
  • 5.x
SDK Version:
  • 6.x
  • 7.x
SDK Version:
  • 2.x
  • 3.x
SDK Version:
  • 4.x
  • 5.x
SDK Version:
  • 5.x
  • 6.x
SDK Version:
  • 4.x
  • 5.x
Format:
  • JSON
$ curl -XGET 'https://lookups.twilio.com/v1/PhoneNumbers/(510)%20867-5309?Type=carrier&CountryCode=US' \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import com.twilio.Twilio;
import com.twilio.rest.lookups.v1.PhoneNumber;

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 UnsupportedEncodingException {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    String nationalNumber = URLEncoder.encode("(510) 867-5309", "UTF-8").replaceAll("\\+", "%20");

    PhoneNumber number = PhoneNumber
        .fetcher(new com.twilio.type.PhoneNumber(nationalNumber))
        .setType("carrier")
        .setCountryCode("US")
        .fetch();

    System.out.println(number.getCarrier().get("name"));
    System.out.println(number.getCarrier().get("type"));
  }
}
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.LookupsClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.lookups.PhoneNumber;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

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, UnsupportedEncodingException {
    LookupsClient client = new LookupsClient(ACCOUNT_SID, AUTH_TOKEN);

    String nationalNumber = URLEncoder.encode("(510) 867-5309", "UTF-8")
                            .replaceAll("\\+", "%20");
    PhoneNumber number = client.getPhoneNumber(nationalNumber, "US", true);

    System.out.println(number.getType());
    System.out.println(number.getCarrierName());
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

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

number = client.lookups.phone_numbers("+15108675309").fetch(
    type="carrier",
    country_code="US"
)

print(number.carrier['type'])
print(number.carrier['name'])
// Download the Node helper library from twilio.com/docs/node/install
// These consts are your accountSid and authToken from twilio.com/user/account
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const LookupsClient = require('twilio').LookupsClient;
const client = new LookupsClient(accountSid, authToken);

client.phoneNumbers('(510) 867-5309').get({
  countryCode: 'US',
  type: 'carrier'
}, function(error, number) {
  console.log(number.carrier.type);
  console.log(number.carrier.name);
});
});
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio.Lookups;

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

    // Look up a phone number in local format
    var phoneNumber = lookupsClient.GetPhoneNumber("(510) 867-5309", "US", true);
    Console.WriteLine(phoneNumber.Carrier.Type);
    Console.WriteLine(phoneNumber.Carrier.Name); 
  }
}
<?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 Lookups_Services_Twilio($sid, $token);

$number = $client->phone_numbers->get("(510) 867-5309", array("CountryCode" => "US", "Type" => "carrier"));

echo $number->carrier->type . "\r\n";
echo $number->carrier->name;
# Get twilio-ruby from twilio.com/docs/ruby/install
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::LookupsClient.new account_sid, auth_token

number = @client.phone_numbers.get('(510) 867-5309', country_code: 'US', type: 'carrier')

puts number.carrier['type']
puts number.carrier['name']
// Download the Node helper library from twilio.com/docs/node/install
// These are your accountSid and authToken from https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';

const client = require('twilio')(accountSid, authToken);

client.lookups.v1
  .phoneNumbers('(510) 867-5309')
  .fetch({countryCode: 'US', type: 'carrier'})
  .then((number) => console.log(number.carrier.type, number.carrier.name));
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using System.Collections.Generic;
using Twilio;
using Twilio.Rest.Lookups.V1;
using Twilio.Types;

public class Example
{
    public static void Main(string[] args)
    {
        // Find your Account SID and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";

        TwilioClient.Init(accountSid, authToken);

        // Look up a phone number in local format
        var phoneNumber = PhoneNumberResource.Fetch(
            new PhoneNumber("(510) 867-5309"),
            "US",
            new List<string> { "carrier" });

        Console.WriteLine(phoneNumber.Carrier["name"]);
        Console.WriteLine(phoneNumber.Carrier["type"]);
    }
}
<?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);

$number = $client->lookups
    ->phoneNumbers("+15108675309")
    ->fetch(
        array("countryCode" => "US", "type" => "carrier")
    );

echo $number->carrier["type"] . "\r\n";
echo $number->carrier["name"];
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest.lookups import TwilioLookupsClient

try:
    # Python 3
    from urllib.parse import quote
except ImportError:
    # Python 2
    from urllib import quote

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

encoded_number = quote('(510) 867-5309')
number = client.phone_numbers.get(encoded_number, include_carrier_info=True,
                                  country_code="US")
print(number.carrier['type'])
print(number.carrier['name'])
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new(account_sid, auth_token)

encoded_phone_number = URI.encode('(510) 867-5309')
number = @client.lookups.v1
                .phone_numbers(encoded_phone_number)
                .fetch(country_code: 'US', type: 'carrier')

puts number.carrier['type']
puts number.carrier['name']
{
    "url": "https://lookups.twilio.com/v1/PhoneNumbers/+15108675309?Type=carrier",
    "carrier": {
        "error_code": null,
        "type": "mobile",
        "name": "T-Mobile USA, Inc.",
        "mobile_network_code": "160",
        "mobile_country_code": "310"
    },
    "national_format": "(510) 867-5309",
    "phone_number": "+15108675309",
    "country_code": "US"
}
Format:
  • JSON
$ curl -XGET https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?Type=caller-name \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.rest.lookups.v1.PhoneNumber;

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) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    PhoneNumber number = PhoneNumber
        .fetcher(new com.twilio.type.PhoneNumber("+15108675309"))
        .setType("caller-name")
        .fetch();

    System.out.println(number.getCallerName());
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

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

number = client.lookups.phone_numbers("15108675309").fetch(
    type="caller-name",
)

print(number.carrier['type'])
print(number.carrier['name'])
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using System.Collections.Generic;
using Twilio;
using Twilio.Rest.Lookups.V1;
using Twilio.Types;

public class Example
{
	public static void Main(string[] args)
	{
		// Find your Account SID and Auth Token at twilio.com/console
		const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
		const string authToken = "your_auth_token";

		TwilioClient.Init(accountSid, authToken);

		var phoneNumber = PhoneNumberResource.Fetch(
		    new PhoneNumber("+15108675309"),
		    type: new List<string> { "caller-name" });

		Console.WriteLine(phoneNumber.CallerName["caller_name"]);
	}
}
<?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);

$number = $client->lookups
    ->phoneNumbers("+14157012311")
    ->fetch(
        array("type" => "caller-name")
    );

echo $number->callerName['caller_type'] . "\r\n";
echo $number->callerName['caller_name'];
{
  "caller_name": {
    "caller_name": "YOU TUBE",
    "caller_type": "BUSINESS",
    "error_code": null
  },
  "country_code": "US",
  "phone_number": "+16502530000",
  "national_format": "(650) 253-0000",
  "carrier": null,
  "url": "https://lookups.twilio.com/v1/PhoneNumbers/+16502530000"
}
Format:
  • JSON
$ curl -XGET "https://lookups.twilio.com/v1/PhoneNumbers/+15108675309/?Type=carrier&Type=caller-name" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.lookups.v1.PhoneNumber;

import java.util.Arrays;

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) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

        PhoneNumber number = PhoneNumber
                .fetcher(new com.twilio.type.PhoneNumber("+15108675309"))
                .setType(Arrays.asList("caller-name", "carrier"))
                .fetch();

        System.out.println(number.getCallerName());
    }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

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

number = client.lookups.phone_numbers("15108675309").fetch(
    type=["carrier", "caller-name"],
)

print(number.carrier['type'])
print(number.carrier['name'])
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using System.Collections.Generic;
using Twilio;
using Twilio.Rest.Lookups.V1;
using Twilio.Types;

public class Example
{
    public static void Main(string[] args)
    {
        // Find your Account SID and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";

        TwilioClient.Init(accountSid, authToken);

        var phoneNumber = PhoneNumberResource.Fetch(
            new PhoneNumber("+15108675309"),
            type: new List<string> { "caller-name", "carrier" });

        Console.WriteLine(phoneNumber.CallerName["caller_name"]);
    }
}
<?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);

$number = $client->lookups
    ->phoneNumbers("+15108675309")
    ->fetch(
        array(
            "type" => array("carrier", "caller-name")
        )
    );

echo $number->carrier["type"] . "\r\n";
echo $number->carrier["name"];
{
  "caller_name": {
    "caller_name": "YOU TUBE",
    "caller_type": "BUSINESS",
    "error_code": null
  },
  "country_code": "US",
  "phone_number": "+16502530000",
  "national_format": "(650) 253-0000",
  "carrier": {
    "mobile_country_code": null,
    "mobile_network_code": null,
    "name": "Level 3 Communications, LLC",
    "type": "landline",
    "error_code": null
  },
  "url": "https://lookups.twilio.com/v1/PhoneNumbers/+16502530000?Type=carrier"
}
Format:
  • JSON
curl -X GET https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?AddOns=whitepages_pro_caller_id -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:{AuthToken}'
{
  "caller_name": null,
  "country_code": "US",
  "phone_number": "+16502530000",
  "national_format": "(650) 253-0000",
  "carrier": null,
  "add_ons": {
    "status": "successful",
    "message": null,
    "code": null,
    "results": {
      "whitepages_pro_caller_id": {
        "status": "successful",
        "message": null,
        "code": null,
        "result": {
          "results": [
            {
              "id": {
                "key": "Phone.77a16fef-a2e1-4b08-cfe3-bc7128b70729.Durable",
                "type": "Phone"
              },
              "line_type": "NonFixedVOIP",
              "belongs_to": [
                {
                  "id": {
                    "key": "Business.4b59c121-45ce-4750-9b5b-55ba1c15e037.Durable",
                    "type": "Business"
                  },
                  "name": "Captura Mexico",
                  "locations": null,
                  "phones": null
                }
              ],
              "associated_locations": [
                {
                  "id": {
                    "key": "Location.854f08f9-e083-4f54-8a8e-99ac6e5d034c.Durable",
                    "type": "Location"
                  },
                  "type": "Address",
                  "valid_for": null,
                  "legal_entities_at": null,
                  "city": "Mountain View",
                  "postal_code": "94043",
                  "zip4": "1351",
                  "state_code": "CA",
                  "country_code": "US",
                  "is_receiving_mail": true,
                  "not_receiving_mail_reason": null,
                  "usage": "Business",
                  "delivery_point": "SingleUnit",
                  "address_type": "Street",
                  "lat_long": {
                    "latitude": 37.42197,
                    "longitude": -122.084137,
                    "accuracy": "RoofTop"
                  },
                  "is_deliverable": true,
                  "standard_address_line1": "1600 Amphitheatre Pkwy",
                  "standard_address_line2": "",
                  "is_historical": false
                }
              ],
              "is_valid": true,
              "phone_number": "6502530000",
              "country_calling_code": "1",
              "carrier": "Level 3 Communications",
              "is_prepaid": false
            }
          ],
          "messages": []
        },
        "requestSid": "XR54a299cf993e4a243dffe355be134f91"
      }
    }
  },
  "url": "https://lookups.twilio.com/v1/PhoneNumbers/+16502530000"
}
SDK Version:
  • 4.x
  • 5.x
SDK Version:
  • 6.x
  • 7.x
SDK Version:
  • 2.x
  • 3.x
SDK Version:
  • 4.x
  • 5.x
SDK Version:
  • 5.x
  • 6.x
SDK Version:
  • 4.x
  • 5.x
Format:
  • JSON
$ curl -XGET 'https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?AddOns=payfone_tcpa_compliance&AddOns.payfone_tcpa_compliance.RightPartyContactedDate=20160101' \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import java.util.HashMap;
import java.util.Map;

import com.twilio.Twilio;
import com.twilio.rest.lookups.v1.PhoneNumber;

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) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);


    Map<String, Object> complianceData = new HashMap<>();
    complianceData.put("RightPartyContactedDate", "20160101");

    Map<String, Object> addOnData = new HashMap<>();
    addOnData.put("payfone_tcpa_compliance", complianceData);

    PhoneNumber number = PhoneNumber
        .fetcher(new com.twilio.type.PhoneNumber("+15108675309"))
        .setType("carrier")
        .setAddOns("payfone_tcpa_compliance")
        .setAddOnsData(addOnData)
        .fetch();

    System.out.println(number.getCarrier());
  }
}
package org.apache.http.examples.client;

import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class Example {

    public static void main(String[] args) throws Exception {
        CredentialsProvider credsProvider = new BasicCredentialsProvider();
        credsProvider.setCredentials(
                new AuthScope("lookups.twilio.com", 80),
                new UsernamePasswordCredentials("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "your_auth_token"));
        CloseableHttpClient httpclient = HttpClients.custom()
                .setDefaultCredentialsProvider(credsProvider)
                .build();
        try {
            HttpGet httpget = new HttpGet("https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?AddOns=payfone_tcpa_compliance&AddOns.payfone_tcpa_compliance.RightPartyContactedDate=20160101");

            System.out.println("Executing request " + httpget.getRequestLine());
            CloseableHttpResponse response = httpclient.execute(httpget);
            try {
                System.out.println(response.getStatusLine());
                System.out.println(EntityUtils.toString(response.getEntity()));
            } finally {
                response.close();
            }
        } finally {
            httpclient.close();
        }
    }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

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

number = client.lookups.phone_numbers("+15108675309").fetch(
    type="carrier",
    add_ons="payfone_tcpa_compliance",
    add_ons_data={
        "payfone_tcpa_compliance": {
            "RightPartyContactedDate": "20160101"
        }
    }
)

print(number.carrier['type'])
print(number.carrier['name'])
var https = require('https');
var url = require('url').parse('https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?AddOns=payfone_tcpa_compliance&AddOns.payfone_tcpa_compliance.RightPartyContactedDate=20160101');
url.auth = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token';

https.get(url, (res) => {
  res.on('data', (jsonString) => {
    var lookup = JSON.parse(jsonString);
    console.log(`Phone Number ${lookup.phone_number} is currently owned : ${lookup.add_ons.results.payfone_tcpa_compliance.result.Response.NumberMatch}`);
  });
}).on('error', (e) => {
  console.log(`Got error: ${e.message}`);
});
using Newtonsoft.Json;
using RestSharp;
using RestSharp.Authenticators;
using Newtonsoft.Json.Serialization;
using System;

class Example
{
  static void Main(string[] args)
  {
    // The C# helper library will support Add-ons in June 2016, for now we'll use a simple RestSharp HTTP client
    var client = new RestClient("https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?AddOns=payfone_tcpa_compliance&AddOns.payfone_tcpa_compliance.RightPartyContactedDate=20160101");
    // Find your Account Sid and Auth Token at twilio.com/user/account
    client.Authenticator = new HttpBasicAuthenticator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "your_auth_token");
    var request = new RestRequest(Method.GET);
    request.AddHeader("content-type", "application/json");
    request.AddHeader("accept", "application/json");

    IRestResponse response = client.Execute(request);

    dynamic result = JsonConvert.DeserializeObject(response.Content, new JsonSerializerSettings { ContractResolver = new SnakeCaseContractResolver() });

    Console.WriteLine(result.add_ons.results.payfone_tcpa_compliance.result.Description);
    Console.WriteLine(result.add_ons.results.payfone_tcpa_compliance.result.Response.NumberMatch);
  }

  public class SnakeCaseContractResolver : DefaultContractResolver
  {
    protected override string ResolvePropertyName(string propertyName)
    {
      return GetSnakeCase(propertyName);
    }

    private string GetSnakeCase(string input)
    {
      if (string.IsNullOrEmpty(input))
        return input;

      var buffer = "";

      for (var i = 0; i < input.Length; i++)
      {
        var isLast = (i == input.Length - 1);
        var isSecondFromLast = (i == input.Length - 2);

        var curr = input[i];
        var next = !isLast ? input[i + 1] : '\0';
        var afterNext = !isSecondFromLast && !isLast ? input[i + 2] : '\0';

        buffer += char.ToLower(curr);

        if (!char.IsDigit(curr) && char.IsUpper(next))
        {
          if (char.IsUpper(curr))
          {
            if (!isLast && !isSecondFromLast && !char.IsUpper(afterNext))
              buffer += "_";
          }
          else
            buffer += "_";
        }

        if (!char.IsDigit(curr) && char.IsDigit(next))
          buffer += "_";
        if (char.IsDigit(curr) && !char.IsDigit(next) && !isLast)
          buffer += "_";
      }

      return buffer;
    }
  }
}
<?php

$url = 'https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?AddOns=payfone_tcpa_compliance&AddOns.payfone_tcpa_compliance.RightPartyContactedDate=20160101';

$process = curl_init($url);
curl_setopt($process, CURLOPT_HTTPHEADER, array('Content-Type: application/json', $additionalHeaders));
curl_setopt($process, CURLOPT_USERPWD, 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token');
curl_setopt($process, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
$response = curl_exec($process);
curl_close($process);
echo($response);

?>
require 'uri'
require 'net/http'

# Use Lookups API to get information about a phone number
url = URI("https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?AddOns=payfone_tcpa_compliance&AddOns.payfone_tcpa_compliance.RightPartyContactedDate=20160101")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
# All Twilio requests use HTTP basic auth -> http://en.wikipedia.org/wiki/Basic_access_authentication
request.basic_auth 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'your_auth_token'
request["accept"] = 'application/json'
request["content-type"] = 'application/json'

response = http.request(request)
puts response.read_body
const https = require('https');
const url = require('url').parse('https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?AddOns=payfone_tcpa_compliance&AddOns.payfone_tcpa_compliance.RightPartyContactedDate=20160101');
url.auth = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token';

https.get(url, (res) => {
  res.on('data', (jsonString) => {
    const lookup = JSON.parse(jsonString);
    console.log(`Phone Number ${lookup.phone_number} is currently owned : ${lookup.add_ons.results.payfone_tcpa_compliance.result.Response.NumberMatch}`);
  });
}).on('error', (e) => {
  console.log(`Got error: ${e.message}`);
});
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using System.Collections.Generic;
using Twilio;
using Twilio.Rest.Lookups.V1;
using Twilio.Types;

class Example
{
    static void Main(string[] args)
    {
        // Find your Account SID and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";

        TwilioClient.Init(accountSid, authToken);

        var addOns = new List<string> { "payfone_tcpa_compliance" };
        var addOnsData = new Dictionary<string, object>
        {
            { "payfone_tcpa_compliance.RightPartyContactedDate", "20160101" }
        };

        var phoneNumber = PhoneNumberResource.Fetch(
            new PhoneNumber("+16502530000"),
            addOns: addOns,
            addOnsData: addOnsData);

        Console.WriteLine(phoneNumber.Carrier);
    }
}
<?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);

$number = $client->lookups
    ->phoneNumbers("+15108675309")
    ->fetch(
        array(
            "type" => "carrier",
            "addOns" => "payfone_tcpa_compliance",
            "addOnsData" => array(
                "payfone_tcpa_compliance" => array(
                    "RightPartyContactedDate" => "20160101"
                )
            )
        )
    );

echo $number->carrier["type"] . "\r\n";
echo $number->carrier["name"];
import requests

url = "https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?AddOns=payfone_tcpa_compliance&AddOns.payfone_tcpa_compliance.RightPartyContactedDate=20160101"

headers = {
    'accept': "application/json",
    'content-type': "application/json"
}

response = requests.get(url, headers=headers, auth=('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'your_auth_token'))

print(response.text)
require 'uri'
require 'net/http'

# Use Lookups API to get information about a phone number
url = URI('https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?AddOns=payfone_tcpa_compliance&AddOns.payfone_tcpa_compliance.RightPartyContactedDate=20160101')

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
# All Twilio requests use HTTP basic auth -> http://en.wikipedia.org/wiki/Basic_access_authentication
request.basic_auth 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'your_auth_token'
request['accept'] = 'application/json'
request['content-type'] = 'application/json'

response = http.request(request)
puts response.read_body
{
  "caller_name": null,
  "country_code": "US",
  "phone_number": "+16502530000",
  "national_format": "(650) 253-0000",
  "carrier": null,
  "add_ons": {
    "status": "successful",
    "message": null,
    "code": null,
    "results": {
      "payfone_tcpa_compliance": {
        "status": "successful",
        "message": null,
        "code": null,
        "result": {
          "RequestId": "XR915eb8ea1d50cc671dc60c4fed78cfe5",
          "Status": 0,
          "Description": "Success.",
          "Response": {
            "VerifyNumberTransactionId": "1139195097",
            "PayfoneAlias": null,
            "MSISDNType": "Landline",
            "NumberMatch": "I"
          }
        },
        "requestSid": "XR915eb8ea1d50cc671dc60c4fed78cfe5"
      }
    }
  },
  "url": "https://lookups.twilio.com/v1/PhoneNumbers/+16502530000"
}