The PhoneValidator R package is the official client for
the GenderAPI
Phone Number Validation & Formatter API, enabling you to
validate and format phone numbers from over 240 countries worldwide.
Whether your users provide phone numbers in various formats (e.g.,
12128675309, +1 212 867 5309,
001β212β867β5309), this package intelligently detects,
validates, and converts the input into a standardized E.164 format (e.g.,
+12128675309).
Since this package is not yet on CRAN, you can install it directly from GitHub:
# Install devtools if not already installed
install.packages("devtools")
# Install the PhoneValidator package
devtools::install_github("GenderAPI/PhoneValidator-R")library(PhoneValidator)
result <- validate(
  api_key = "YOUR_API_KEY",
  number = "+1 212 867 5309",
  address = "US"  # Optional, improves parsing of local numbers
)
print(result)| Parameter | Type | Required | Description | 
|---|---|---|---|
number | 
string | β Yes | Phone number in any format | 
address | 
string | Optional | Can be a country code (US), full country name
(Turkey), or city name (Berlin) to improve
parsing | 
validate(api_key = "YOUR_API_KEY", number = "12128675309", address = "US"){
  "status": true,
  "remaining_credits": 15709,
  "expires": 0,
  "duration": "18ms",
  "regionCode": "US",
  "countryCode": 1,
  "country": "United States",
  "national": "(212) 867β5309",
  "international": "+1 212-867-5309",
  "e164": "+12128675309",
  "isValid": true,
  "isPossible": true,
  "numberType": "FIXED_LINE_OR_MOBILE",
  "nationalSignificantNumber": "12128675309",
  "rawInput": "+1 212 867 5309",
  "isGeographical": true,
  "areaCode": "212",
  "location": "New York City (Manhattan)"
}| Field | Type | Description | 
|---|---|---|
status | 
Boolean | Was the request successful | 
remaining_credits | 
Integer | Remaining API credits | 
regionCode | 
String | ISO 3166-1 alpha-2 code (e.g., US) | 
country | 
String | Country name | 
e164 | 
String | Number formatted to E.164 | 
isValid | 
Boolean | Is number valid according to numbering rules | 
isPossible | 
Boolean | Is number structurally possible | 
numberType | 
String | Type of number (mobile, VoIP, etc.) | 
areaCode | 
String | Area code from input | 
location | 
String | City/region matched from area code | 
| Value | Description | 
|---|---|
FIXED_LINE | 
Landline | 
MOBILE | 
Mobile phone | 
FIXED_LINE_OR_MOBILE | 
Could be both | 
TOLL_FREE | 
e.g.Β 800 numbers | 
PREMIUM_RATE | 
Expensive premium numbers | 
SHARED_COST | 
Shared between parties | 
VOIP | 
Internet-based number | 
PERSONAL_NUMBER | 
Forwarding number | 
PAGER | 
Obsolete pager number | 
VOICEMAIL | 
Voicemail access | 
UNKNOWN | 
Cannot be determined | 
MIT License Β© GenderAPI