Phone Validation API

Phone Validation API

Parse and validate phone numbers

Overview

The Phone Validation API is a powerful tool for parsing and validating phone numbers.

Features

  • Get country code: Phone number validation API can determine the country code of the phone number being validated.
  • Get phone number type (e.g toll free): The API can identify the type of phone number, such as whether it is a toll-free number or a fixed line/mobile number.
  • Convert phone number to URI: Phone validator API can convert the phone number into a URI format, which is useful for various applications and integrations.
  • Parse and find phone numbers in a text (full-text search): Phone number validator API can scan a block of text and extract any phone numbers present within it, allowing for full-text search and extraction of phone numbers.

Getting Started

To access the Phone Validation API , you need to obtain an API key from AnyAPI.io. The API key is used for authentication and should be included in the request URL as a query parameter.

Let’s Try Sign In

Find phone numbers in text (full-text) endpoint

Send a GET request to the following URL to Find phone numbers in text (full-text)

curl --request GET \
  --url 'https://anyapi.io/api/v1/phone/find?text=For%20tech%20support%20call%20%2B7%20(800)%20555-35-35%20internationally%20or%20reach%20a%20local%20US%20branch%20at%20%2B12133734253&apiKey=YOUR_API_KEY'
[
  {
    "number": {
      "valid": true,
      "countryCode": "RU",
      "format": {
        "international": "+7 800 555 35 35",
        "national": "8 (800) 555-35-35"
      },
      "uri": "tel:+78005553535"
    },
    "endsAt": 40,
    "startsAt": 22
  },
  {
    "number": {
      "valid": true,
      "countryCode": "US",
      "type": "FIXED_LINE_OR_MOBILE",
      "format": {
        "international": "+1 213 373 4253",
        "national": "(213) 373-4253"
      },
      "uri": "tel:+12133734253"
    },
    "endsAt": 99,
    "startsAt": 87
  }
]

Request parameters

Use the parameters listed below to customize your request. Mandatory parameters are indicated

textstringRequired
Text to parse (urlencoded)
apiKeystringRequired
Your unique API key, which is required to authenticate your requests.

Response parameters

The API returns its response in a simple, lightweight JSON format.

[].number.validboolean
A boolean value indicating whether the input phone number is valid or not.
[].number.countryCodestring
The country code of the phone number.
[].number.format.internationalstring
The phone number formatted in international format.
[].number.format.nationalstring
The phone number formatted in national format.
[].number.uristring
The phone number converted to a URI format.
[].startsAtnumber
The extracted phone number start index.
[].endsAtnumber
The extracted phone number end index.

Validate and parse phone numbers endpoint

Send a GET request to the following URL to Validate and parse phone numbers

curl --request GET \
  --url 'https://anyapi.io/api/v1/phone/validate?phone_number=%2B12133734253&apiKey=YOUR_API_KEY'
{
  "valid": true,
  "countryCode": "US",
  "type": "FIXED_LINE_OR_MOBILE",
  "format": {
    "international": "+1 213 373 4253",
    "national": "(213) 373-4253"
  },
  "uri": "tel:+12133734253"
}

Request parameters

Use the parameters listed below to customize your request. Mandatory parameters are indicated

phone_numberstringRequired
Phone number (urlencoded)
apiKeystringRequired
Your unique API key, which is required to authenticate your requests.

Response parameters

The API returns its response in a simple, lightweight JSON format.

validboolean
A boolean value indicating whether the input phone number is valid or not.
countryCodestring
The country code of the phone number.
typestring
The type of phone number, such as "FIXED_LINE_OR_MOBILE" or "TOLL_FREE".
format.internationalstring
The phone number formatted in international format.
format.nationalstring
The phone number formatted in national format.
uristring
The phone number converted to a URI format.

Response and error codes

Whenever you make a request that fails for some reason, an error is returned also in the JSON format. The errors include an error code and description, which you can find in detail below.

Status CodeTypeDetails
200OKThe request was successful.
400Bad RequestThe request was invalid or cannot be otherwise served.
401UnauthorizedAuthentication credentials were missing or incorrect.
422Quota reachedThe request cannot be served due to the application's rate limit having been exhausted for the resource.
404Not FoundThe requested resource could not be found.
429Too Many RequestsThe request cannot be served due to the application's rate limit having been exhausted for the resource.
500Internal Server ErrorSomething went wrong on the server.
503Service UnavailableThe service is temporarily unavailable.