# Phone Number Lookup API: Line Type, Carrier and Fraud Risk (`nabeelbaghoor/phone-number-lookup-api`) Actor

Phone number lookup and validation API for fraud prevention: E.164 formatting, line type and carrier, SMS pumping risk score, line status, caller name, reassigned number, SIM swap, call forwarding and identity match, via the Twilio Lookup v2 API. Bring your own key.

- **URL**: https://apify.com/nabeelbaghoor/phone-number-lookup-api.md
- **Developed by:** [Nabeel Hassan](https://apify.com/nabeelbaghoor) (community)
- **Categories:** Developer tools, Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 basic phone lookups

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Phone Number Lookup API: Line Type, Carrier and Fraud Risk

Validate phone numbers and score them for fraud before you send an OTP, approve a sign-up or trust a login: E.164 formatting, line type and carrier, SMS pumping risk, line status, reassigned number, SIM swap, call forwarding and identity match, as clean rows you can export to CSV, Excel or JSON.

This actor wraps the Twilio Lookup v2 API (GET /v2/PhoneNumbers/{PhoneNumber}) in the US1 or IE1 region. It is built for fraud prevention, account security and identity verification on your own users' numbers. Bring your own Twilio credentials.

BYOK, not live tested: every route, parameter and response field comes from Twilio's own Lookup v2 documentation and OpenAPI description, and the route was probed on 2026-11-06 with bogus credentials of realistic length. It has not been run against a live key.

### What it does

- **Free validation on every number**: `phoneNumber` in E.164, `nationalFormat`, `countryCode`, `callingCountryCode`, `valid` and `validationErrors` (TOO_SHORT, TOO_LONG, INVALID_BUT_POSSIBLE, INVALID_COUNTRY_CODE, INVALID_LENGTH, NOT_A_NUMBER).
- **Line type and carrier**: `lineType` (mobile, landline, fixedVoip, nonFixedVoip, tollFree, premium, sharedCost, personal, uan, voicemail, pager, unknown), `carrierName`, mobile country and network codes. Block VoIP numbers at sign-up, or drop landlines before sending SMS.
- **SMS pumping risk**: `smsPumpingRiskScore` from 0 to 100, `carrierRiskCategory` (low, mild, moderate, high) and whether Verify Fraud Guard has blocked the number. Stop SMS toll fraud before the OTP goes out.
- **Line status**: `lineStatus` active, reachable, unreachable, inactive or unknown.
- **Caller name**: CNAM `callerName` and `callerType` (BUSINESS or CONSUMER) for US numbers.
- **Reassigned number**: `isNumberReassigned` yes, no or no_data_available since the date you last verified the number (US, for TCPA consent checks).
- **SIM swap and call forwarding**: last SIM change date and whether it falls in the swap window; unconditional call forwarding on UK carriers. Both are account takeover signals.
- **Identity match**: compare the name, address and date of birth a user gave you with authoritative data for that phone number; per-field match levels and a `summaryScore`.
- **Safe by design**: one read-only route, nothing written to your Twilio account, identity inputs never copied into the dataset, lines that are not phone numbers skipped for free.

### What you need

A Twilio account with Lookup. Paid packages are billed by Twilio to that account. Reassigned number, SIM swap, call forwarding and some identity match countries need carrier registration and approval from Twilio first. The actor never signs up or buys anything for you.

1. In the Twilio Console open **Account**, **API keys and tokens** and create a **Standard** API key (for IE1, pick the Ireland region first).
2. Paste the key **SID** and **secret** into the **Twilio credentials** field as `SID:secret`, for example `SKxxxxxxxx:yourSecret`. An Account SID and Auth Token as `ACxxxxxxxx:authToken` also work, but an API key you can revoke is the safer choice.
3. Or set the DATA_API_KEY secret to the same `SID:secret` text.

#### Why one field for two values?

Twilio authenticates with HTTP Basic auth, a SID as the username and a secret as the password. Writing them as `SID:secret` keeps the whole credential in one secret field, so neither half is stored in the clear and the same text works in the DATA_API_KEY environment variable. If you prefer, paste only the secret into the credentials field and put the SID into the optional **Key SID** field; the SID is an identifier, not a secret.

### Input

| Field | Modes | Notes |
| --- | --- | --- |
| `mode` | all | `lookup` or `identityMatch` |
| `apiKey` | all | `SID:secret`, or the secret alone with `keySid`; falls back to DATA_API_KEY |
| `keySid` | all | optional SK or AC SID when `apiKey` is the secret alone |
| `region` | all | `us1` (default) or `ie1` |
| `countryCode` | all | ISO country for numbers in national format; empty means US |
| `phoneNumbers` | lookup | one number per line |
| `dataPackages` | lookup | any of `line_type_intelligence`, `sms_pumping_risk`, `line_status`, `caller_name`, `reassigned_number`, `sim_swap`, `call_forwarding`; empty is the free Basic Lookup |
| `lastVerifiedDate` | lookup | required with `reassigned_number`, YYYYMMDD or YYYY-MM-DD |
| `identityRecords` | identityMatch | objects with `phoneNumber`, `firstName`, `lastName`, `addressLine1`, `addressLine2`, `city`, `state`, `postalCode`, `addressCountryCode`, `dateOfBirth` |
| `maxResults` | all | stop after this many rows (default 1,000) |

Example input:

```json
{
    "mode": "lookup",
    "phoneNumbers": ["+14155552671", "+447772000001", "020 7946 0018"],
    "countryCode": "GB",
    "dataPackages": ["line_type_intelligence", "sms_pumping_risk"]
}
```

Identity match input:

```json
{
    "mode": "identityMatch",
    "identityRecords": [
        { "phoneNumber": "+14155552671", "firstName": "John", "lastName": "Doe", "addressLine1": "321 Main Street", "city": "New York", "state": "NY", "postalCode": "10021", "dateOfBirth": "19901214" }
    ]
}
```

### Output

A lookup row (the values are illustrative):

```json
{
    "recordType": "lookup",
    "found": true,
    "mode": "lookup",
    "query": "+447772000001",
    "region": "us1",
    "phoneNumber": "+447772000001",
    "nationalFormat": "07772 000001",
    "countryCode": "GB",
    "callingCountryCode": "44",
    "valid": true,
    "validationErrors": [],
    "packagesRequested": ["line_type_intelligence", "sms_pumping_risk"],
    "packagesReturned": ["line_type_intelligence", "sms_pumping_risk"],
    "lineType": "mobile",
    "carrierName": "Vodafone UK",
    "mobileCountryCode": "234",
    "mobileNetworkCode": "15",
    "smsPumpingRiskScore": 12,
    "carrierRiskCategory": "low",
    "numberBlocked": false
}
```

An identity match row carries `firstNameMatch`, `lastNameMatch`, `addressLinesMatch`, `cityMatch`, `stateMatch`, `postalCodeMatch`, `addressCountryMatch`, `dateOfBirthMatch` (exact_match, high_partial_match, partial_match, no_match or no_data_available) and `summaryScore`. Each package also has its own error code column, such as `lineTypeErrorCode`, filled when Twilio has no data for that number.

### Pricing

Pay per event, once per phone number with data:

| Event | Price |
| --- | --- |
| Basic phone lookup (validation and formatting only) | $0.005 |
| Phone lookup with one or more paid data packages returned | $0.01 |
| Identity match result | $0.02 |

Twilio bills the paid packages themselves to your Twilio account, separately from this actor.

### FAQ

#### What is the Twilio Lookup v2 API?

Twilio Lookup is the phone number intelligence API of Twilio, the communications platform. Version 2 returns free validation and formatting for any number, plus optional paid data packages: Line Type Intelligence, SMS Pumping Risk Score, Line Status, Caller Name, Reassigned Number, SIM Swap, Call Forwarding and Identity Match.

#### How do I detect VoIP or landline numbers?

Pick the line type and carrier package. The `lineType` column says mobile, landline, fixedVoip, nonFixedVoip, tollFree and so on, and `carrierName` names the carrier. Many sign-up flows reject nonFixedVoip numbers, which are obtained online without a physical device.

#### How does the SMS pumping risk score work?

Twilio scores each number from 0 (no risk) to 100 (high risk) from patterns in its messaging traffic. Twilio's guidance: 0 to 60 send, 60 to 75 add friction, 75 to 90 treat as suspicious, 90 to 100 do not send. Twilio does not recommend it for US or Canadian numbers, which SMS pumping rarely targets.

#### Can I check whether a number was reassigned?

Yes, for US numbers, with the reassigned number package and the date you obtained consent or last verified the number. `isNumberReassigned` is yes, no or no_data_available. Twilio requires carrier registration and approval before this package works.

#### How do I verify a user's identity with their phone number?

Use the identity match mode with the details your user gave you at onboarding. Twilio compares them with authoritative phone-based data and returns a match level per field and a summary score. It covers the US, Canada, the UK, Brazil, the Netherlands, Italy, Spain, Germany, France and Australia, with country-specific field rules.

#### Can I use it for lead enrichment or marketing lists?

No. Twilio positions Lookup for verification and fraud prevention, and its identity verification terms forbid marketing or sales use of the results and their use as a consumer report under the FCRA. Use it on numbers your own users gave you.

#### What do I pay?

$0.005 per number with validation only, $0.01 per number with any paid package returned, and $0.02 per identity match, to this actor, plus whatever Twilio charges your account for the packages. Skipped lines, empty answers and refused lookups are free.

### Keyword map

phone number lookup API, phone number validation API, phone validator, line type detection, VoIP detection, carrier lookup, SMS pumping fraud detection, SMS toll fraud, OTP fraud prevention, line status check, CNAM caller name lookup, reassigned number check, TCPA compliance, SIM swap detection, call forwarding check, account takeover prevention, identity verification API, KYC phone match, Twilio Lookup v2.

### Route and verification

| Mode | Route | Probe with bogus credentials (twice) |
| --- | --- | --- |
| Phone number lookup | GET /v2/PhoneNumbers/{PhoneNumber} (Fields, CountryCode, LastVerifiedDate) | 401 JSON code 70051 "The authorization with Key failed", on lookups.twilio.com and lookups.dublin.ie1.twilio.com |
| Identity match | GET /v2/PhoneNumbers/{PhoneNumber} (Fields=identity_match, FirstName, LastName, AddressLine1, AddressLine2, City, State, PostalCode, AddressCountryCode, DateOfBirth) | same |
| Invented control routes | /v2/PhoneNumberz/{PhoneNumber}, /v2/Inventedz | 404 JSON code 20404 "The requested resource ... was not found" |

### Licensing and data use

This actor works only with your own Twilio credentials, and your agreement with Twilio applies. Twilio's terms do not allow reselling Lookup data or offering it as a standalone data product; here every lookup runs on your own account for your own use. Identity verification results may not be used for marketing or sales, or as a consumer report under the FCRA, and should only be requested for people who gave you their details. The NationalId parameter and the pre_fill package are deliberately not offered. This actor is not affiliated with or endorsed by Twilio.

# Actor input Schema

## `mode` (type: `string`):

Each mode calls the documented Twilio Lookup v2 route GET /v2/PhoneNumbers/{PhoneNumber} with your own Twilio credentials. Nothing is written to your Twilio account.

## `apiKey` (type: `string`):

Your own Twilio API key SID and secret written as SID:secret, for example SKxxxxxxxx:yourSecret (create a Standard API key in the Twilio Console under Account, API keys and tokens). An Account SID and Auth Token as ACxxxxxxxx:authToken also work. You may instead paste the secret alone here and put the SID in the Key SID field. Sent only as HTTP Basic auth to the Twilio Lookup host and removed from every log line. Leave empty to use the DATA_API_KEY secret in the same SID:secret form.

## `keySid` (type: `string`):

Only when the credentials field holds the secret alone: the API key SID (SK followed by 32 characters) or Account SID (AC followed by 32 characters) that goes with it. The SID is an identifier, not a secret.

## `region` (type: `string`):

US1 calls lookups.twilio.com (the default). IE1 calls lookups.dublin.ie1.twilio.com and needs an API key created for the IE1 region.

## `countryCode` (type: `string`):

Two-letter ISO country code (such as US, GB or DE) used for numbers written in national format, without a + prefix. Leave empty and Twilio reads such numbers as US numbers. Numbers in E.164 format (+447772000001) ignore it.

## `phoneNumbers` (type: `array`):

Phone number lookup. One phone number per line, in E.164 format (+14155552671) or national format with a default country. Spaces, dashes, dots and brackets are removed. Duplicates are sent once, and lines that are not phone numbers are skipped for free.

## `dataPackages` (type: `array`):

Phone number lookup. The Twilio paid data packages to add. Leave empty for the free Basic Lookup only (validity and formatting). Twilio bills each package to your account. Reassigned number, SIM swap and call forwarding need carrier registration and approval on your Twilio account first.

## `lastVerifiedDate` (type: `string`):

Reassigned number package only, and then required: the date you obtained consent to contact the numbers or last confirmed them, as YYYYMMDD or YYYY-MM-DD. Twilio answers whether each number was reassigned to a new user since that date.

## `identityRecords` (type: `array`):

Identity match. One object per person to verify, with phoneNumber and the details that person gave you: firstName, lastName, addressLine1, addressLine2, city, state, postalCode, addressCountryCode (two letters) and dateOfBirth (YYYYMMDD or YYYY-MM-DD). Twilio recommends firstName, lastName and addressLine1 as the minimum. These details are sent to Twilio only and are never written to the dataset, which holds only the match levels. Example: \[{"phoneNumber": "+14155552671", "firstName": "John", "lastName": "Doe", "addressLine1": "321 Main Street", "city": "New York", "state": "NY", "postalCode": "10021", "dateOfBirth": "19901214"}].

## `maxResults` (type: `integer`):

The run stops after this many rows. It also caps how many numbers are looked up.

## Actor input object example

```json
{
  "mode": "lookup",
  "region": "us1",
  "phoneNumbers": [
    "+14155552671"
  ],
  "dataPackages": [
    "line_type_intelligence"
  ],
  "maxResults": 1000
}
```

# Actor output Schema

## `records` (type: `string`):

One row per phone number looked up.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "phoneNumbers": [
        "+14155552671"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("nabeelbaghoor/phone-number-lookup-api").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "phoneNumbers": ["+14155552671"] }

# Run the Actor and wait for it to finish
run = client.actor("nabeelbaghoor/phone-number-lookup-api").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "phoneNumbers": [
    "+14155552671"
  ]
}' |
apify call nabeelbaghoor/phone-number-lookup-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,nabeelbaghoor/phone-number-lookup-api"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/zbCPgDvn3U9Fbosg1/builds/uLFSmGPs7ihGKzULO/openapi.json
