Get SMS Records

Get SMS CDR Records for a Specific Time Period.

Get Information

URL:
[start_date] would be month-day-year or 04-24-2017 [end_date] would be month-day-year or 04-26-2017
Optional: direction=inbound to get inbound SMS records https://api.teleapi.net/smscdr/[start]/[end]?token=XXXXXX&direction=inbound
Optional: source=5555555555 to get only records for source number 5555555555. Can be mixed with destination=... https://api.teleapi.net/smscdr/[start]/[end]?token=XXXXXX&source=5555555555
Optional: destination=5555555555 to get only records for destination number 5555555555. Can be mixed with source=... https://api.teleapi.net/smscdr/[start]/[end]?token=XXXXXX&source=5555555555 https://api.teleapi.net/smscdr/[start]/[end]?token=XXXXXX&source=5555555555&destination=4444444444
Optional: canada=yes to get only records sent to Canadian destinations https://api.teleapi.net/smscdr/[start]/[end]?token=XXXXXX&canada=yes
Optional: extra_data=yes to get the carrier and penalty surcharge https://api.teleapi.net/smscdr/[start]/[end]?token=XXXXXX&extra_data=yes
Full Sample URL:
https://api.teleapi.net/smscdr/04-24-2017/04-26-2017?token=ABC-ABC-ABC
shell
PHP+CURL
RESPONSE
CURL
curl -v -X GET "https://api.teleapi.net/smscdr/04-24-2017/04-26-2017/?token=XXXX"
PHP + Curl
<?php
$start_date = "04-24-2017";
$end_date = "04-26-2017";
$baseurl = "https://api.teleapi.net/smscdr/";
$baseurl .= $start_date."/".$end_date."/?token=XXXX";
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$retval = curl_exec($ch);
curl_close($ch);
$object = json_decode($retval);
print_r($object);

Responses from API

Successful Download

This is a sample of what to expect from the API. If you open this in a web browser, it will download a file for you.
date gmt,source,destination,direction,type,cost
2017-04-22 00:15:30,7205551212,3035551212,out,sms,0.003500

Invalid Date Range

The code may return an empty set if the date range cannot get a result.

Failed to Download

{
"status":"error",
"error":"invalid date"
}