Loader

Retrieve balance


Overview

This command will return the number of credits available on your account.

If you simply want to monitor your account balance, you can also receive SMS and email notices when your account balance reaches a certain amount. This can be configured within your Developers’ Central account.


Command
getbalance

Parameters

You need to supply the authentication parameters that are outlined in the Getting Started guide.


Examples

All examples below are for the document/literal based server.

1
2
3
4
5
6
7
8
9
10

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://api.clickatell.com/soap/document_literal/webservice">
<SOAP-ENV:Body>
<ns1:getbalance>
<api_id>123456</api_id>
<user>MyUsername</user>
<password>MyPassword</password>
</ns1:getbalance>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


Code Samples

PHP

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

<?php
$oClient new SoapClient(
'http://api.clickatell.com/soap/document_literal/webservice?wsdl',
array(
'trace' => true,
'keep_alive' => true
)
);
 
// Query balance
$aResult $oClient->getbalance(
array(
'api_id' => '123456',
'user' => 'MyUsername',
'password' => 'MyPassword',
)
);
 
echo '<pre>' . print_r($aResult,true) . '<

‘; ?>

API Responses


Example Response

Successful API response:

1
2
3
4
5
6
7
8

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://api.clickatell.com/soap/document_literal/webservice">
<SOAP-ENV:Body>
<ns1:getbalanceResponse>
<return>Credit: 1500.806</return>
</ns1:getbalanceResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


Error response:

1
2
3
4
5
6
7
8

><?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://api.clickatell.com/soap/document_literal/webservice">
<SOAP-ENV:Body>
<ns1:getbalanceResponse>
<return>ERR: 001, Authentication failed</return>
</ns1:getbalanceResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


Return Format


Successful API response:

Credits: <balance>


Error response

ERR: <error code>, <error description>

 

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