# 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)**.**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.esms.vn/esms-api/ham-truy-xuat-va-dang-ky/ham-lay-so-du-tai-khoan.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
