# Testing Reassigned Number 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.

## Reassigned Numbers Magic Numbers

These phone numbers have simulated information for the following inputs which is for testing [Reassigned Number](/docs/lookup/v2-api/reassigned-number) feature. To test phone numbers for Reassigned Number, you will be required to enter the phone number and last verified date.

*Note: These phone numbers are examples only and do not include real time data. Please do not modify the input parameters (phone number and LastVerifiedDate) because the output parameter will not reflect your changes.*

### Below are the Phone Numbers for Reassigned Number, along with their Input/Outputs:

These phone number examples show the inputs (phone number and LastVerifiedDate) and their output (IsReassigned).

| Phone Number | LastVerifiedDate | IsReassignedNumber |
| ------------ | ---------------- | ------------------ |
| +12345678900 | "2022-11-12"     | no                 |
| +12345678904 | "2021-12-27"     | yes                |

These phone number examples show different types of errors when using Reassigned Number.

| Value        | Error Code                      |
| ------------ | ------------------------------- |
| +12345678905 | [60004](/docs/api/errors/60004) |
| +12345678906 | [60607](/docs/api/errors/60607) |
| +12345678907 | [60617](/docs/api/errors/60617) |
| +12345678908 | [60618](/docs/api/errors/60618) |

Reassigned Number 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("4159929960").fetch({
    fields: "reassigned_number",
    lastVerifiedDate: "20211015",
  });

  console.log(phoneNumber.reassignedNumber);
}

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("4159929960").fetch(
    fields="reassigned_number", last_verified_date="20211015"
)

print(phone_number.reassigned_number)
```

```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: "4159929960",
            fields: "reassigned_number",
            lastVerifiedDate: "20211015");

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

```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("4159929960").setFields("reassigned_number").setLastVerifiedDate("20211015").fetch();

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

```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("reassigned_number")
	params.SetLastVerifiedDate("20211015")

	resp, err := client.LookupsV2.FetchPhoneNumber("4159929960",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		if resp.ReassignedNumber != (lookups.ReassignedNumberInfo{}) {
			fmt.Println(resp.ReassignedNumber)
		} else {
			fmt.Println(resp.ReassignedNumber)
		}
	}
}
```

```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("4159929960")->fetch([
    "fields" => "reassigned_number",
    "lastVerifiedDate" => "20211015",
]);

print $phone_number->reassignedNumber;
```

```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('4159929960')
               .fetch(
                 fields: 'reassigned_number',
                 last_verified_date: '20211015'
               )

puts phone_number.reassigned_number
```

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

twilio api:lookups:v2:phone-numbers:fetch \
   --phone-number 4159929960 \
   --fields reassigned_number \
   --last-verified-date 20211015
```

```bash
curl -X GET "https://lookups.twilio.com/v2/PhoneNumbers/4159929960?Fields=reassigned_number&LastVerifiedDate=20211015" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "calling_country_code": "1",
  "country_code": "US",
  "phone_number": "4159929960",
  "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": null,
  "reassigned_number": {
    "last_verified_date": "2019-09-24",
    "is_number_reassigned": "no",
    "error_code": null
  },
  "sms_pumping_risk": null,
  "phone_number_quality_score": null,
  "pre_fill": null,
  "url": "https://lookups.twilio.com/v2/PhoneNumbers/+14159929960"
}
```
