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, Caller Name and Fraud 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, Fraud 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, caller-name or fraud. 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.
Fraud information costs $X.XX per phone number looked up, and is currently ONLY available in the US and CA.
You can retrieve all types of information by including three Type arguments or making three separate requests.
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.

Fraud

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

Property Description
IsPrepaid If the phone number is associated to a prepaid phone carrier. Possible values are true, false. If the prepaid status is not available, this will return null.
MobileCountryCode The mobile country code of the carrier (for mobile numbers only).
MobileNetworkCode The mobile network code of the carrier (for mobile numbers only).
CarrierName 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.
AdvanceLineType The phone number type. Possible values are mobile, landline, fixed_voip, non_fixed_voip, voicemail, toll_free, premium, other or unknown. See 'Phone Number Advance Type' below for more information.
CallerName String indicating the name of the owner of the phone number. If not available, this will return null.
ErrorCode The error code, if any, associated with your request.
Phone Number Advance Types

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

Type Description
mobile The phone number is a mobile number generally capable of receiving SMS messages.
landline The phone number is a landline number generally not capable of receiving SMS messages.
fixed_voip An internet based phone number tied to addresses that may not be capable of receiving SMS messages. For example, Comcast for instance.
non_fixed_voip An internet based phone number that may or may not be capable of receiving SMS messages. For example, Google Voice.
voicemail An phone number with Voicemail-only service, not capable of receiving SMS messages.
toll_free The phone number only capable of receiving Phone calls and the call recipient pays for call.
premium The caller to the phone number will pay a premium for the call–e.g. 976 area code
other The phone number type does not match with the previous types described.
unknown The line type for the phone number cannot be determined.

Examples

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

Loading Code Samples...
Language
SDK Version:
  • 4.x
  • 5.x
Response Format:
  • json
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
// Download the Node helper library from twilio.com/docs/node/install
// These vars 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('+15108675310').get({
  type: 'carrier',
}, (error, number) => {
  console.log(number.carrier.type);
  console.log(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('+15108675310')
  .fetch({type: 'carrier'})
  .then(response => console.log(response.carrier))
  .catch(error => {
    if (error.status === 404) {
      console.log('No carrier information');
    } else {
      console.log(error.message);
    }
  });
// 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("+15108675310", true);
    Console.WriteLine(phoneNumber.Carrier.Type);
    Console.WriteLine(phoneNumber.Carrier.Name);
  }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
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("+15108675310", 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('+15108675310', type: 'carrier')

puts number.carrier['type']
puts 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;
using Twilio.Exceptions;

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

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

          Console.WriteLine(phoneNumber.Carrier["name"]);
          Console.WriteLine(phoneNumber.Carrier["type"]);
        } catch (ApiException e) {
          if (e.Status == 404) {
            Console.WriteLine("No carrier information");
          } else {
            Console.WriteLine(e.ToString());
          }
        }
    }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
require_once '/path/to/vendor/autoload.php'; // Loads the library

use Twilio\Rest\Client;
use Twilio\Exceptions\RestException;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";

$client = new Client($sid, $token);

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

  echo $number->carrier["type"] . "\r\n";
  echo $number->carrier["name"];
} catch (RestException $e) {
    if ($e->getStatusCode() == "404") {
        echo "No carrier information.\n";
    } else {
        throw $e;
    }
}
# 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("+15108675310", 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)

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

  puts number.carrier['type']
  puts number.carrier['name']
rescue Twilio::REST::RestError => err
  if err.status_code === 404
    puts 'No carrier information'
  else
    puts err.message
  end
end
// 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("+15108675310", 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)


try:
    number = client.lookups.phone_numbers("+15108675310").fetch(type="carrier")

    print(number.carrier['type'])
    print(number.carrier['name'])
except TwilioRestException as error:
    if error.status == 404:
        print('No carrier information')
    else:
        raise error
// 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;
import com.twilio.exception.ApiException;

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

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

      System.out.println(number.getCarrier().get("name"));
      System.out.println(number.getCarrier().get("type"));
    } catch (ApiException e) {
      if (e.getStatusCode() == 404) {
        System.out.println("No carrier information");
      } else {
        System.out.println(e.getMessage());
      }
    }
  }
}
curl -XGET https://lookups.twilio.com/v1/PhoneNumbers/+15108675310?Type=carrier \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
{
    "url": "https://lookups.twilio.com/v1/PhoneNumbers/+15108675310?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-5310",
    "phone_number": "+15108675310",
    "country_code": "US"
}
Look up a phone number in the E.164 format
Lookup with E.164 Formatted Number

Look up a phone number in the E.164 format

Loading Code Samples...
Language
SDK Version:
  • 4.x
  • 5.x
Response Format:
  • json
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
// 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-5310').get({
  countryCode: 'US',
  type: 'carrier',
}, (error, number) => {
  console.log(number.carrier.type);
  console.log(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-5310')
  .fetch({ countryCode: 'US', type: 'carrier' })
  .then(number => console.log(number.carrier.type, 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-5310", "US", true);
    Console.WriteLine(phoneNumber.Carrier.Type);
    Console.WriteLine(phoneNumber.Carrier.Name); 
  }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
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-5310", 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-5310', country_code: 'US', type: 'carrier')

puts number.carrier['type']
puts 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-5310"),
            "US",
            new List<string> { "carrier" });

        Console.WriteLine(phoneNumber.Carrier["name"]);
        Console.WriteLine(phoneNumber.Carrier["type"]);
    }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
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("+15108675310")
    ->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-5310')
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'
require 'cgi'

# 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 = CGI.escape('(510) 867-5310')
number = @client.lookups.v1
                .phone_numbers(encoded_phone_number)
                .fetch(country_code: 'US', type: 'carrier')

puts number.carrier['type']
puts number.carrier['name']
// 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-5310", "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("+15108675310").fetch(
    type="carrier", country_code="US"
)

print(number.carrier['type'])
print(number.carrier['name'])
// 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-5310", "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"));
  }
}
curl -XGET 'https://lookups.twilio.com/v1/PhoneNumbers/(510)%20867-5310?Type=carrier&CountryCode=US' \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
{
    "url": "https://lookups.twilio.com/v1/PhoneNumbers/+15108675310?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-5310",
    "phone_number": "+15108675310",
    "country_code": "US"
}
Lookup with National Formatted Number

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

Loading Code Samples...
Language
SDK Version:
  • 5.x
Response Format:
  • json
SDK Version:
  • 7.x
SDK Version:
  • 3.x
SDK Version:
  • 5.x
SDK Version:
  • 6.x
SDK Version:
  • 5.x
Format:
  • JSON
// 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('+16502530000')
  .fetch({ type: 'caller-name' })
  .then(number => console.log(number));
// 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("+16502530000"),
		    type: new List<string> { "caller-name" });

		Console.WriteLine(phoneNumber.CallerName["caller_name"]);
	}
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
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("+16502530000")
    ->fetch(
        array("type" => "caller-name")
    );

echo $number->callerName['caller_type'] . "\r\n";
echo $number->callerName['caller_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 = CGI.escape('+16502530000')
number = @client.lookups.v1
                .phone_numbers(encoded_phone_number)
                .fetch(type: 'caller-name')

puts number.carrier['type']
puts number.carrier['name']
# 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("+16502530000").fetch(
    type="caller-name",
)

print(number.carrier['type'])
print(number.carrier['name'])
// 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("+16502530000"))
        .setType("caller-name")
        .fetch();

    System.out.println(number.getCallerName());
  }
}
$ curl -XGET https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?Type=caller-name \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
{
  "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
Loading Code Samples...
Language
SDK Version:
  • 5.x
Response Format:
  • json
SDK Version:
  • 7.x
SDK Version:
  • 3.x
SDK Version:
  • 5.x
SDK Version:
  • 6.x
SDK Version:
  • 5.x
Format:
  • JSON
// 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('+15108675310')
  .fetch({ type: ['carrier', 'caller-name'] })
  .then(number => console.log(number));
// 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("+15108675310"),
            type: new List<string> { "caller-name", "carrier" });

        Console.WriteLine(phoneNumber.CallerName["caller_name"]);
    }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
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("+15108675310")
    ->fetch(
        array(
            "type" => array("carrier", "caller-name")
        )
    );

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/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new(account_sid, auth_token)

encoded_phone_number = CGI.escape('+15108675310')
number = @client.lookups.v1
                .phone_numbers(encoded_phone_number)
                .fetch(type: ['carrier', 'caller-name'])

puts number.carrier['type']
puts number.carrier['name']
# 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("15108675310").fetch(
    type=["carrier", "caller-name"],
)

print(number.carrier['type'])
print(number.carrier['name'])
// 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("+15108675310"))
                .setType(Arrays.asList("caller-name", "carrier"))
                .fetch();

        System.out.println(number.getCallerName());
    }
}
curl -XGET "https://lookups.twilio.com/v1/PhoneNumbers/+15108675310/?Type=carrier&Type=caller-name" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
{
  "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
Loading Code Samples...
Language
Response Format:
  • json
Format:
  • JSON
$ curl -XGET https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?Type=fraud \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
# 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 = CGI.escape('+16502530000')
number = @client.lookups.v1
                .phone_numbers(encoded_phone_number)
                .fetch(type: ['fraud'])

puts number.fraud['advanced_line_type']
{
  "caller_name": null,
  "country_code": "US",
  "phone_number": "+16502530000",
  "national_format": "(650) 253-0000",
  "carrier": null,
  "fraud": {
    "is_prepaid": false,
    "mobile_country_code": null,
    "mobile_network_code": null,
    "carrier_name": "Level 3 Communications",
    "advanced_line_type": "non_fixed_voip",
    "caller_name": "YOU TUBE",
    "error_code": null
  },
  "add_ons": null,
  "url": "https://lookups.twilio.com/v1/PhoneNumbers/+16502530000"
}
Lookup to get Fraud information
Loading Code Samples...
Language
SDK Version:
  • 5.x
Response Format:
  • json
SDK Version:
  • 7.x
SDK Version:
  • 3.x
SDK Version:
  • 5.x
SDK Version:
  • 6.x
SDK Version:
  • 5.x
Format:
  • JSON
// 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('+16502530000')
  .fetch({ addOns: 'whitepages_pro_caller_id' })
  .then(number => console.log(number));
// 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("+16502530000"),
		    addOns: new List<string> { "whitepages_pro_caller_id" });

		Console.WriteLine(phoneNumber.CallerName["caller_name"]);
	}
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
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("+16502530000")
    ->fetch(
        array("add_ons" => "whitepages_pro_caller_id")
    );

echo $number->callerName['caller_type'] . "\r\n";
echo $number->callerName['caller_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 = CGI.escape('+16502530000')
number = @client.lookups.v1
                .phone_numbers(encoded_phone_number)
                .fetch(add_ons: 'whitepages_pro_caller_id')

puts number.carrier['type']
puts number.carrier['name']
# 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("+16502530000").fetch(
    add_ons="whitepages_pro_caller_id",
)

print(number.carrier['type'])
print(number.carrier['name'])
// Install the Java helper library from twilio.com/docs/libraries/java
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("+16502530000"))
        .setAddOns("whitepages_pro_caller_id")
        .fetch();

    System.out.println(number.getCallerName());
  }
}
curl -X GET https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?AddOns=whitepages_pro_caller_id \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
{
  "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"
}
Use Lookup Add-ons to get additional information for a phone number
Loading Code Samples...
Language
SDK Version:
  • 4.x
  • 5.x
Response Format:
  • json
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
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);
      const numberMatch =
        lookup.add_ons.results &&
        lookup.add_ons.results.payfone_tcpa_compliance.result.Response
          .NumberMatch;
      console.log(
        `Phone Number ${lookup.phone_number} is currently owned : ${numberMatch}`
      );
    });
  })
  .on('error', e => {
    console.log(`Got error: ${e.message}`);
  });
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);
      const numberMatch =
        lookup.add_ons.results &&
        lookup.add_ons.results.payfone_tcpa_compliance.result.Response
          .NumberMatch;
      console.log(
        `Phone Number ${lookup.phone_number} is currently owned : ${numberMatch}`
      );
    });
  })
  .on('error', e => {
    console.log(`Got error: ${e.message}`);
  });
using Newtonsoft.Json;
using RestSharp;
using RestSharp.Authenticators;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;

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<Dictionary<string, string>>(
            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
// 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 https://twilio.com/docs/libraries/php
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("+15108675310")
    ->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
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("+15108675310").fetch(
    type="carrier",
    add_ons="payfone_tcpa_compliance",
    add_ons_data={
        "payfone_tcpa_compliance": {
            "RightPartyContactedDate": "20160101"
        }
    }
)

print(number.carrier['type'])
print(number.carrier['name'])
// 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("+15108675310"))
        .setType("carrier")
        .setAddOns("payfone_tcpa_compliance")
        .setAddOnsData(addOnData)
        .fetch();

    System.out.println(number.getCarrier());
  }
}
$ curl -XGET 'https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?AddOns=payfone_tcpa_compliance&AddOns.payfone_tcpa_compliance.RightPartyContactedDate=20160101' \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
testable: true
test_output: false
exclude_languages:
  - python
  - java6
{
  "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"
}
Look up a phone number including the Payfone TCPA Compliance Add-on results.
Lookup with Add-on enabled

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

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.

Loading Code Samples...
SDK Version:
  • 4.x
  • 5.x
Response Format:
  • json
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
// Download the Node helper library from twilio.com/docs/node/install
// These vars 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('+15108675310').get({
  type: 'carrier',
}, (error, number) => {
  console.log(number.carrier.type);
  console.log(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('+15108675310')
  .fetch({type: 'carrier'})
  .then(response => console.log(response.carrier))
  .catch(error => {
    if (error.status === 404) {
      console.log('No carrier information');
    } else {
      console.log(error.message);
    }
  });
// 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("+15108675310", true);
    Console.WriteLine(phoneNumber.Carrier.Type);
    Console.WriteLine(phoneNumber.Carrier.Name);
  }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
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("+15108675310", 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('+15108675310', type: 'carrier')

puts number.carrier['type']
puts 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;
using Twilio.Exceptions;

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

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

          Console.WriteLine(phoneNumber.Carrier["name"]);
          Console.WriteLine(phoneNumber.Carrier["type"]);
        } catch (ApiException e) {
          if (e.Status == 404) {
            Console.WriteLine("No carrier information");
          } else {
            Console.WriteLine(e.ToString());
          }
        }
    }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
require_once '/path/to/vendor/autoload.php'; // Loads the library

use Twilio\Rest\Client;
use Twilio\Exceptions\RestException;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";

$client = new Client($sid, $token);

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

  echo $number->carrier["type"] . "\r\n";
  echo $number->carrier["name"];
} catch (RestException $e) {
    if ($e->getStatusCode() == "404") {
        echo "No carrier information.\n";
    } else {
        throw $e;
    }
}
# 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("+15108675310", 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)

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

  puts number.carrier['type']
  puts number.carrier['name']
rescue Twilio::REST::RestError => err
  if err.status_code === 404
    puts 'No carrier information'
  else
    puts err.message
  end
end
// 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("+15108675310", 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)


try:
    number = client.lookups.phone_numbers("+15108675310").fetch(type="carrier")

    print(number.carrier['type'])
    print(number.carrier['name'])
except TwilioRestException as error:
    if error.status == 404:
        print('No carrier information')
    else:
        raise error
// 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;
import com.twilio.exception.ApiException;

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

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

      System.out.println(number.getCarrier().get("name"));
      System.out.println(number.getCarrier().get("type"));
    } catch (ApiException e) {
      if (e.getStatusCode() == 404) {
        System.out.println("No carrier information");
      } else {
        System.out.println(e.getMessage());
      }
    }
  }
}
curl -XGET https://lookups.twilio.com/v1/PhoneNumbers/+15108675310?Type=carrier \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
{
    "url": "https://lookups.twilio.com/v1/PhoneNumbers/+15108675310?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-5310",
    "phone_number": "+15108675310",
    "country_code": "US"
}
SDK Version:
  • 4.x
  • 5.x
Response Format:
  • json
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
// 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-5310').get({
  countryCode: 'US',
  type: 'carrier',
}, (error, number) => {
  console.log(number.carrier.type);
  console.log(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-5310')
  .fetch({ countryCode: 'US', type: 'carrier' })
  .then(number => console.log(number.carrier.type, 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-5310", "US", true);
    Console.WriteLine(phoneNumber.Carrier.Type);
    Console.WriteLine(phoneNumber.Carrier.Name); 
  }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
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-5310", 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-5310', country_code: 'US', type: 'carrier')

puts number.carrier['type']
puts 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-5310"),
            "US",
            new List<string> { "carrier" });

        Console.WriteLine(phoneNumber.Carrier["name"]);
        Console.WriteLine(phoneNumber.Carrier["type"]);
    }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
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("+15108675310")
    ->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-5310')
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'
require 'cgi'

# 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 = CGI.escape('(510) 867-5310')
number = @client.lookups.v1
                .phone_numbers(encoded_phone_number)
                .fetch(country_code: 'US', type: 'carrier')

puts number.carrier['type']
puts number.carrier['name']
// 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-5310", "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("+15108675310").fetch(
    type="carrier", country_code="US"
)

print(number.carrier['type'])
print(number.carrier['name'])
// 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-5310", "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"));
  }
}
curl -XGET 'https://lookups.twilio.com/v1/PhoneNumbers/(510)%20867-5310?Type=carrier&CountryCode=US' \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
{
    "url": "https://lookups.twilio.com/v1/PhoneNumbers/+15108675310?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-5310",
    "phone_number": "+15108675310",
    "country_code": "US"
}
SDK Version:
  • 5.x
Response Format:
  • json
SDK Version:
  • 7.x
SDK Version:
  • 3.x
SDK Version:
  • 5.x
SDK Version:
  • 6.x
SDK Version:
  • 5.x
Format:
  • JSON
// 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('+16502530000')
  .fetch({ type: 'caller-name' })
  .then(number => console.log(number));
// 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("+16502530000"),
		    type: new List<string> { "caller-name" });

		Console.WriteLine(phoneNumber.CallerName["caller_name"]);
	}
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
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("+16502530000")
    ->fetch(
        array("type" => "caller-name")
    );

echo $number->callerName['caller_type'] . "\r\n";
echo $number->callerName['caller_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 = CGI.escape('+16502530000')
number = @client.lookups.v1
                .phone_numbers(encoded_phone_number)
                .fetch(type: 'caller-name')

puts number.carrier['type']
puts number.carrier['name']
# 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("+16502530000").fetch(
    type="caller-name",
)

print(number.carrier['type'])
print(number.carrier['name'])
// 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("+16502530000"))
        .setType("caller-name")
        .fetch();

    System.out.println(number.getCallerName());
  }
}
$ curl -XGET https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?Type=caller-name \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
{
  "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"
}
SDK Version:
  • 5.x
Response Format:
  • json
SDK Version:
  • 7.x
SDK Version:
  • 3.x
SDK Version:
  • 5.x
SDK Version:
  • 6.x
SDK Version:
  • 5.x
Format:
  • JSON
// 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('+15108675310')
  .fetch({ type: ['carrier', 'caller-name'] })
  .then(number => console.log(number));
// 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("+15108675310"),
            type: new List<string> { "caller-name", "carrier" });

        Console.WriteLine(phoneNumber.CallerName["caller_name"]);
    }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
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("+15108675310")
    ->fetch(
        array(
            "type" => array("carrier", "caller-name")
        )
    );

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/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new(account_sid, auth_token)

encoded_phone_number = CGI.escape('+15108675310')
number = @client.lookups.v1
                .phone_numbers(encoded_phone_number)
                .fetch(type: ['carrier', 'caller-name'])

puts number.carrier['type']
puts number.carrier['name']
# 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("15108675310").fetch(
    type=["carrier", "caller-name"],
)

print(number.carrier['type'])
print(number.carrier['name'])
// 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("+15108675310"))
                .setType(Arrays.asList("caller-name", "carrier"))
                .fetch();

        System.out.println(number.getCallerName());
    }
}
curl -XGET "https://lookups.twilio.com/v1/PhoneNumbers/+15108675310/?Type=carrier&Type=caller-name" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
{
  "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"
}
Response Format:
  • json
Format:
  • JSON
$ curl -XGET https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?Type=fraud \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
# 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 = CGI.escape('+16502530000')
number = @client.lookups.v1
                .phone_numbers(encoded_phone_number)
                .fetch(type: ['fraud'])

puts number.fraud['advanced_line_type']
{
  "caller_name": null,
  "country_code": "US",
  "phone_number": "+16502530000",
  "national_format": "(650) 253-0000",
  "carrier": null,
  "fraud": {
    "is_prepaid": false,
    "mobile_country_code": null,
    "mobile_network_code": null,
    "carrier_name": "Level 3 Communications",
    "advanced_line_type": "non_fixed_voip",
    "caller_name": "YOU TUBE",
    "error_code": null
  },
  "add_ons": null,
  "url": "https://lookups.twilio.com/v1/PhoneNumbers/+16502530000"
}
SDK Version:
  • 5.x
Response Format:
  • json
SDK Version:
  • 7.x
SDK Version:
  • 3.x
SDK Version:
  • 5.x
SDK Version:
  • 6.x
SDK Version:
  • 5.x
Format:
  • JSON
// 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('+16502530000')
  .fetch({ addOns: 'whitepages_pro_caller_id' })
  .then(number => console.log(number));
// 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("+16502530000"),
		    addOns: new List<string> { "whitepages_pro_caller_id" });

		Console.WriteLine(phoneNumber.CallerName["caller_name"]);
	}
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
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("+16502530000")
    ->fetch(
        array("add_ons" => "whitepages_pro_caller_id")
    );

echo $number->callerName['caller_type'] . "\r\n";
echo $number->callerName['caller_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 = CGI.escape('+16502530000')
number = @client.lookups.v1
                .phone_numbers(encoded_phone_number)
                .fetch(add_ons: 'whitepages_pro_caller_id')

puts number.carrier['type']
puts number.carrier['name']
# 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("+16502530000").fetch(
    add_ons="whitepages_pro_caller_id",
)

print(number.carrier['type'])
print(number.carrier['name'])
// Install the Java helper library from twilio.com/docs/libraries/java
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("+16502530000"))
        .setAddOns("whitepages_pro_caller_id")
        .fetch();

    System.out.println(number.getCallerName());
  }
}
curl -X GET https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?AddOns=whitepages_pro_caller_id \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
{
  "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"
}
SDK Version:
  • 4.x
  • 5.x
Response Format:
  • json
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
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);
      const numberMatch =
        lookup.add_ons.results &&
        lookup.add_ons.results.payfone_tcpa_compliance.result.Response
          .NumberMatch;
      console.log(
        `Phone Number ${lookup.phone_number} is currently owned : ${numberMatch}`
      );
    });
  })
  .on('error', e => {
    console.log(`Got error: ${e.message}`);
  });
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);
      const numberMatch =
        lookup.add_ons.results &&
        lookup.add_ons.results.payfone_tcpa_compliance.result.Response
          .NumberMatch;
      console.log(
        `Phone Number ${lookup.phone_number} is currently owned : ${numberMatch}`
      );
    });
  })
  .on('error', e => {
    console.log(`Got error: ${e.message}`);
  });
using Newtonsoft.Json;
using RestSharp;
using RestSharp.Authenticators;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;

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<Dictionary<string, string>>(
            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
// 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 https://twilio.com/docs/libraries/php
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("+15108675310")
    ->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
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("+15108675310").fetch(
    type="carrier",
    add_ons="payfone_tcpa_compliance",
    add_ons_data={
        "payfone_tcpa_compliance": {
            "RightPartyContactedDate": "20160101"
        }
    }
)

print(number.carrier['type'])
print(number.carrier['name'])
// 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("+15108675310"))
        .setType("carrier")
        .setAddOns("payfone_tcpa_compliance")
        .setAddOnsData(addOnData)
        .fetch();

    System.out.println(number.getCarrier());
  }
}
$ curl -XGET 'https://lookups.twilio.com/v1/PhoneNumbers/+16502530000/?AddOns=payfone_tcpa_compliance&AddOns.payfone_tcpa_compliance.RightPartyContactedDate=20160101' \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
testable: true
test_output: false
exclude_languages:
  - python
  - java6
{
  "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"
}