# Balance check request

## Balance check request

<mark style="color:green;">`POST`</mark> `http://lk.mysmpp.ru/xml/balance.php`

#### Headers

| Name                                           | Type   | Description                    |
| ---------------------------------------------- | ------ | ------------------------------ |
| Content-type<mark style="color:red;">\*</mark> | String | **`text/xml; charset=utf-8;`** |

#### Request Body

| Name                                             | Type   | Description                                                                                       |
| ------------------------------------------------ | ------ | ------------------------------------------------------------------------------------------------- |
| login.value<mark style="color:red;">\*</mark>    | String | Your login in the system                                                                          |
| password.value<mark style="color:red;">\*</mark> | String | Your password in the system                                                                       |
| token.value<mark style="color:red;">\*</mark>    | String | You can use a secret key instead of login and password. To obtain it, please contact your manager |

{% tabs %}
{% tab title="200: OK If a valid XML document is received" %}

```xml
<?xml version="1.0" encoding="utf-8" ?>
<response>
     <money>150</money>
     <sms area="Russia">111</sms>
     <sms area="Ukraine">111</sms>
</response>
```

{% endtab %}

{% tab title="400: Bad Request If an error occurs in the sent XML document" %}

```xml
<?xml version="1.0" encoding="utf-8"?>
<response>
     <error>Error message</error>
</response>
```

{% endtab %}
{% endtabs %}

### Deciphering parameters in query responses

<table><thead><tr><th width="136.33333333333331">Parameter</th><th width="145">Data type</th><th>Description</th></tr></thead><tbody><tr><td>money</td><td>Int</td><td>Fund balance</td></tr><tr><td>sms</td><td>Int</td><td>Number of available SMS messages for this destination</td></tr><tr><td>sms.area</td><td>String</td><td>The direction in which a given quantity of SMS can be shipped</td></tr><tr><td>error</td><td>String</td><td><p>The error text can take the following values:</p><ul><li>Incorrect XML document format </li><li>Incorrect login or password </li><li>POST data is missing</li></ul></td></tr></tbody></table>

### Example XML request

```xml
<?xml  version="1.0" encoding="utf-8" ?>
<request>
   <security>
      <login value="login" />
      <password value="password" />
   </security>
</request>
```

{% hint style="info" %}
The number of SMS cannot be summarized for different directions. When sending SMS in one direction, the number of available SMS messages in all other directions is reduced according to their cost.
{% endhint %}

### Example

You have 10 y.e. on your balance.&#x20;

The cost of SMS message sent to Russia is 1 y.e.&#x20;

The cost of SMS message sent to Ukraine is 2 y.e.&#x20;

The following XML document will be returned to you:

```xml
<?xml version="1.0" encoding="utf-8" ?>
<response>
     <money>10</money>
     <sms area="Russia">10</sms>
     <sms area="Ukraine">5</sms>
</response>
```

If you send two sms to Russia, the XML document will change as follows:

```xml
<?xml version="1.0" encoding="utf-8" ?>
<response>
     <money>8</money>
     <sms area="Russia">8</sms>
     <sms area="Ukraine">4</sms>
</response>
```
