# Lấy danh sách mẫu tin

{% hint style="info" %}
**Lưu ý:**

* Đối với các API sử dụng cho Shop thì API\_KEY: [`<api_key>`](https://docs.etelecom.vn/tich-hop-api/shop/tai-khoan#api-key).Thông tin base\_url của [Shop](https://docs.etelecom.vn/tich-hop-api/shop/tai-khoan)
* Đối với các API sử dụng cho Partner thì API\_KEY: [`<shop_key>`](https://docs.etelecom.vn/tich-hop-api/partner/su-dung#ket-noi-lan-thu-hai-tro-di).Thông tin base\_url của [Partner](https://docs.etelecom.vn/tich-hop-api/partner/tai-khoan)
  {% endhint %}

## POST $BASE\_URL.Zalo/ListTemplates

> ListTemplates

```json
{"openapi":"3.1.1","info":{"title":"API Document","version":"v1"},"tags":[{"name":"Zalo"}],"paths":{"$BASE_URL.Zalo/ListTemplates":{"post":{"tags":["Zalo"],"summary":"ListTemplates","operationId":"shop.Zalo-ListTemplates","responses":{"200":{"description":"A successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/mkListTemplatesResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/mkListTemplatesRequest"}}},"required":true}}}},"components":{"schemas":{"mkListTemplatesResponse":{"type":"object","properties":{"paging":{"$ref":"#/components/schemas/ktCursorPageInfo"},"templates":{"type":"array","items":{"$ref":"#/components/schemas/mkZlOATemplate"}}}},"ktCursorPageInfo":{"type":"object","properties":{"after":{"type":"string"},"before":{"type":"string"},"limit":{"type":"integer"},"next":{"type":"string"},"prev":{"type":"string"},"sort":{"type":"string"}}},"mkZlOATemplate":{"type":"object","properties":{"apply_template_quota":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"is_journey":{"type":"boolean"},"oa_id":{"type":"string","format":"int64"},"preview_url":{"type":"string"},"price":{"type":"integer"},"price_exceeded":{"type":"integer"},"ref_param":{"type":"string"},"retail_price":{"type":"integer"},"shop_id":{"type":"string","format":"int64"},"template_daily_quota":{"type":"integer"},"template_id":{"type":"integer"},"template_name":{"type":"string"},"template_params":{"type":"array","items":{"$ref":"#/components/schemas/mkTemplateParam"}},"template_quality":{"$ref":"#/components/schemas/ukTemplateQuality"},"template_remaining_quota":{"type":"integer"},"template_status":{"$ref":"#/components/schemas/ueTemplateStatus"},"template_tag":{"$ref":"#/components/schemas/usTemplateTag"},"timeout":{"type":"integer"},"token_type":{"$ref":"#/components/schemas/uqTokenType"},"type":{"$ref":"#/components/schemas/lkTemplateType"},"updated_at":{"type":"string","format":"date-time"}}},"mkTemplateParam":{"type":"object","properties":{"accept_null":{"type":"boolean"},"max_length":{"type":"integer"},"min_length":{"type":"integer"},"name":{"type":"string"},"require":{"type":"boolean"},"type":{"type":"string"}}},"ukTemplateQuality":{"type":"string","enum":["unknown","UNDEFINED","LOW","MEDIUM","HIGH"]},"ueTemplateStatus":{"type":"string","enum":["unknown","PENDING_REVIEW","DISABLE","ENABLE","REJECT"]},"usTemplateTag":{"type":"string","enum":["unknown","OTP","IN_TRANSACTION","POST_TRANSACTION","ACCOUNT_UPDATE","GENERAL_UPDATE","FOLLOW_UP"]},"uqTokenType":{"type":"string","enum":["unknown","token_logistics_7","token_logistics_30","token_coach_bus_7","token_coach_bus_30"]},"lkTemplateType":{"type":"string","enum":["unknown","text","otp","table","rating","button","payment_request","voucher","custom"]},"mkListTemplatesRequest":{"type":"object","properties":{"filter":{"$ref":"#/components/schemas/mkFilterListTemplates"},"paging":{"$ref":"#/components/schemas/ktCursorPaging"}}},"mkFilterListTemplates":{"type":"object","properties":{"date_from":{"type":"string","format":"date-time"},"date_to":{"type":"string","format":"date-time"},"oa_id":{"type":"string","format":"int64"},"template_id":{"type":"integer"},"template_ids":{"type":"array","items":{"type":"integer"}},"template_name":{"type":"string"},"type":{"$ref":"#/components/schemas/lkTemplateType"}}},"ktCursorPaging":{"type":"object","properties":{"after":{"type":"string"},"before":{"type":"string"},"limit":{"type":"integer"},"sort":{"type":"string"}}}}}}
```

**Request:**

```json
curl --location '$BASE_URL.Zalo/ListTemplates' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer $API_KEY' \
--data '{
  "filter": {
    "date_from": "2023-07-24T14:15:22Z",
    "date_to": "2023-08-02T14:15:22Z"
  },
  "paging": {
    "limit": 50
  }
}'
```

**Response:**

```json
{
  "paging": {
    "after": "string",
    "before": "string",
    "limit": 0,
    "next": "string",
    "prev": "string",
    "sort": "string"
  },
  "templates": [
    {
      "apply_template_quota": true,
      "created_at": "2019-08-24T14:15:22Z",
      "price": 0,
      "template_daily_quota": 0,
      "template_id": 0,
      "template_name": "string",
      "template_params": [
        {
          "accept_null": true,
          "max_length": 0,
          "min_length": 0,
          "name": "string",
          "require": true,
          "type": "string"
        }
      ],
      "template_quality": "unknown",
      "template_remaining_quota": 0,
      "template_status": "unknown",
      "template_tag": "unknown",
      "timeout": 0,
      "type": "unknown",
      "updated_at": "2019-08-24T14:15:22Z"
    }
  ]
}
```

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

<table><thead><tr><th width="176.33333333333331">Tham số</th><th width="205">Kiểu dữ liệu</th><th>Mô tả</th></tr></thead><tbody><tr><td>oa_id</td><td>int64</td><td>ID của OA</td></tr><tr><td>type</td><td>string</td><td><p>Enum: </p><p><mark style="color:red;"><strong>"text":</strong></mark><strong> </strong><mark style="color:$info;"><strong>Tin dạng văn bản</strong></mark> </p><p><mark style="color:red;"><strong>"otp":</strong></mark><strong> </strong><mark style="color:$info;"><strong>Tin xác thực</strong></mark></p><p><mark style="color:red;"><strong>"table":</strong></mark><strong> </strong><mark style="color:$info;"><strong>Tin dạng bảng</strong></mark></p><p><mark style="color:red;"><strong>"rating":</strong></mark><strong> </strong><mark style="color:$info;"><strong>Tin đánh giá</strong></mark> <br><mark style="color:red;"><strong>"response button":</strong></mark><strong> </strong><mark style="color:$info;"><strong>Tin response button</strong></mark></p><p><mark style="color:red;"><strong>"payment_request":</strong></mark><strong> </strong><mark style="color:$info;"><strong>Tin yêu cầu thanh toán</strong></mark></p><p><mark style="color:red;"><strong>"voucher":</strong></mark><strong> </strong><mark style="color:$info;"><strong>Tin voucher</strong></mark></p><p><mark style="color:red;"><strong>"custom":</strong></mark><strong> </strong><mark style="color:$info;"><strong>Tin tinh chỉnh</strong></mark></p></td></tr><tr><td>template_id</td><td>integer</td><td>ID của mẫu tin</td></tr><tr><td>template_name</td><td>string</td><td>Tên mẫu tin</td></tr><tr><td>date_from</td><td>string&#x3C;date-time></td><td>Ngày bắt đầu</td></tr><tr><td>date_to</td><td>string&#x3C;date-time></td><td>Ngày kết thúc</td></tr></tbody></table>

**Cấu trúc thuộc tính dữ liệu trả về**

| Tham số                    | Kiểu dữ liệu       | Mô tả                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| -------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| template\_id               | integer            | ID của mẫu tin                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| template\_name             | string             | Tên của mẫu tin                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| price                      | integer            | Đơn giá của mẫu tin                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| timeout                    | integer            | Thời gian tính phí của mẫu tin                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| apply\_template\_quota     | boolean            | <p><mark style="color:red;"><strong><code>True</code></strong></mark></p><p><mark style="color:red;"><strong><code>False</code></strong></mark> </p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| template\_daily\_quota     | integer            | Số lượng tin ZNS có thể gửi trong 1 ngày                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| template\_quality          | string             | <p><mark style="color:red;"><strong><code>unknown</code></strong></mark>: Không xác định</p><p><mark style="color:red;"><strong><code>UNDEFINED</code></strong></mark>: Mức độ chất lượng OA chưa được xác định (trường hợp OA không gửi thông báo ZNS nào trong khung thời gian đánh giá)<br><mark style="color:red;"><strong><code>LOW</code></strong></mark>: Mức độ chất lượng kém</p><p><mark style="color:red;"><strong><code>MEDIUM</code></strong></mark>: Mức độ chất lượng trung bình<br><mark style="color:red;"><strong><code>HIGH</code></strong></mark>: Mức độ chất lượng cao</p>                                                                                                                                                                                                                                                              |
| template\_remaining\_quota | integer            | Số lượng tin ZNS có thể gửi còn lại trong 1 ngày                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| template\_status           | string             | <p>Trạng thái mẫu tin<br><mark style="color:red;"><strong><code>unknown</code></strong></mark>: Không xác định<br><mark style="color:red;"><strong><code>PENDING\_REVIEW</code></strong></mark>: Đang duyệt<br><mark style="color:red;"><strong><code>DISABLE</code></strong></mark>: Bị khóa<br><mark style="color:red;"><strong><code>ENABLE</code></strong></mark>: Đã duyệt<br><mark style="color:red;"><strong><code>REJECT</code></strong></mark>: Bị từ chối</p>                                                                                                                                                                                                                                                                                                                                                                                       |
| template\_tag              | string             | <p>Cấp độ mẫu tin<br><mark style="color:red;"><strong><code>unknown</code></strong></mark>: Không xác định</p><p><mark style="color:red;"><strong><code>OTP</code></strong></mark>: Tin OTP (tag 0)</p><p><mark style="color:red;"><strong><code>IN\_TRANSACTION</code></strong></mark>: Xác nhận/Cập nhật thông tin giao dịch (Tag 1)</p><p><mark style="color:red;"><strong><code>POST\_TRANSACTION</code></strong></mark>: Hỗ trợ dịch vụ liên quan sau giao dịch (Tag 2)</p><p><mark style="color:red;"><strong><code>ACCOUNT\_UPDATE</code></strong></mark>: Cập nhật thông tin tài khoản (Tag 3)</p><p><mark style="color:red;"><strong><code>GENERAL\_UPDATE</code></strong></mark>: Thay đổi thông tin dịch vụ (Tag 4)</p><p><mark style="color:red;"><strong><code>FOLLOW\_UP</code></strong></mark>: Thông báo ưu đãi đến khách hàng cũ (Tag 5)</p> |
| template\_params           | array object       | Danh sách các thuộc tính của mẫu tin                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| updated\_at                | string\<date-time> | Thời gian cập nhật                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| created\_at                | string\<date-time> | Thời gian tạo                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
