apyhub
DATA VALIDATION

Validate and Format Phone Number API

What it does

Phone Number Validator parses and validates phone numbers, returning E.164 and country-aware formats you can store or compare reliably. Send a phone value in E.164 form or national format; for national-format numbers, include the optional country hint as an ISO alpha-2 code.

The response tells you whether the number is valid and includes the normalized e164 value when available. It can also return the original input, country, calling_code, country_code, national_format, national_number, and international_format, so you can standardize user-entered contact data without guessing formatting rules.

Use Phone Number Validator when you need to clean signup forms, deduplicate contacts, or accept local phone entry from multiple countries while keeping one canonical representation in your database. It is especially useful before sending SMS, building user profiles, or enforcing per-country phone rules at the edge of your app.

If you only need a validity check, use the valid flag. If you need normalization, use the formatted fields to display or persist the number in a consistent way.

POST
Parse & validate a phone number (E.164 + per-country rules).
http://localhost:8080/creightonnick0/validate-phone-number
QUICKSTARTGUIDE

Quickstart

Check whether a phone number is valid by sending it in the request body.

curl -X POST "http://localhost:8080/creightonnick0/validate-phone-number" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"phone":"+44 20 7946 0958"}'

What you'll get back

Returns a JSON object with these top-level fields: e164 (string), input (string), valid (boolean), country (string), calling_code (string), country_code (string), national_format (string), national_number (string), and international_format (string).

{
  "e164": "+442079460958",
  "input": "+44 20 7946 0958",
  "valid": true,
  "country": "United Kingdom",
  "calling_code": "44",
  "country_code": "GB",
  "national_format": "020 7946 0958",
  "national_number": "2079460958",
  "international_format": "+44 20 7946 0958"
}
TRY ITLIVE · 10 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
The phone number (E.164 with + , or national format)
ISO alpha-2 country hint (required for national-format numbers)

About this endpoint

What it does

Parses and validates a phone number, returning normalized formatting and country-related details when available. The request accepts a phone number in E.164 or national format, with an optional country hint for national-format inputs.

Request Body

ParameterTypeMandatoryDescription
phoneStringYesThe phone number, either in E.164 format with + or in national format.
countryStringNoISO alpha-2 country hint. Required for national-format numbers.

Response

Returns a JSON object with these top-level fields: e164 string, input string, valid boolean, country string, calling_code string, country_code string, national_format string, national_number string, and international_format string.

ParameterTypeMandatoryDescription
e164StringNoThe normalized E.164 representation of the phone number.
inputStringNoThe input phone number as received.
validBooleanNoWhether the phone number is valid.
countryStringNoThe resolved country, if available.
calling_codeStringNoThe country calling code, if available.
country_codeStringNoThe country code, if available.
national_formatStringNoThe national formatting of the phone number, if available.
national_numberStringNoThe national number portion, if available.
international_formatStringNoThe international formatting of the phone number, if available.

Body

Name
Type
Description
bodyREQUIRED
object
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.