In order to check the remaining credits in your OneSixty account you must POST your query (which must contain exactly 2 parameters) to the following URL: http(s)://api.onesixty.co.uk/rest/v2/credits
| Parameters | Type | Information |
| username (required) |
String | Your OneSixty username. |
| api_key (required) |
String | Your API key. This is different from your password. |
This will return the current total (or zero if the details are incorrect) - i.e. always expect an integer to be returned. For example:
1000
Sample code
<?php
function check_credits($params)
{
$options = array(
CURLOPT_HEADER => FALSE,
CURLOPT_POST => TRUE,
CURLOPT_POSTFIELDS => $params,
CURLOPT_RETURNTRANSFER => TRUE
);
$ch = curl_init('http://api.onesixty.co.uk/rest/v2/credits');
if ($ch)
{
if (curl_setopt_array($ch, $options))
{
$response = curl_exec($ch);
return (int)$response;
}
curl_close($ch);
}
return FALSE;
}
$params = http_build_query(array(
'username' => 'MyUsername',
'api_key' => '47acd2028cf81b5da88ddeedb2aea4eca4b71fbd',
));
$credits_remaining = check_credits($params);
echo $credits_remaining;
?>
Speak to a real person
(01323) 800 160
One direct number for all enquiries - sales and support.
Monday - Friday, 10am to 6pm.
Clear SMS pricing
SMS text messages from just 2.99p. Lower prices available for an agreeable monthly quota.
