Check SMS/Voice Credit Balance
Description
Check SMS or voice credit balances on user account. Accepts GET or POST requests.
URL
https://melotext.com/apis/getcreditbalance/
Example Call: https://melotext.com/apis/getcreditbalance/?apikey=APIKEY&type=TYPE
PHP Code Sample (cURL):
$url = 'https://melotext.com/apis/getcreditbalance/';
$fields = array('apikey' => $api_key,
'type' => $type,
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
$result = curl_exec($ch);
return $result;
Parameters
Parameters | Required | Description |
---|---|---|
apikey | Required | The API key of your account. |
type | Required | Flag to determine SMS or Voice credit balance. 1 to return SMS credit balance and 2 for Voice. |
Return Values
Return Code | Description |
---|---|
Credit balance number | Your credit balance is returned on successful API call. |
-1 | Invalid API key passed in. |
-2 | Invalid type passed in. Should only be either a 1 or 2 depending on what credit balance you want to retrieve. 1 for SMS and 2 for Voice. |
-20 | Level 1 does not have access to the API. API can only be used with Levels 2, 3, and 4. |
Example API Response (data is returned in universal and lightweight JSON format)
{
"creditbalancenumber":"145",
"msg":"Your credit balance is returned on successful API call"
}