Socket
Book a DemoInstallSign in
Socket

genderapi-phone-validator

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

genderapi-phone-validator

1.0.3
bundlerRubygems
Version published
Maintainers
1
Created
Source

📞 Phone Number Validation & Formatter API (Ruby SDK)

The genderapi-phone-validator gem uses the official GenderAPI Phone Number Validation & Formatter API to validate and format phone numbers from over 240 countries and territories.

Whether your users enter phone numbers in various formats (e.g., 12128675309, +1 212 867 5309, 001-212-867-5309), this library will intelligently detect, validate, and convert the input into a standardized E.164 format (e.g., +12128675309).

✅ Features

  • Converts phone numbers to E.164 format
  • Validates if the number is real and structurally possible
  • Detects number type: mobile, landline, VoIP, etc.
  • Identifies region/city based on area code
  • Returns country-level metadata (e.g., ISO code)
  • Built with Ruby, uses HTTParty for HTTP requests

📦 Installation

Add the gem to your project:

gem install genderapi-phone-validator

Or in your Gemfile:

gem 'genderapi-phone-validator'

🔐 Authentication

You need an API key from www.genderapi.io.
Sign up and get your key from your dashboard.

🚀 Usage

require 'genderapi-phone-validator'

client = PhoneValidator::Client.new(api_key: "YOUR_API_KEY")

response = client.validate(
  number: "+1 212 867 5309",   # Required
  address: "US"                # Optional, helps with local formats
)

puts response

🧾 Input Parameters

validate(number:, address: nil) → Hash
ParameterTypeRequiredDescription
numberString✅ YesPhone number in any format
addressStringOptionalISO country code (US), full country name (Turkey), or city name (Berlin) – improves local number detection

Example:

client.validate(number: "2128675309", address: "US")

📬 API Response Example

{
  "status": true,
  "remaining_credits": 15709,
  "expires": 0,
  "duration": "18ms",
  "regionCode": "US",
  "country": "United States",
  "national": "(212) 867-5309",
  "international": "+1 212-867-5309",
  "e164": "+12128675309",
  "isValid": true,
  "isPossible": true,
  "numberType": "FIXED_LINE_OR_MOBILE",
  "nationalSignificantNumber": "2128675309",
  "rawInput": "+1 212 867 5309",
  "isGeographical": true,
  "areaCode": "212",
  "location": "New York City (Manhattan)"
}

🧠 Response Field Reference

FieldTypeDescription
statusBooleanWas the request successful
remaining_creditsIntegerRemaining API credits
regionCodeStringISO 3166-1 alpha-2 code (e.g., US)
countryStringCountry name
e164StringNumber formatted to E.164
isValidBooleanIs number valid according to rules
isPossibleBooleanIs number structurally possible
numberTypeStringNumber type (MOBILE, FIXED_LINE, etc.)
areaCodeStringArea code from input
locationStringCity/region matched from area code

🔢 Number Type Values

ValueDescription
FIXED_LINELandline
MOBILEMobile phone
FIXED_LINE_OR_MOBILEAmbiguous, could be both
TOLL_FREEe.g., 800 numbers
PREMIUM_RATEExpensive premium numbers
SHARED_COSTCost shared between parties
VOIPInternet-based phone
PERSONAL_NUMBERForwarding number
PAGERObsolete pager number
VOICEMAILVoicemail access
UNKNOWNCannot be determined

ℹ️ More Information

📝 License

MIT License © GenderAPI

FAQs

Package last updated on 03 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.