Validate, normalize, and format any phone number on Earth
Phone Number Validation & Formatting API
The Phone Number Validation & Formatting API turns messy, user-entered phone numbers into clean, trustworthy data. Send a raw string like (415) 555-2671 or +44 20 7183 8750 and receive a fully parsed result with validity flags, canonical E.164 form, national and international display formats, the RFC3966 tel: URI, detected country, and the line type.
Powered by Google's libphonenumber metadata, its numbering-plan coverage matches what major platforms use in production. Built for forms, signups, CRM hygiene, fraud screening, and SMS/voice routing, it runs stateless on a global edge network for low latency everywhere.
Free tier included, no credit card required. One key works across all 49 APIs.
- Countries
- 240+
- Parse Speed
- <50ms
- Uptime SLA
- 99.9%
Key features
- Validate and format any phone number worldwide
- Canonical E.164, national, international, and RFC3966 formats
- Line-type detection (mobile vs fixed-line)
- Country and calling-code detection from ISO2 hints
- Independent valid and possible flags for flexible strictness
- Both GET (query params) and POST (JSON body) supported
- Powered by Google libphonenumber metadata
Built for
- Form and signup phone number validation
- CRM data hygiene and normalization
- Fraud screening and suspicious signup flagging
- SMS vs voice routing decisions
- Mobile vs fixed-line detection
- Standardizing numbers to E.164 for storage
- International contact data cleanup
- Click-to-call link generation via tel: URIs
Try it
Build the request for your data
Edit the parameters below and see the exact curl command and JSON response you will get. No key required to preview.
Parameters
GET /phone/v1/validate?number=%28415%29+555-2671&country=US&apikey=YOUR_KEY HTTP/1.1
Host: api.apicodex.io
{
"input": "(415) 555-2671",
"valid": true,
"possible": true,
"e164": "+14155552671",
"national": "(415) 555-2671",
"international": "+1 415 555 2671",
"rfc3966": "tel:+14155552671",
"uri": "tel:+14155552671",
"country": "US",
"country_calling_code": "1",
"type": "FIXED_LINE_OR_MOBILE",
"is_mobile": false,
"is_fixed_line": false
}Documentation
Phone Number Validation API Documentation
The Phone Number Validation & Formatting API parses, validates, and formats phone numbers worldwide using Google's libphonenumber metadata with line-type detection. Pass a number alone if it is already in international +E.164 form, or add a country hint (e.g. US, GB, TR) to parse local-format numbers. Both GET (query params) and POST (JSON body) requests are supported.
Base URL
https://api.apicodex.ioAuthentication
Authenticate every request with your API key: pass it as a query parameter, or send it in an X-Api-Key header.
?apikey=YOUR_KEY
# Or send it as a header:
{
"X-Api-Key": "YOUR_API_KEY"
}Request and response
Illustrative values. Confirm current endpoint behavior, quotas, and data freshness in the API documentation before production use.
GET /phone/v1/validate?number=(415)%20555-2671&country=US&apikey=YOUR_KEY HTTP/1.1{
"input": "(415) 555-2671",
"valid": true,
"possible": true,
"e164": "+14155552671",
"national": "(415) 555-2671",
"international": "+1 415 555 2671",
"rfc3966": "tel:+14155552671",
"uri": "tel:+14155552671",
"country": "US",
"country_calling_code": "1",
"type": "FIXED_LINE_OR_MOBILE",
"is_mobile": false,
"is_fixed_line": false
}Code examples
curl --request GET \
--url 'https://api.apicodex.io/phone/v1/validate?number=(415)%20555-2671&country=US&apikey=YOUR_KEY'Endpoints
GET /phone/v1/validate
Validate and format a phone number using query parameters.
/phone/v1/validate?number=(415)%20555-2671&country=US&apikey=YOUR_KEYPOST /phone/v1/validate
Validate and format a phone number using a JSON request body.
{ "number": "+442071838750", "country": "GB" }GET /phone/health
Health check endpoint that returns service status.
/phone/health?apikey=YOUR_KEYParameters
Required parameters
numberThe phone number to validate. May be E.164 (e.g. +14155552671) or a local format (e.g. (415) 555-2671) when a country is supplied.
Optional parameters
countryOptional ISO 3166-1 alpha-2 region used as the default country when the number is not in +E.164 form (e.g. US, GB, TR).apikeyYour API key, passed as a query parameter for authentication when calling the Worker directly.
Pricing
Phone Number Validation API Pricing
One key, one subscription, all 49 APIs. Start free and upgrade when you grow. No minimums, no lock-in.
This API costs 5 credits per request. Credits are shared across every API on your plan.
Estimate your monthly cost
Drag the slider to match your expected request volume. We will recommend the cheapest plan that covers it.
Recommended plan
Starter
$29.99 /month
Free
- All 49 APIs included
- No credit card required
- Full documentation and examples
Starter
Popular- All 49 APIs included
- Email support
- Usage dashboard and analytics
Pro
- All 49 APIs included
- Priority support
- Up to 5 API keys
Need a different plan?
Tell us about your API, volume, or support requirements.
Coming soon · MCP
Use the Phone Number Validation & Formatting API from your AI agent
The API Codex MCP server will expose this API, and the other 39, to Claude, Cursor and any MCP client as tools. Same key, same credits, one config entry.
FAQ
Frequently asked questions
You can send numbers in international E.164 form (e.g. +14155552671), in which case the country is detected automatically, or in a local format (e.g. (415) 555-2671). For local formats, supply a country hint using the ISO 3166-1 alpha-2 code (US, GB, TR, etc.) so the parser knows which numbering plan to apply. Both GET requests with query parameters and POST requests with a JSON body are supported.
Genuinely unparseable input returns a clean negative result with HTTP 200: { "input": "not-a-number", "valid": false, "possible": false }. The API does not throw errors for bad numbers, so you can branch on the valid and possible flags directly. A 400 status is reserved strictly for a missing number parameter or a malformed JSON body.
The possible flag checks only that the number has a plausible length and shape for its region, while the valid flag confirms the number fully conforms to that region's numbering plan. These independent flags let you choose your strictness: accept possible numbers during fast onboarding to reduce friction, then enforce full validity before billing or messaging customers.
Yes. Every successful response includes a type field with the detected line type (such as MOBILE, FIXED_LINE, or FIXED_LINE_OR_MOBILE) plus convenience booleans is_mobile and is_fixed_line. This is ideal for deciding whether to send an SMS, place a voice call, or flag a suspicious signup. Note that for some numbering plans the type may be FIXED_LINE_OR_MOBILE when the plan does not distinguish between the two.
The API is powered by Google's libphonenumber metadata, so it covers over 240 countries and territories — the same numbering-plan data used in production by Android and many major platforms. Coverage includes full validation, formatting, and line-type detection for each supported region's numbering plan.
Pass your API key as a query parameter, ?apikey=YOUR_KEY, or send it in an X-Api-Key header. All plans share the same full feature set and global edge latency.
The API is stateless and runs on a global edge network, delivering typical parse-and-format response times under 50ms. Because validation is performed locally against bundled libphonenumber metadata rather than calling out to external carriers, there is no network round-trip to a third party, keeping latency consistently low for production form validation and high-volume batch processing alike.
Keep building
Related APIs
Validate email addresses with disposable detection, risk assessment, and SMTP analysis for fraud screening.
Analyze SPF, DKIM, and DMARC records to optimize email domain configurations and improve deliverability.
Query DNS records with support for all record types and reverse lookups for network diagnostics and validation.