Please review the 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 before testing phone numbers.
These phone numbers have simulated information for the following inputs which is for testing 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.
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.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function fetchPhoneNumber() {11const phoneNumber = await client.lookups.v2.phoneNumbers("4159929960").fetch({12fields: "reassigned_number",13lastVerifiedDate: "20211015",14});1516console.log(phoneNumber.reassignedNumber);17}1819fetchPhoneNumber();
1{2"calling_country_code": "1",3"country_code": "US",4"phone_number": "4159929960",5"national_format": "(415) 992-9960",6"valid": true,7"validation_errors": [],8"caller_name": null,9"sim_swap": null,10"call_forwarding": null,11"line_status": null,12"line_type_intelligence": null,13"identity_match": null,14"reassigned_number": {15"last_verified_date": "2019-09-24",16"is_number_reassigned": "no",17"error_code": null18},19"sms_pumping_risk": null,20"phone_number_quality_score": null,21"pre_fill": null,22"url": "https://lookups.twilio.com/v2/PhoneNumbers/+14159929960"23}