Skip to contentSkip to navigationSkip to topbar
On this page

Testing SIM Swap with Magic Numbers


(warning)

Warning

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(link takes you to an external page) before testing phone numbers.


SIM Swap Magic Numbers

sim-swap-magic-numbers page anchor

These phone numbers have simulated information for the following inputs which is for testing the SIM Swap feature. Testing SIM Swap with Magic Numbers works just like SIM Swap in Production and only requires you to submit the phone number with your query. Note: These phone numbers are examples only and do not include real time data.

Below are the Magic Numbers for SIM Swap, along with their Inputs/Outputs:

below-are-the-magic-numbers-for-sim-swap-along-with-their-inputsoutputs page anchor

These phone number examples show the inputs (phone numbers) and their outputs (LastSimSwapDate, SwappedPeriod and SwappedinPeriod).

Phone NumberLastSimSwapDateSwappedPeriodSwappedInPeriod
+12345678900nullPT48HFALSE
+441234567890"2018-07-25T11:47:40Z"PT48HFALSE
+491534567890"2018-07-25T11:47:40Z"PT48HFALSE
+3933444567890nullPT48HFALSE
+31223456780"2018-07-25T11:47:40Z"PT48HFALSE
+34712345670"2018-07-25T11:47:40Z"PT48HFALSE
+551234567890nullPT48HFALSE
+573394567890nullPT48HFALSE
+12345678904nullPT48HTRUE
+441234567891"2020-04-27T10:18:50Z"PT48HTRUE
+491534567891"2020-04-27T10:18:50Z"PT48HTRUE
+3933444567891nullPT48HTRUE
+31223456781"2020-04-27T10:18:50Z"PT48HTRUE
+34712345671"2020-04-27T10:18:50Z"PT48HTRUE
+551234567891nullPT48HTRUE
+573394567891nullPT48HTRUE

These phone number examples show different types of errors when using SIM Swap.

Phone NumberError Code
+1234567890560004
+1234567890660005
+1234567890760006
+1234567890960008
+1234567891060601
+1234567891160606
+1234567891260607
+1234567891360608
+1234567891460614
+1234567891560619
+1234567891660620
SIM Swap LookupLink to code sample: SIM Swap Lookup
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function fetchPhoneNumber() {
11
const phoneNumber = await client.lookups.v2
12
.phoneNumbers("+447772000001")
13
.fetch({ fields: "sim_swap" });
14
15
console.log(phoneNumber.simSwap);
16
}
17
18
fetchPhoneNumber();

Output

1
{
2
"calling_country_code": "44",
3
"country_code": "GB",
4
"phone_number": "+447772000001",
5
"national_format": "07772 000001",
6
"valid": true,
7
"validation_errors": null,
8
"caller_name": null,
9
"sim_swap": {
10
"last_sim_swap": {
11
"last_sim_swap_date": "2020-04-27T10:18:50Z",
12
"swapped_period": "PT48H",
13
"swapped_in_period": true
14
},
15
"carrier_name": "Vodafone UK",
16
"mobile_country_code": "276",
17
"mobile_network_code": "02",
18
"error_code": null
19
},
20
"call_forwarding": null,
21
"line_status": null,
22
"line_type_intelligence": null,
23
"identity_match": null,
24
"reassigned_number": null,
25
"sms_pumping_risk": null,
26
"phone_number_quality_score": null,
27
"pre_fill": null,
28
"url": "https://lookups.twilio.com/v2/PhoneNumbers/+447772000001"
29
}

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.