When to use
Use this when you have a phone number and need to know something about it before acting: is it real and reachable, is it mobile or VoIP, has the SIM been swapped recently, is it forwarded, does the name match the account, was it reassigned to a new owner. Reach for it to screen signups, cut fraud, validate numbers before sending OTP, or reduce failed message delivery.
Not for: sending or checking OTP codes — use twilio-verify-send-otp. Not for deciding which verification strategy to adopt — use twilio-identity-verification-advisor. Lookup returns intelligence, not a verification decision by itself.
Method
- Normalize to E.164. Lookup v2 keys on the E.164 number in the path (
+14155551234). Decision point: if you only have a national number, pass CountryCode so Twilio can format it, but prefer sending E.164 you already validated.
- Do a free format check first. A bare
GET /v2/PhoneNumbers/{E.164} with no data packages returns validity and formatting at no per-lookup data cost — use it to reject obviously malformed input cheaply.
- Select only the packages you need. Each requested
Fields package (line_type_intelligence, caller_name, sim_swap, call_forwarding, identity_match, reassigned_number) is billed separately. Request the minimum.
- Call Lookup with
?Fields=line_type_intelligence,sim_swap (comma-separated). Decision point: caller_name (CNAM) is US-only — don't request it for non-US numbers.
- Read
valid first. If valid is false, stop — the number is unusable; skip downstream sends.
- Interpret line type.
mobile → OTP SMS OK; landline → SMS will fail, use voice; voip/nonFixedVoip → elevated fraud risk, consider stronger factors.
- Score risk signals. Recent sim_swap or active unconditional call_forwarding on an account-recovery flow is a red flag — block or step up. identity_match returns match scores against name/address/DOB you supply (some packages require end-user consent).
- Emit an action, not just data: proceed, block, or escalate, with the deciding signals cited.
Example
# Free validation + format
curl "https://lookups.twilio.com/v2/PhoneNumbers/+14155551234" \
-u "$TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN"
# Enriched: line type + SIM swap + caller name (US)
curl "https://lookups.twilio.com/v2/PhoneNumbers/+14155551234?Fields=line_type_intelligence,sim_swap,caller_name" \
-u "$TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN"
{
"valid": true,
"phone_number": "+14155551234",
"country_code": "US",
"line_type_intelligence": { "type": "mobile", "carrier_name": "T-Mobile USA" },
"sim_swap": { "last_sim_swap": { "swapped_period": "PT48H", "swapped_in_period": true } },
"caller_name": { "caller_name": "JANE DOE", "caller_type": "CONSUMER" }
}
const info = await client.lookups.v2
.phoneNumbers('+14155551234')
.fetch({ fields: 'line_type_intelligence,sim_swap' });
if (!info.valid) reject();
if (info.lineTypeIntelligence.type === 'landline') useVoiceChannel();
Pitfalls
- Non-E.164 input gives garbage or errors. Always format to E.164 (with
CountryCode when needed) before calling — Lookup v2 keys on it in the URL path.
- Every data package bills separately. Requesting all
Fields blindly multiplies cost. Start with the free format check, then add only the packages the decision needs.
- caller_name (CNAM) is US-only. Requesting it for international numbers returns nothing useful and can error — gate it on
country_code == US.
- Data can be null. Carrier/CNAM/SIM-swap data is not universally available; treat missing fields as "unknown," never as "clean."
- sim_swap and call_forwarding carry consent obligations in some regions and packages; identity_match compares against PII you supply. Confirm you have a lawful basis before requesting them.
- Lookup is a signal, not a verdict. A
mobile line still needs OTP/SNA to prove the user controls it — don't skip verification because Lookup "looked fine."
Output format
LOOKUP RESULT
number: <E.164>
valid: <true|false>
line_type: <mobile|landline|voip|nonFixedVoip|unknown>
carrier: <name|unknown>
caller_name: <CNAM|n/a (non-US)>
sim_swap: <swapped_in_period true/false + window | unknown>
call_forwarding: <active/none | unknown>
identity_match: <score | n/a>
risk: <low|medium|high>
action: <proceed | block | step-up>
deciding_signals: <list>
Reference
- Product: Twilio Lookup API v2. Host
lookups.twilio.com. Endpoint GET /v2/PhoneNumbers/{E.164}; enrich with ?Fields=<comma-separated packages>; optional CountryCode for national-format input.
- Data packages:
line_type_intelligence (mobile/landline/voip/nonFixedVoip + carrier), caller_name (CNAM, US only, consumer/business), sim_swap (recent SIM change window, carrier-sourced), call_forwarding (unconditional forwarding status), identity_match (score name/address/DOB against carrier records), reassigned_number (whether a number was disconnected/reassigned since a date — key for account recovery misdelivery).
- Formatting: E.164 =
+ + country code + subscriber number, digits only, no spaces or punctuation (max 15 digits). The base format/validation lookup (no Fields) is free.
- Billing: the base validation call is free; each data package is billed per successful lookup. Request the minimum set.
- Auth: HTTP Basic — Account SID + Auth Token, or API Key SID + Secret. Server-side only.
- Compliance: SIM-swap, call-forwarding, and identity_match involve carrier/consumer data subject to regional privacy law (GDPR, US state privacy laws) and, in some jurisdictions/packages, require end-user consent. Ensure a lawful basis before requesting risk/identity packages.
1---2name: twilio-lookup-phone-intelligence3description: Enrich and risk-score a phone number with the Twilio Lookup API v2 — line type, caller name, SIM-swap, call forwarding, identity match, and reassigned number.4---56## When to use78Use this when you have a phone number and need to know something about it before acting: is it real and reachable, is it mobile or VoIP, has the SIM been swapped recently, is it forwarded, does the name match the account, was it reassigned to a new owner. Reach for it to screen signups, cut fraud, validate numbers before sending OTP, or reduce failed message delivery.910**Not for:** sending or checking OTP codes — use twilio-verify-send-otp. Not for deciding which verification strategy to adopt — use twilio-identity-verification-advisor. Lookup returns *intelligence*, not a verification decision by itself.1112## Method13141. **Normalize to E.164.** Lookup v2 keys on the E.164 number in the path (`+14155551234`). Decision point: if you only have a national number, pass `CountryCode` so Twilio can format it, but prefer sending E.164 you already validated.152. **Do a free format check first.** A bare `GET /v2/PhoneNumbers/{E.164}` with no data packages returns validity and formatting at no per-lookup data cost — use it to reject obviously malformed input cheaply.163. **Select only the packages you need.** Each requested `Fields` package (line_type_intelligence, caller_name, sim_swap, call_forwarding, identity_match, reassigned_number) is billed separately. Request the minimum.174. **Call Lookup** with `?Fields=line_type_intelligence,sim_swap` (comma-separated). Decision point: caller_name (CNAM) is US-only — don't request it for non-US numbers.185. **Read `valid` first.** If `valid` is false, stop — the number is unusable; skip downstream sends.196. **Interpret line type.** `mobile` → OTP SMS OK; `landline` → SMS will fail, use voice; `voip`/`nonFixedVoip` → elevated fraud risk, consider stronger factors.207. **Score risk signals.** Recent sim_swap or active unconditional call_forwarding on an account-recovery flow is a red flag — block or step up. identity_match returns match scores against name/address/DOB you supply (some packages require end-user consent).218. **Emit an action**, not just data: proceed, block, or escalate, with the deciding signals cited.2223## Example2425```bash26# Free validation + format27curl "https://lookups.twilio.com/v2/PhoneNumbers/+14155551234" \28 -u "$TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN"2930# Enriched: line type + SIM swap + caller name (US)31curl "https://lookups.twilio.com/v2/PhoneNumbers/+14155551234?Fields=line_type_intelligence,sim_swap,caller_name" \32 -u "$TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN"33```3435```json36{37 "valid": true,38 "phone_number": "+14155551234",39 "country_code": "US",40 "line_type_intelligence": { "type": "mobile", "carrier_name": "T-Mobile USA" },41 "sim_swap": { "last_sim_swap": { "swapped_period": "PT48H", "swapped_in_period": true } },42 "caller_name": { "caller_name": "JANE DOE", "caller_type": "CONSUMER" }43}44```4546```javascript47const info = await client.lookups.v248 .phoneNumbers('+14155551234')49 .fetch({ fields: 'line_type_intelligence,sim_swap' });50if (!info.valid) reject();51if (info.lineTypeIntelligence.type === 'landline') useVoiceChannel();52```5354## Pitfalls5556- **Non-E.164 input gives garbage or errors.** Always format to E.164 (with `CountryCode` when needed) before calling — Lookup v2 keys on it in the URL path.57- **Every data package bills separately.** Requesting all `Fields` blindly multiplies cost. Start with the free format check, then add only the packages the decision needs.58- **caller_name (CNAM) is US-only.** Requesting it for international numbers returns nothing useful and can error — gate it on `country_code == US`.59- **Data can be null.** Carrier/CNAM/SIM-swap data is not universally available; treat missing fields as "unknown," never as "clean."60- **sim_swap and call_forwarding carry consent obligations** in some regions and packages; identity_match compares against PII you supply. Confirm you have a lawful basis before requesting them.61- **Lookup is a signal, not a verdict.** A `mobile` line still needs OTP/SNA to prove the user controls it — don't skip verification because Lookup "looked fine."6263## Output format6465```66LOOKUP RESULT67 number: <E.164>68 valid: <true|false>69 line_type: <mobile|landline|voip|nonFixedVoip|unknown>70 carrier: <name|unknown>71 caller_name: <CNAM|n/a (non-US)>72 sim_swap: <swapped_in_period true/false + window | unknown>73 call_forwarding: <active/none | unknown>74 identity_match: <score | n/a>75 risk: <low|medium|high>76 action: <proceed | block | step-up>77 deciding_signals: <list>78```7980## Reference8182- **Product:** Twilio Lookup API v2. Host `lookups.twilio.com`. Endpoint `GET /v2/PhoneNumbers/{E.164}`; enrich with `?Fields=<comma-separated packages>`; optional `CountryCode` for national-format input.83- **Data packages:** `line_type_intelligence` (mobile/landline/voip/nonFixedVoip + carrier), `caller_name` (CNAM, **US only**, consumer/business), `sim_swap` (recent SIM change window, carrier-sourced), `call_forwarding` (unconditional forwarding status), `identity_match` (score name/address/DOB against carrier records), `reassigned_number` (whether a number was disconnected/reassigned since a date — key for account recovery misdelivery).84- **Formatting:** E.164 = `+` + country code + subscriber number, digits only, no spaces or punctuation (max 15 digits). The base format/validation lookup (no `Fields`) is free.85- **Billing:** the base validation call is free; each data package is billed per successful lookup. Request the minimum set.86- **Auth:** HTTP Basic — Account SID + Auth Token, or API Key SID + Secret. Server-side only.87- **Compliance:** SIM-swap, call-forwarding, and identity_match involve carrier/consumer data subject to regional privacy law (GDPR, US state privacy laws) and, in some jurisdictions/packages, require end-user consent. Ensure a lawful basis before requesting risk/identity packages.