Building a form with a phone number field? Tired of fake numbers slipping through your validation? Here's how to add rock-solid phone validation in under 5 minutes — for free.
Why Basic Regex Isn't Enough
Most developers start with a regex like ^\+?[0-9]{10,15}$. But this misses:
- ❌ Invalid country codes (
+999) - ❌ Numbers that are syntactically valid but don't exist
- ❌ No carrier or line type info (mobile vs landline)
- ❌ No formatting standardization
A proper validation API handles all of this.
Phone Validator Pro API
RapidAPI link: https://rapidapi.com/adunaev8419/api/phone-validator-pro1
Returns: carrier, country, line type (MOBILE/LANDLINE/VOIP), E.164 format, timezone.
Free tier: 30 requests/hour — enough for most projects.
Python Example
import requests
url = "https://phone-validator-pro1.p.rapidapi.com/validate"
headers = {
"X-RapidAPI-Key": "YOUR_KEY",
"Content-Type": "application/json"
}
r = requests.post(url, json={"phone": "+79001234567"}, headers=headers)
print(r.json())
# {
# "is_valid": true,
# "country": "Russia",
# "carrier": "Tele2",
# "line_type": "MOBILE",
# "e164_format": "+79001234567",
# "timezone": "Europe/Moscow"
# }
JavaScript / Node.js Example
const response = await fetch('https://phone-validator-pro1.p.rapidapi.com/validate', {
method: 'POST',
headers: {
'X-RapidAPI-Key': 'YOUR_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({ phone: '+447911123456' })
});
const data = await response.json();
console.log(data.line_type); // "MOBILE"
console.log(data.country); // "United Kingdom"
Batch Validation
Need to clean a list of numbers? Use the /batch endpoint:
phones = [
{"phone": "+79001234567"},
{"phone": "+447911123456"},
{"phone": "+12025551234"}
]
r = requests.post(
"https://phone-validator-pro1.p.rapidapi.com/batch",
json={"phones": phones},
headers=headers
)
results = r.json()
# Returns validation result for each number in one call
cURL
curl -X POST "https://phone-validator-pro1.p.rapidapi.com/validate" \
-H "X-RapidAPI-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"phone": "+79001234567"}'
When to Use This
- User registration forms — block fake numbers before they hit your DB
- SMS campaigns — filter out landlines and invalid numbers before sending
- CRM data cleaning — validate imported contact lists in batch
- E-commerce checkout — ensure delivery contact is reachable
Pricing
| Plan | Price | Requests/hr |
|---|---|---|
| BASIC | Free | 30 |
| PRO | $9.99/mo | 500 |
| ULTRA | $24.99/mo | 5,000 |
Try it free: https://rapidapi.com/adunaev8419/api/phone-validator-pro1
GitHub with more examples: https://github.com/adun8419/phone-validator-pro-api
Top comments (0)