> For the complete documentation index, see [llms.txt](https://developers.esms.vn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.esms.vn/esms-api/ham-truy-xuat-va-dang-ky/ham-lay-so-du-tai-khoan.md).

# Hàm lấy số dư tài khoản

## HTTP request

\ <mark style="color:yellow;">**`POST`**</mark> <https://rest.esms.vn/MainService.svc/json/GetBalance_json>

* **Content Type:** <mark style="color:orange;">application/json</mark>
* **Response Type:** <mark style="color:orange;">application/json</mark>

```json
curl --location 'https://rest.esms.vn/MainService.svc/json/GetBalance_json' \
--header 'Content-Type: application/json' \
--data '{
    "ApiKey": "{{ApiKey}}",
    "SecretKey": "{{SecretKey}}"
}'
```

* **Cấu trúc body của request:**

<table><thead><tr><th width="164.20001220703125">Tham số</th><th width="140">Kiểu dữ liệu</th><th width="142.199951171875" data-type="checkbox">Tính bắt buộc</th><th>Mô tả</th></tr></thead><tbody><tr><td>ApiKey</td><td>string</td><td>true</td><td>ApiKey eSMS cung cấp.</td></tr><tr><td>SecretKey</td><td>string</td><td>true</td><td>SecretKey eSMS cung cấp.</td></tr></tbody></table>

***

* **Response:**

{% tabs %}
{% tab title="100" %}

```json
{
    "Balance": 36693,
    "CodeResponse": "100",
    "UserID": 9999
}
```

**Request hợp lệ.**
{% endtab %}

{% tab title="101" %}

```json
{
    "Balance": 0,
    "CodeResponse": "101",
    "ErrorMessage": "Authorize Failed"
}
```

**Sai thông tin ApiKey/SecretKey.**
{% endtab %}
{% endtabs %}

**Cấu trúc body của response:**

| Thuộc tính   | Kiểu dữ liệu | Mô tả                           |
| ------------ | ------------ | ------------------------------- |
| Balance      | string       | Số dư tài khoản chính.          |
| CodeResponse | string       | Mã trả về.                      |
| UserID       | string       | Id user tài khoản của hệ thống. |

* *<mark style="color:yellow;">**Thông tin chi tiết mã lỗi xem ở bảng:**</mark>* [**Mã lỗi**](/esms-api/bang-ma-loi.md) **.**
* *<mark style="color:yellow;">**Lấy code mẫu các ngôn ngữ trên Postman:**</mark>* [**Link code mẫu**](https://samplefordevelopers.esms.vn/#571b0b39-3ce0-4102-817c-132beb05c7d8)**.**
