Loader

Retrieve balance


Overview

This will show the number of credits available on your account.

GET https://api.clickatell.com/rest/account/balance


Note:
 the REST API may respond with various HTTP status codes. See the full list here
.


JSON

Request
GET /rest/account/balance HTTP/1.1
HOST: api.clickatell.com
X-Version: 1
Authorization: Bearer [Your Authorization Token]
Accept: application/json
 
Response
HTTP/1.1 200 OK
Content-Type: application/json
 
{
 "data":{
   "balance":"300.50"
  }
}
 
XML

Request
GET /rest/account/balance HTTP/1.1
HOST: api.clickatell.com
X-Version: 1
Authorization: Bearer [Your Authorization Token]
Accept: application/xml

Response

1
2
3
4
5
6
7
8
9

HTTP/1.1 200 OK
Content-Type: application/xml
 
<?xml version="1.0"?>
<response>
    <data>
        <balance>300.50</balance>
    </data>
</response>


Sample code

cURL
authToken=""
 
curl -X GET \
-H "X-Version: 1" \
-H "Accept: application/json" \
-H "Authorization: Bearer $authToken" \
https://api.clickatell.com/rest/account/balance

Python

1
2
3
4
5
6
7
8
9
10
11
12
13

import httplib2, json
 
authToken = "place auth token here"
 
resp, content = httplib2.Http().request(
    "https://api.clickatell.com/rest/account/balance",
    "GET",
    headers={
        "X-Version" "1",
        "Accept" "application/json",
        "Authorization" "Bearer " + authToken
    }
)


PHP

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

<?php
 
$authToken "<place auth token here>";
 
$ch = curl_init();
 
curl_setopt($ch, CURLOPT_URL,            "https://api.clickatell.com/rest/account/balance");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER,     array(
    "X-Version: 1",
    "Accept: application/json",
    "Authorization: Bearer $authToken"
));
 
$result = curl_exec ($ch);
 
?>

Did you find this information informative?

Other Resources

Ask the Community

Visit Stack Overflow to join our community of developers and find the answer you need

Contact Support

Contact our support team and one of our agents will be in touch with you to answer any questions you have