Number Verifier
Number Verifier
PHP

Introduction

The NumberValidation API validates any phonenumber.

It will tell you the formatting options and type of the number, and will determine the most likely carrier.

Authentication

Your product-token authenticates your calls.

Provide it in the X-CM-PRODUCTTOKEN header for authentication.

Number Validation

The default Number Validation resource validates one phonenumber at a time

using GET

https://api.cmtelecom.com/v1.1/numbervalidation/{phonenumber}

Send one request with a phonenumber in the url, and receive the validation information as JSON object.

GET Parameters

name in required schema
X-CM-PRODUCTTOKEN header true 0000000-0000-0000-0000-000000000000
phonenumber path true 0031687654321

Responses

http status content-type description
200 application/json {
  • "carrier": "Lycamobile",
  • "country_code": 31,
  • "country_iso": "NL",
  • "format_e164": "+31687654321",
  • "format_international": "+31 6 87654321",
  • "format_national": "06 87654321",
  • "region": Netherlands",
  • "region_code": "NL",
  • "timezone": [
    • "Europe/Amsterdam"
    ],
  • "type": {
    • "mobile": true,
    • "fixed_line": false,
    • "fixed_line_or_mobile": false,
    • "voip": false,
    • "toll_free": false,
    • "premium_rate": false,
    • "standard_rate": false,
    • "shared_cost": false,
    • "personal": false,
    • "pager": false,
    • "voicemail": false,
    • "shortcode": false,
    • "emergency": false,
    • "unknown": false
    },
  • "valid_number": true
}

curl -i https://api.cmtelecom.com/v1.1/numbervalidation/0031687654321
     -H "X-CM-PRODUCTTOKEN: 0000000-0000-0000-0000-000000000000"
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $data = json_encode(array("phonenumber" => "string"));

  $url = 'https://api.cmtelecom.com/v1.1/numbervalidation/0031687654321';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'X-CM-PRODUCTTOKEN: 0000000-0000-0000-0000-000000000000'
                                 ),
     CURLOPT_HEADER         => TRUE,
     CURLOPT_RETURNTRANSFER => TRUE
    )
  );

  $result = curl_exec($ch);

  var_dump($result);
  
  curl_close($ch);

using POST

https://api.cmtelecom.com/v1.1/numbervalidation

Send one JSON object with a phonenumber property, and receive the validation information as JSON object.

POST Parameters

name in required schema
X-CM-PRODUCTTOKEN header true 0000000-0000-0000-0000-000000000000
object body true {"phonenumber" : "string"}

Responses

http status content-type description
200 application/json {
  • "carrier": "Lycamobile",
  • "country_code": 31,
  • "country_iso": "NL",
  • "format_e164": "+31687654321",
  • "format_international": "+31 6 87654321",
  • "format_national": "06 87654321",
  • "region": Netherlands",
  • "region_code": "NL",
  • "timezone": [
    • "Europe/Amsterdam"
    ],
  • "type": {
    • "mobile": true,
    • "fixed_line": false,
    • "fixed_line_or_mobile": false,
    • "voip": false,
    • "toll_free": false,
    • "premium_rate": false,
    • "standard_rate": false,
    • "shared_cost": false,
    • "personal": false,
    • "pager": false,
    • "voicemail": false,
    • "shortcode": false,
    • "emergency": false,
    • "unknown": false
    },
  • "valid_number": true
}

curl -i https://api.cmtelecom.com/v1.1/numbervalidation
     -X POST
     -H "Content-Type: application/json"
     -H "X-CM-PRODUCTTOKEN: 0000000-0000-0000-0000-000000000000"
     -d '{"phonenumber": "string"}'
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $data = json_encode(array("phonenumber" => "string"));

  $url = 'https://api.cmtelecom.com/v1.1/numbervalidation';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json',
                                 'X-CM-PRODUCTTOKEN: 0000000-0000-0000-0000-000000000000'
                                 ),
     CURLOPT_HEADER         => TRUE,
     CURLOPT_POST           => TRUE,
     CURLOPT_POSTFIELDS     => $data,
     CURLOPT_RETURNTRANSFER => TRUE
    )
  );

  $result = curl_exec($ch);

  var_dump($result);
  
  curl_close($ch);

Batch Number Validation

The batch resource on the Number Validation API can validate multiple numbers at once.

Reducing requests and overhead to speed up the validation of a list of numbers.

Create a batch

https://api.cmtelecom.com/v1.1/numbervalidation/batch

Send a JSON array containing objects with a phonenumber property.

The GUID for this batch is returned, for use with the processing and retreavel calls.

POST Parameters

name in required schema
X-CM-PRODUCTTOKEN header true 0000000-0000-0000-0000-000000000000
array body true
    [
  • {
    • "phonenumber" : "string"
    },{
    • "phonenumber" : "string"
    },{
    • "phonenumber" : "string"
    }
  • ]

Responses

http status content-type description
200 application/json {"batch": "B9247F0F-3A00-4076-A0B4-894ABBA3E08D"}
curl -i https://api.cmtelecom.com/v1.1/numbervalidation/batch
     -X POST
     -H "Content-Type: application/json"
     -H "X-CM-PRODUCTTOKEN: 0000000-0000-0000-0000-000000000000"
     -d '[{"phonenumber": "string"},{"phonenumber": "string"},{"phonenumber": "string"}]'
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $data = json_encode(array(
              array("phonenumber" => "string"),
              array("phonenumber" => "string"),
              array("phonenumber" => "string")
              ));

  $url = 'https://api.cmtelecom.com/v1.1/numbervalidation/batch';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json',
                                 'X-CM-PRODUCTTOKEN: 0000000-0000-0000-0000-000000000000'
                                 ),
     CURLOPT_HEADER       => TRUE,
     CURLOPT_POST           => TRUE,
     CURLOPT_POSTFIELDS     => $data,
     CURLOPT_RETURNTRANSFER => TRUE
    )
  );
  $result = curl_exec($ch);

  var_dump($result);
  
  curl_close($ch);
Status of a batch

https://api.cmtelecom.com/v1.1/numbervalidation/batch/{batch}/status

A status call to see how far along the processing of the batch is. Processing will start automatically.

GET Parameters

name in required type
X-CM-PRODUCTTOKEN header true 0000000-0000-0000-0000-000000000000
batch path true string

Responses

http status content-type description
200 application/json {
  • "batch": "B9247F7F-3A00-4076-A0B4-894ABBA3E08D",
  • "created": "2016-08-29T13:31:17+0000",
  • "total": 2,
  • "processed": 0,
  • "progress": 0,
  • "pages": 1
}
curl -i https://api.cmtelecom.com/v1.1/numbervalidation/batch/{batch}/status
     -X GET
     -H "Content-Type: application/json"
     -H "X-CM-PRODUCTTOKEN: 0000000-0000-0000-0000-000000000000"
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $url = 'https://api.cmtelecom.com/v1.1/numbervalidation/batch/'
         .$batch
         .'/status';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json',
                                 'X-CM-PRODUCTTOKEN: 0000000-0000-0000-0000-000000000000'
                                 ),
     CURLOPT_HEADER       => TRUE,
     CURLOPT_RETURNTRANSFER => TRUE
    )
  );
  $result = curl_exec($ch);

  var_dump($result);

  curl_close($ch);
Result of a batch

https://api.cmtelecom.com/v1.1/numbervalidation/batch/{batch}

Retrieve the first page of the batch.

A page contains 1000 items, the amount of pages is availble in return of the /status call and the /process call.

GET Parameters

name in required type
X-CM-PRODUCTTOKEN header true 0000000-0000-0000-0000-000000000000
batch path true string

Responses

http status content-type description
200 application/json
    [
    • {
      • "carrier": "Lycamobile",
      • "country_code": 31,
      • ...
      },
    • {
      • "carrier": "Lycamobile",
      • "country_code": 31,
      • ...
      }
    ]
curl -i https://api.cmtelecom.com/v1.1/numbervalidation/batch/{batch}
     -X GET
     -H "Content-Type: application/json"
     -H "X-CM-PRODUCTTOKEN: 0000000-0000-0000-0000-000000000000"
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $url = 'https://api.cmtelecom.com/v1.1/numbervalidation/batch/'
         .$batch;

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json',
                                 'X-CM-PRODUCTTOKEN: 0000000-0000-0000-0000-000000000000'
                                 ),
     CURLOPT_HEADER       => TRUE,
     CURLOPT_RETURNTRANSFER => TRUE
    )
  );
  $result = curl_exec($ch);

  var_dump($result);

  curl_close($ch);
Paginated result of a batch

https://api.cmtelecom.com/v1.1/numbervalidation/batch/{batch}/page/{page}

Retrieve a specific page of the batch.

A page contains 1000 items, the amount of pages is availble in return of the /status call and the /process call, a call to an out of range page will return an empty array.

GET Parameters

name in required type
X-CM-PRODUCTTOKEN header true 0000000-0000-0000-0000-000000000000
batch path true string
page path true string

Responses

http status content-type description
200 application/json
    [
    • {
      • "carrier": "Lycamobile",
      • "country_code": 31,
      • ...
      },
    • {
      • "carrier": "Lycamobile",
      • "country_code": 31,
      • ...
      }
    ]
curl -i https://api.cmtelecom.com/v1.1/numbervalidation/batch/{batch}/page/{page}
     -X GET
     -H "Content-Type: application/json"
     -H "X-CM-PRODUCTTOKEN: 0000000-0000-0000-0000-000000000000"
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $url = 'https://api.cmtelecom.com/v1.1/numbervalidation/batch/'
         .$batch
         .'/page/'
         .$page;

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json',
                                 'X-CM-PRODUCTTOKEN: 0000000-0000-0000-0000-000000000000'
                                 ),
     CURLOPT_HEADER       => TRUE,
     CURLOPT_RETURNTRANSFER => TRUE
    )
  );
  $result = curl_exec($ch);

  var_dump($result);

  curl_close($ch);

Number Lookup

The Lookup method in the Number Verifier API will look up additional information for the given phonenumber.

Information like the Portation-state, the actual operator, if the number is roaming and even if the number is active on the network.

Collecting this data is not free, and you must contact your account manager before you can use this resource.

using GET

https://api.cmtelecom.com/v1.1/numberlookup/{phonenumber}

Send one request with a phonenumber in the url, and receive the validation information as JSON object, enriched with properties provided by the lookup result.

GET Parameters

name in required schema
X-CM-PRODUCTTOKEN header true 0000000-0000-0000-0000-000000000000
phonenumber path true 0031687654321

Responses

http status content-type description
200 application/json {
  • "active_number": false,
  • "carrier": "Lycamobile",
  • "carrier_mcc": 204,
  • "carrier_mnc": 09,
  • "country_code": 31,
  • "country_iso": "NL",
  • "format_e164": "+31687654321",
  • "format_international": "+31 6 87654321",
  • "format_national": "06 87654321",
  • "ported": false,
  • "region": Netherlands",
  • "region_code": "NL",
  • "roaming": false,
  • "roaming_country_iso": "NL",
  • "roaming_country_prefix": 31,
  • "roaming_carrier": "Lycamobile",
  • "roaming_mcc": 204,
  • "roaming_mnc": 09,
  • "timezone": [
    • "Europe/Amsterdam"
    ],
  • "type": {
    • "mobile": true,
    • "fixed_line": false,
    • "fixed_line_or_mobile": false,
    • "voip": false,
    • "toll_free": false,
    • "premium_rate": false,
    • "standard_rate": false,
    • "shared_cost": false,
    • "personal": false,
    • "pager": false,
    • "voicemail": false,
    • "shortcode": false,
    • "emergency": false,
    • "unknown": false
    },
  • "valid_number": true
}
curl -i https://api.cmtelecom.com/v1.1/numberlookup/0031687654321
     -H "X-CM-PRODUCTTOKEN: 0000000-0000-0000-0000-000000000000"
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $data = json_encode(array("phonenumber" => "string"));

  $url = 'https://api.cmtelecom.com/v1.1/numberlookup/0031687654321';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'X-CM-PRODUCTTOKEN: 0000000-0000-0000-0000-000000000000'
                                 ),
     CURLOPT_HEADER         => TRUE,
     CURLOPT_RETURNTRANSFER => TRUE
    )
  );

  $result = curl_exec($ch);

  var_dump($result);
  
  curl_close($ch);
using POST

https://api.cmtelecom.com/v1.1/numberlookup

Send one JSON object with a phonenumber property, and receive the validation information as JSON object, enriched with properties provided by the lookup result.

POST Parameters

name in required schema
X-CM-PRODUCTTOKEN header true 0000000-0000-0000-0000-000000000000
object body true {
  • "phonenumber" : "string",
  • "mnp_lookup": true
}

Responses

http status content-type description
200 application/json {
  • "active_number": false,
  • "carrier": "Lycamobile",
  • "carrier_mcc": 204,
  • "carrier_mnc": 09,
  • "country_code": 31,
  • "country_iso": "NL",
  • "format_e164": "+31687654321",
  • "format_international": "+31 6 87654321",
  • "format_national": "06 87654321",
  • "ported": false,
  • "region": Netherlands",
  • "region_code": "NL",
  • "roaming": false,
  • "roaming_country_iso": "NL",
  • "roaming_country_prefix": 31,
  • "roaming_carrier": "Lycamobile",
  • "roaming_mcc": 204,
  • "roaming_mnc": 09,
  • "timezone": [
    • "Europe/Amsterdam"
    ],
  • "type": {
    • "mobile": true,
    • "fixed_line": false,
    • "fixed_line_or_mobile": false,
    • "voip": false,
    • "toll_free": false,
    • "premium_rate": false,
    • "standard_rate": false,
    • "shared_cost": false,
    • "personal": false,
    • "pager": false,
    • "voicemail": false,
    • "shortcode": false,
    • "emergency": false,
    • "unknown": false
    },
  • "valid_number": true
}
curl -i https://api.cmtelecom.com/v1.1/numberlookup
     -X POST
     -H "Content-Type: application/json"
     -H "X-CM-PRODUCTTOKEN: 0000000-0000-0000-0000-000000000000"
     -d '{"phonenumber": "string"}'
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $data = json_encode(array("phonenumber" => "string"));

  $url = 'https://api.cmtelecom.com/v1.1/numberlookup';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json',
                                 'X-CM-PRODUCTTOKEN: 0000000-0000-0000-0000-000000000000'
                                 ),
     CURLOPT_HEADER         => TRUE,
     CURLOPT_POST           => TRUE,
     CURLOPT_POSTFIELDS     => $data,
     CURLOPT_RETURNTRANSFER => TRUE
    )
  );

  $result = curl_exec($ch);

  var_dump($result);
  
  curl_close($ch);