curl --request POST \
--url https://api.finowl.co/v1/phone/validate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone": "(415) 555-2671"
}
'{
"phone": "(415) 555-2671",
"valid": true,
"possible": true,
"reason": null,
"country_code": "US",
"country": "United States",
"calling_code": 1,
"type": "fixed_line_or_mobile",
"e164": "+14155552671",
"international": "+1 415-555-2671",
"national": "(415) 555-2671",
"carrier": null,
"location": "San Francisco, CA",
"timezones": [
"America/Los_Angeles"
]
}Validate a phone number
Check, format and classify a phone number, and get its country, original carrier and time zones.
curl --request POST \
--url https://api.finowl.co/v1/phone/validate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone": "(415) 555-2671"
}
'{
"phone": "(415) 555-2671",
"valid": true,
"possible": true,
"reason": null,
"country_code": "US",
"country": "United States",
"calling_code": 1,
"type": "fixed_line_or_mobile",
"e164": "+14155552671",
"international": "+1 415-555-2671",
"national": "(415) 555-2671",
"carrier": null,
"location": "San Francisco, CA",
"timezones": [
"America/Los_Angeles"
]
}Good to know
- Send
countryfor local numbers. A number without a+prefix, such as(415) 555-2671, needs a country to be read. Use the country of your form, the user’s billing address or their IP. Without it the result isreason: missing_country. - Store
e164. It is the one format every SMS and voice provider accepts, and it makes duplicates easy to spot. validis not “in service”. The number is in an assigned range, but Finowl doesn’t call or text it. Send a one-time code when you need to know the user owns it.carrieris the original carrier. It is the network the number range was first allocated to. Numbers that were ported keep their old carrier here. It is usuallynullfor US and Canadian numbers.fixed_line_or_mobileis common. In the US, Canada and some other countries, landlines and mobiles share ranges, so the type can’t be told apart. Don’t reject these as “not mobile”.locationcan be just the country. When the number has no finer area, which is common for mobile numbers,locationis the country name, for exampleIndia.- Time zones use the library’s IANA names. Some are older aliases, such as
Asia/Calcuttarather thanAsia/Kolkata. Toll-free and other national numbers can list every time zone in the country. - Bad input is a
200, not an error. Unparseable numbers returnvalid: falsewith areason. - Nothing leaves Finowl. Validation runs offline against Google’s open-source libphonenumber data.
Guide: sign-up fraud checks
Authorizations
Your Finowl API key, for example finowl_3f9a.... Create keys in the dashboard under API Keys.
Body
The number as the user typed it. Spaces, dashes, dots and brackets are fine. Start with + and the country calling code, or send country.
1 - 64"(415) 555-2671"
ISO 3166-1 alpha-2 code, in any case, used to read numbers written without a + prefix, such as US or GB. Ignored when the number starts with +. Unassigned codes such as ZZ return invalid_input.
^[A-Za-z]{2}$"US"
Response
The check completed. Invalid numbers are still successful responses.
The number you sent.
true when the number matches an assigned range in its country's numbering plan. It does not prove the number is in service.
true when the number has a plausible length for its country. A possible number can still be invalid.
Why the number is not valid. null when valid is true.
unparseable: the input does not look like a phone number.missing_country: the number has no+prefix and nocountrywas sent.too_shortortoo_long: the number has the wrong length for its country.invalid_number: the length is plausible, but the number is not in an assigned range.
unparseable, missing_country, too_short, too_long, invalid_number, null ISO 3166-1 alpha-2 code of the number's country. Empty when unknown.
The country name for country_code. Empty when unknown.
The country calling code, such as 1 or 44. null when unknown.
The kind of line, from the numbering plan.
fixed_line_or_mobile is common in countries such as the US and Canada, where landline and mobile numbers share ranges.
uan is a universal access number, a single number that routes to several lines. unknown for invalid numbers.
mobile, fixed_line, fixed_line_or_mobile, toll_free, premium_rate, shared_cost, voip, personal_number, pager, uan, voicemail, unknown The number in E.164 format, such as +14155552671. Store numbers in this format. null when the number could not be parsed.
The number formatted for international display. null when it could not be parsed.
The number formatted for display within its own country. null when it could not be parsed.
The carrier the number range was originally allocated to. Numbers can be ported, so the current carrier may differ. null when unknown, which is usual for landlines and for US and Canadian numbers.
A geographic description in English, such as San Francisco, CA, from the number's area code. Falls back to the country name, such as India, when there is no finer area. null when unknown.
IANA time zones the number may be in, such as America/Los_Angeles, using libphonenumber's names (for example Asia/Calcutta). National numbers such as toll-free can list every zone in the country. Empty when unknown.