Home API Phone Insights API

Phone Insights API

1
Phone Insights API

This API can parse, format and find phone numbers in text documents for any phone number worldwide.

These are the endpoints:

Endpoint /parse

Given a phone number with an international prefix, or if you prefer by specifying the ISO country code, and the national phone number instead, we can tell you:

  • number_type: One of the following: FIXED, MOBILE, VOIP, SHORT_NUMBER, PREMIUM, TOLL_FREE, PAGER, etc.
  • location: Where available by prefix.
  • phone_number_e164: Phone number in E164. Perfect to be saved in a database in a standard way.
  • carrier: In countries where blocks of numbers are assigned to carriers. Note that if portability is available in the country, we will return the original carrier.
  • is_valid_number: Using the length, format and prefixes against our 100Mbytes+ database of phone numbers we can asses the validity of the phones. E.g. we can detect fake US numbers if the prefixes don’t exist.
  • country_code_iso: Two letter ISO country code for the phone number.
  • We also give other auxiliary fields such as: number_of_leading_zeros, national_number, etc. If you need more information returned, contact us!

Example request:

curl -X POST --include 'https://f-sm-jorquera-phone-insights-v1.p.mashape.com/parse' \
  -H 'X-Mashape-Key: {my-mashape-key}' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  --data-binary '{"phone_number":"+34626475849","country_code":"ES"}'

That returns:

{
  "country_code": 34,
  "country_code_iso": "ES",
  "location": "Spain",
  "location_latitude": 40.0028028,
  "location_longitude": -4.003104,
  "national_number": 626475849,
  "number_of_leading_zeros": null,
  "number_type": "MOBILE",
  "is_valid_number": true,
  "carrier": "Movistar",
  "phone_number_e164": "+34626475849"
}

 

Endpoint /format

Given a phone number with an international prefix, or if you prefer by specifying the ISO country code, and the national phone number instead, we can tell you:

  • national: phone number in national format, e.g. (415) 498-8739
  • international: phone number in international format, e.g. +1 (415) 498-8739
  • E164: phone number in E164 format, e.g. +14154988739
  • RFC3966: phone number in E164 format, e.g. tel:+14154988739

Example request:

curl -X POST --include 'https://f-sm-jorquera-phone-insights-v1.p.mashape.com/format' \
  -H 'X-Mashape-Key: {my-mashape-key}' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  --data-binary '{"phone_number":"+34626475849","country_code":"ES"}'

Response:

{
  "national": "626 47 58 49",
  "international": "+34 626 47 58 49",
  "E164": "+34626475849",
  "RFC3966": "tel:+34-626-47-58-49"
}

Endpoint /find-numbers-in-text Endpoint

Given a text document (max. 512 characters), we can find all phone numbers in it. E.g. for the text: Hey, the office's phone number is (510) 765-9845, my personal one is 4157653478. We will return the begin and end character position for both phone numbers, along with a E164 formatted version of each. We can find phone numbers, even if the format used in the document differs.

curl -X POST --include 'https://f-sm-jorquera-phone-insights-v1.p.mashape.com/find-numbers-in-text' \
  -H 'X-Mashape-Key: {my-mashape-key}' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  --data-binary '{"text":"Hello, call me at 4154785647 or at (510) 675 8976 if its after 11PM","country_code":"US"}'

Response:

{
  "matches": [
    {
      "start": 18,
      "end": 28,
      "phone_number": "+14154785647"
    },
    {
      "start": 35,
      "end": 49,
      "phone_number": "+15106758976"
    }
  ]
}

If you want to try it, head to mashape: https://market.mashape.com/f-sm-jorquera/phone-insights. The API is completely free!