# Hàm kiểm tra trạng thái tin nhắn Zalo

{% hint style="warning" %}
**Lưu ý:** Giới hạn tốc độ gọi api này là 100 requests/giây.
{% endhint %}

## HTTP request

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

* **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/QueryZnsStatus/' \
--header 'Content-Type: application/json' \
--data '{
    "ApiKey": "{{ApiKey}}",
    "SecretKey": "{{SecretKey}}",
    "SmsId": "2d00b834cc1d488081ba7ec308da0ec40918238965",
    "SmsType": "25"
}'
```

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

<table><thead><tr><th width="167">Tham số</th><th width="126">Kiểu dữ liệu </th><th width="134" 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 của tài khoản.</td></tr><tr><td>SecretKey</td><td>string</td><td>true</td><td>SecretKey của tài khoản.</td></tr><tr><td>SmsId</td><td>string</td><td>true</td><td>SmsId hệ thống trả về từ mỗi hàm gửi tin nhắn.</td></tr><tr><td>SmsType</td><td>string</td><td>true</td><td>Loại tin nhắn. Api này chỉ cho phép lấy trạng thái của hai loại sau:<br>24: Zalo ưu tiên<br>25: Zalo bình thường</td></tr></tbody></table>

***

* **Response:**

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

```json
{
    "CodeResult": "100",
    "Data": {
        "ErrorInfo": "0",
        "FinalStatus": "1",
        "SMSID": "59e0c764219c49119063db4468f257fb221",
        "SendFailed": 0,
        "SendStatus": 5,
        "SendSuccess": 1,
        "TotalPrice": 330.0,
        "TotalReceiver": 1,
        "TotalSent": 1,
        "ZaloMsgId": "6dc7499c9ef6baaee3e1"
    }
}
```

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

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

<table><thead><tr><th width="140.8887939453125">Thuộc tính</th><th width="125.111083984375">Kiểu dữ liệu</th><th>Mô tả</th></tr></thead><tbody><tr><td>CodeResult</td><td>string</td><td>Kết quả của Request.</td></tr><tr><td>ErrorMessage</td><td>string</td><td>Thông báo kết quả trả về.</td></tr><tr><td>Data</td><td>object</td><td>Thông tin trạng thái của tin nhắn Zalo .</td></tr></tbody></table>

* **Cấu trúc thuộc tính từng object trong Data:**

<table><thead><tr><th width="174">Thuộc tính</th><th width="128.333251953125">Kiểu dữ liệu</th><th>Mô tả</th></tr></thead><tbody><tr><td>ErrorInfo</td><td>string</td><td><p>Mã kết quả xử lý gửi tin nhắn.</p><p>Giá trị trả về:</p><ul><li>0: Tin nhắn gửi thành công.</li><li>1001: Tin nhắn trả trạng thái thất bại do khách hàng không online để nhận tin  trong thời gian quy định.</li><li>null: Tin nhắn chưa được gửi.</li><li>Các giá trị khác: Mã lỗi do hệ thống Zalo trả về. Vui lòng tham khảo <a href="https://developers.zalo.me/docs/zbs-template-message/bang-ma-loi/"><strong>bảng mã lỗi Zalo</strong></a> tại link đính kèm để tra cứu ý nghĩa chi tiết.</li></ul></td></tr><tr><td>FinalStatus</td><td>string</td><td><p>Mô tả trạng thái tin nhắn đã có kết quả cuối cùng hay chưa. </p><p>Các giá trị trả về:<br>1: Đã có trạng thái cuối<br>0: Chưa có trạng thái cuối</p></td></tr><tr><td>SMSID</td><td>string</td><td>SmsId của tin nhắn cần kiểm tra.</td></tr><tr><td>SendFailed</td><td>int</td><td>Số lượng tin thất bại.</td></tr><tr><td>SendStatus</td><td>int</td><td>Trạng thái tin nhắn<br>1: Chờ Duyệt<br>2: Chờ gửi.<br>5: Đã gửi xong.</td></tr><tr><td>SendSuccess</td><td>int</td><td>Số lượng tin thành công.</td></tr><tr><td>TotalPrice</td><td>decimal</td><td>Tổng tiền của đơn.</td></tr><tr><td>TotalReceiver</td><td>int</td><td>Số lượng người nhận.</td></tr><tr><td>TotalSent</td><td>int</td><td>Số lượng gửi.</td></tr><tr><td>ZaloMsgId</td><td>string</td><td>Mã giao dịch của Zalo.</td></tr></tbody></table>

* *<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/#dfb2453d-0f9e-43ec-b7ac-260af32cbac3)**.**


---

# 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-thong-tin-trang-thai-zns-1.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.
