Account Balance

Retrieve your current account balance via MoceanSMS API Server at Base URL

Response will be given for every request in XML format by default. In fact, you get to choose between XML or JSON format by setting value for optional parameter "mocean-resp-format" and submit along your account balance query.

HTTP Method Supported

GET - MoceanSMS API Server only reads data from HTTP URL

Base URL

https://rest-api.moceansms.com/rest/1/account/balance

Parameters

Parameter Name

Data Format

Descriptions

mocean-api-key

* Required

string

Your account API key.

mocean-api-secret

* Required

string

Your account API secret.

mocean-resp-format

* Optional

string

Response format. By default, response format will be returned in XML. Supported formats are:

  1. XML
  2. JSON

Example Request

curl -X GET "https://rest-api.moceansms.com/rest/1/account/balance?mocean-api-key={api_key}&mocean-api-secret={api_secret}"
$url = 'https://rest-api.moceansms.com/rest/1/account/balance?' . http_build_query(
[
'mocean-api-key' => 'API_KEY',
'mocean-api-secret' => 'API_SECRET',
]
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);

Example Response

A successful response for account balance query will be as follows:

<result>
    <status>0</status>
    <value>100.0000</value>
</result>                  
{
  "status":0,
  "value":100.0000
}

While unsuccessful response will be as follows:

<result>
    <status>1</status>
    <err_msg>Authorization failed</err_msg>
</result>                  
{
  "status":1,
  "err_msg":"Authorization failed"
}

Balance Response Variables

Parameter Name

Data Format

Descriptions

status

number

Status of the request.

value

number

Credit balance of the SMS account in the original top-up currency. For example, if the account was topped up EUR, then a 95.0000 means EUR95.0000.

err_msg

string

Error message.

Balance Response Status Codes

Status Code

Descriptions

0

OK. No error encountered

1

Authorization failed. Invalid mocean-api-key or mocean-api-secret.

24

Unknown error.