Validate Phone API
The Validate Phone API allows you to check whether a given phone number is valid and return its metadata.
From 4,450 users
Application used this API in the last 28 days.
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 278ms | 318ms | 333ms | 614ms | 1137ms |
Similar APIs
Didn't find what you were looking for? Suggest an improvement
https://api.api-ninjas.com/v1/validatephone
Returns metadata (including whether it is valid) for a given phone number.
Parameters
numberrequiredPhone number to check. The leading
+is optional. Ifcountryis not set, include the country code (e.g.12065550100or+12065550100).countryoptional2-letter ISO-3166 country code the phone number belongs to.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
The /v1/validatephone endpoint returns a JSON object with the following fields, or an error if the request is unsuccessful.
is_validBoolean indicating whether the phone number is valid.
is_formatted_properlyWhether the supplied number was already correctly formatted.
countryCountry the phone number is registered to.
locationGeographic region/location associated with the phone number.
timezonesArray of IANA time zones associated with the phone number.
format_nationalThe phone number in national format.
format_internationalThe phone number in international format.
format_e164The phone number in E.164 format.
country_codeThe numeric country calling code (e.g.,
1for the United States).
Live Demo
Code Examples
curl -X GET "https://api.api-ninjas.com/v1/validatephone?number=%2B12065550100" \
-H "X-Api-Key: YOUR_API_KEY"If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.
Frequently Asked Questions
Can I use the Validate Phone API for commercial purposes?
Yes, but you must have a premium subscription. Commercial use of the Validate Phone API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.How do I get an API key and start using the Validate Phone API?
Sign up for a free account to instantly get your API key, then pass it in theX-Api-Keyheader on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.What happens if I exceed my quota for the month?
Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.What happens if a request to the Validate Phone API fails?
The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.Do I need to include the country code in the number parameter?
If you do not set the optionalcountryparameter (a 2-letter ISO-3166 code), the requirednumberparameter must include its country code prefix, for example+12065550100. Browse related verification tools in the API catalog.What metadata does the Validate Phone response include?
The JSON response returnsis_valid,is_formatted_properly,country,location,timezones, theformat_national,format_international, andformat_e164representations, andcountry_code. For a number'scarrier, line type, VOIP status, and MCC/MNC, use the Phone Lookup API. Unsuccessful requests instead return one of the documented error codes.What are some use cases for the Validate Phone API?
You can verify phone numbers at signup using theis_validfield, normalize contact lists into E.164format_e164, and display or route numbers by country using thecountry_codeandformat_nationalfields. For broader contact verification, pair it with the Validate Email API.Can the API tell me whether a number is mobile or landline?
No. The Validate Phone API does not return a line type. The Phone Lookup API returnsline_type,carrier, andis_voipon Business and higher plans.
Explore API integration use cases for recommended APIs and workflow examples.