# Testing Identity Match with Magic Numbers

> \[!WARNING]
>
> Please review the [Magic Numbers for Lookup](/docs/lookup/magic-numbers-for-lookup) and use your testing credentials for the correct Region when testing phone numbers. If you use your production credentials then the phone numbers do not display the correct responses shown below.
>
> Note: Your testing credentials are region specific so make sure you have selected the region you want to test in the top right corner of the [Auth Tokens page of your Console](https://console.twilio.com/us1/account/keys-credentials/api-keys?frameUrl=%2Fconsole%2Fproject%2Fapi-keys%3Fx-target-region%3Dus1) before testing phone numbers.

## Identity Match Magic Numbers

These phone numbers have simulated information for the following inputs which is for testing the [Identity Match](/docs/lookup/v2-api/identity-match) feature. To test Identity Match with Magic Numbers, you will be required to enter the phone number, FirstName, LastName, AddressLine1, City, State, PostalCode, NationalId, DateOfBirth, and AddressCountryCode. In a production environment, you may only want to check a subset of these parameters, but when using Magic Numbers you will need to use all of the provided parameters.

\*Note: The first magic number shows an example of a perfect match. The rest of these magic numbers are examples of when not all parameters match the data set. Please do not modify the input parameters because the output will not reflect your changes.

**Below are the Phone Numbers for Identity Match, along with this Inputs/Outputs:**

| Inputs/Outputs | Phone Number | FirstName            | LastName             | AddressLine1        | City                | State               | PostalCode          | NationalID          | DateOfBirth         | AddressCountryCode  | Summary Score |
| -------------- | ------------ | -------------------- | -------------------- | ------------------- | ------------------- | ------------------- | ------------------- | ------------------- | ------------------- | ------------------- | ------------- |
| Input          | +12345678900 | John                 | Twilion              | 123 Magic St        | Owl City            | CA                  | 12345               | 123456789           | 20080313            | US                  | null          |
| Output         | +12345678900 | exact\_match         | exact\_match         | exact\_match        | exact\_match        | exact\_match        | exact\_match        | exact\_match        | exact\_match        | exact\_match        | 100           |
| Input          | +12345678901 | Joh                  | Twil                 | 123 Magic St        | Owl City            | CA                  | 12345               | 123456789           | 20080313            | US                  | null          |
| Output         | +12345678901 | high\_partial\_match | high\_partial\_match | exact\_match        | exact\_match        | exact\_match        | exact\_match        | exact\_match        | exact\_match        | exact\_match        | 100           |
| Input          | +12345678924 | John                 | Magic                | 123 Magic St        | Magic City          | NY                  | M4 G15              | 901234567           | 20000425            | US                  | null          |
| Output         | +12345678924 | exact\_match         | no\_match            | exact\_match        | no\_match           | no\_match           | no\_match           | exact\_match        | no\_match           | no\_match           | 80            |
| Input          | +12345678904 | John                 | Twilion              | 456 Twilio Dr       | Magic City          | NY                  | M4 G15              | 901234567           | 20000425            | GB                  | null          |
| Output         | +12345678904 | exact\_match         | exact\_match         | no\_match           | no\_match           | no\_match           | no\_match           | no\_match           | no\_match           | no\_match           | 40            |
| Input          | +12345678907 | Charles              | Twilion              | 456 Twilio Dr       | Magic City          | CA                  | 45678               | 123456789           | 20000425            | US                  | null          |
| Output         | +12345678907 | no\_match            | exact\_match         | no\_match           | no\_match           | exact\_match        | no\_match           | no\_match           | no\_match           | exact\_match        | 20            |
| Input          | +12345678912 | Charles              | Magic                | 456 Twilio Dr       | Magic City          | NY                  | 45678               | 901234567           | 20000425            | US                  | null          |
| Output         | +12345678912 | no\_match            | no\_match            | no\_match           | no\_match           | no\_match           | no\_match           | no\_match           | no\_match           | no\_match           | 0             |
| Input          | +12345678913 | Charles              | Magic                | 123 Owl Dr          | Twilio City         | CA                  | 12345               | 234567891           | 19730403            | US                  | null          |
| Output         | +12345678913 | no\_data\_available  | no\_data\_available  | no\_data\_available | no\_data\_available | no\_data\_available | no\_data\_available | no\_data\_available | no\_data\_available | no\_data\_available | 0             |

These phone number examples show different types of errors when using Identity Match.

| Value        | Error Code                      |
| ------------ | ------------------------------- |
| +12345678914 | [60001](/docs/api/errors/60001) |
| +12345678915 | [60003](/docs/api/errors/60003) |
| +12345678916 | [60006](/docs/api/errors/60006) |
| +12345678917 | [60008](/docs/api/errors/60008) |
| +12345678918 | [60607](/docs/api/errors/60607) |
| +12345678919 | [60608](/docs/api/errors/60608) |
| +12345678920 | [60617](/docs/api/errors/60617) |
| +12345678921 | [60618](/docs/api/errors/60618) |

Identity Match Lookup

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function fetchPhoneNumber() {
  const phoneNumber = await client.lookups.v2
    .phoneNumbers("+14159929960")
    .fetch({
      addressCountryCode: "US",
      addressLine1: "321 Main Street",
      addressLine2: "Suite 2",
      city: "New York",
      dateOfBirth: "19901214",
      fields: "identity_match",
      firstName: "John",
      lastName: "Doe",
      nationalId: "YZ3456883",
      postalCode: "10021",
      state: "NY",
    });

  console.log(phoneNumber.callingCountryCode);
}

fetchPhoneNumber();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

phone_number = client.lookups.v2.phone_numbers("+14159929960").fetch(
    fields="identity_match",
    first_name="John",
    last_name="Doe",
    address_line1="321 Main Street",
    address_line2="Suite 2",
    city="New York",
    state="NY",
    postal_code="10021",
    address_country_code="US",
    national_id="YZ3456883",
    date_of_birth="19901214",
)

print(phone_number.calling_country_code)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Lookups.V2;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var phoneNumber = await PhoneNumberResource.FetchAsync(
            pathPhoneNumber: "+14159929960",
            fields: "identity_match",
            firstName: "John",
            lastName: "Doe",
            addressLine1: "321 Main Street",
            addressLine2: "Suite 2",
            city: "New York",
            state: "NY",
            postalCode: "10021",
            addressCountryCode: "US",
            nationalId: "YZ3456883",
            dateOfBirth: "19901214");

        Console.WriteLine(phoneNumber.CallingCountryCode);
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

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

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        PhoneNumber phoneNumber = PhoneNumber.fetcher("+14159929960")
                                      .setFields("identity_match")
                                      .setFirstName("John")
                                      .setLastName("Doe")
                                      .setAddressLine1("321 Main Street")
                                      .setAddressLine2("Suite 2")
                                      .setCity("New York")
                                      .setState("NY")
                                      .setPostalCode("10021")
                                      .setAddressCountryCode("US")
                                      .setNationalId("YZ3456883")
                                      .setDateOfBirth("19901214")
                                      .fetch();

        System.out.println(phoneNumber.getCallingCountryCode());
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	lookups "github.com/twilio/twilio-go/rest/lookups/v2"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	params := &lookups.FetchPhoneNumberParams{}
	params.SetFields("identity_match")
	params.SetFirstName("John")
	params.SetLastName("Doe")
	params.SetAddressLine1("321 Main Street")
	params.SetAddressLine2("Suite 2")
	params.SetCity("New York")
	params.SetState("NY")
	params.SetPostalCode("10021")
	params.SetAddressCountryCode("US")
	params.SetNationalId("YZ3456883")
	params.SetDateOfBirth("19901214")

	resp, err := client.LookupsV2.FetchPhoneNumber("+14159929960",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		if resp.CallingCountryCode != nil {
			fmt.Println(*resp.CallingCountryCode)
		} else {
			fmt.Println(resp.CallingCountryCode)
		}
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$phone_number = $twilio->lookups->v2->phoneNumbers("+14159929960")->fetch([
    "fields" => "identity_match",
    "firstName" => "John",
    "lastName" => "Doe",
    "addressLine1" => "321 Main Street",
    "addressLine2" => "Suite 2",
    "city" => "New York",
    "state" => "NY",
    "postalCode" => "10021",
    "addressCountryCode" => "US",
    "nationalId" => "YZ3456883",
    "dateOfBirth" => "19901214",
]);

print $phone_number->callingCountryCode;
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

phone_number = @client
               .lookups
               .v2
               .phone_numbers('+14159929960')
               .fetch(
                 fields: 'identity_match',
                 first_name: 'John',
                 last_name: 'Doe',
                 address_line1: '321 Main Street',
                 address_line2: 'Suite 2',
                 city: 'New York',
                 state: 'NY',
                 postal_code: '10021',
                 address_country_code: 'US',
                 national_id: 'YZ3456883',
                 date_of_birth: '19901214'
               )

puts phone_number.calling_country_code
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:lookups:v2:phone-numbers:fetch \
   --phone-number +14159929960 \
   --fields identity_match \
   --first-name John \
   --last-name Doe \
   --address-line1 "321 Main Street" \
   --address-line2 "Suite 2" \
   --city "New York" \
   --state NY \
   --postal-code 10021 \
   --address-country-code US \
   --national-id YZ3456883 \
   --date-of-birth 19901214
```

```bash
curl -X GET "https://lookups.twilio.com/v2/PhoneNumbers/%2B14159929960?Fields=identity_match&FirstName=John&LastName=Doe&AddressLine1=321%20Main%20Street&AddressLine2=Suite%202&City=New%20York&State=NY&PostalCode=10021&AddressCountryCode=US&NationalId=YZ3456883&DateOfBirth=19901214" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "calling_country_code": "1",
  "country_code": "US",
  "phone_number": "+14159929960",
  "national_format": "(415) 992-9960",
  "valid": true,
  "validation_errors": [],
  "caller_name": null,
  "sim_swap": null,
  "call_forwarding": null,
  "line_status": null,
  "line_type_intelligence": null,
  "identity_match": {
    "first_name_match": "exact_match",
    "last_name_match": "high_partial_match",
    "address_lines_match": "no_match",
    "city_match": "no_match",
    "state_match": "high_partial_match",
    "postal_code_match": "no_data_available",
    "address_country_match": "exact_match",
    "national_id_match": "exact_match",
    "date_of_birth_match": "exact_match",
    "summary_score": 90,
    "error_code": null,
    "error_message": null
  },
  "reassigned_number": null,
  "sms_pumping_risk": null,
  "phone_number_quality_score": null,
  "pre_fill": null,
  "url": "https://lookups.twilio.com/v2/PhoneNumbers/+14159929960"
}
```
