List Tollfree Numbers
This function will allow you to list all available toll free numbers.
URL:
Argument | Required | Type | Field |
type | yes | string | tollfree |
Simply send us a GET/POST to the above URL to get an API response with the list of numbers, just pass type=tollfree. Response codes are in the menu to the left.
shell
PHP+CURL
PHP+PLAIN
RESPONSE
Shell/CURL
curl -v -X GET "https://apiv1.teleapi.net/dids/list?token=XXXX&type=tollfree"
Using PHP+CURL
<?php
$data = array("type" => "tollfree");
$data = http_build_query($data);
$baseurl = "https://apiv1.teleapi.net/dids/states?token=XXXX&state=CA";
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$retval = curl_exec($ch);
curl_close($ch);
$object = json_decode($retval);
print_r($object);
PHP - file_get_contents
<?php
$data = array("state" => "CA",
"ratecenter" => "LSAN DA01"
);
$data = http_build_query($data);
$url = "https://apiv1.teleapi.net/dids/states?token=XXXX&".$data;
$x = file_get_contents($url);
$object = json_decode($x);
print_r($object);
{
"code": 200,
"status": "success",
"data": {
"dids": [
{
"id": 222,
"npa": 888,
"nxx": 555,
"xxxx": 5555,
"number": 8885555555,
"ratecenter": "tollfree",
"state": "null",
"setup_rate":"0.000000",
"monthly_rate":"0.790000",
"per_minute_rate":"0.02000"
},
{
"id": 333,
"npa": 888,
"nxx": 555,
"xxxx": 5554,
"number": 8885555554,
"ratecenter": "tollfree",
"state": "null",
"setup_rate":"0.000000",
"monthly_rate":"0.790000",
"per_minute_rate":"0.0200"
}
]}
"count": 2
}
{
"code": 400,
"status": "error",
"data": "Missing variable: token"
}