# API tích điểm và đổi quà

## I. API tích điểm<br>

1. Lịch sử tích điểm

URL: /history-point?type=point

Method: GET

Content-Type: application/json

| createdAtRangeFrom | number | <p><br></p> | Thời gian bắt đầu                                |
| ------------------ | ------ | ----------- | ------------------------------------------------ |
| createdAtRangeTo   | number | <p><br></p> | Thời gian kết thúc                               |
| phone              | String | <p><br></p> | Số điện thoại khách hàng                         |
| email              | String | <p><br></p> | Email khách hàng                                 |
| page               | number | <p><br></p> | Số thứ tự của trang, mỗi trang tối đa 20 bản ghi |

Kết quả trả về:&#x20;

HTTP Response Code:  200

| <p>Response:<br>\[{</p><p>  "type": 1, // loại tích luỹ</p><p>  "score": 100, // số điểm tích lũy</p><p>  "status": 1, // trạng thái tích lũy (thành công : 1, thất bại: 0)</p><p>  "product": {</p><p>    "code": "TIVI01", // mã sản phẩm tích lũy</p><p>    "name": "Tivi", // tên sản phẩm tích lũy</p><p>    "id": "64d9f28b2b3ba308b322c710"</p><p>  },</p><p>  "contact": {</p><p>    "phones": \[</p><p>      {</p><p>        "type": "Work",</p><p>        "\_id": "64db290a7796fe24bfe876a8",</p><p>        "value": "0867123456"</p><p>      }</p><p>    ],</p><p>    "name": "Garnacho",</p><p>    "emails": \[</p><p>      {</p><p>        "type": "Work",</p><p>        "\_id": "64db290a7796fe24bfe876a9",</p><p>        "value": "<garnacho@gmail.com>"</p><p>      }</p><p>    ],</p><p>    "lastname": "",</p><p>    "customerId": 475,</p><p>    "id": "64db290a7796fe24bfe876a7"</p><p>  },</p><p>  "org": "62c10674cbe832bc9245a5b8",</p><p>  "code": "TIVInpmx8b98pfg", // mã code tích lũy</p><p>  "serialNumber": "npmx8b98pfg", // serial number tích luỹ</p><p>  "createdAt": 1692084490615, // thời gian tích lũy</p><p>  "id": "64db290a7796fe24bfe876b4"</p><p>}]</p> |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

2. Tích điểm

URL: /accumulate

Method: POST

Content-Type: application/json

| code | string | Y | Mã code tích lũy                                                                                                                                                                                                                                                                  |
| ---- | ------ | - | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| data | object | Y | <p>{<br>“emails”: \[{type: “Work”, value: “<a href="mailto:xyz@example.com"><xyz@example.com></a>”}],  // email khách hàng đổi quà<br>“name”: “thong”, // tên khách hàng đổi quà</p><p>“phones”: \[{type: “Work”, value: “023232”}]  // số điện thoại khách hàng đổi quà<br>}</p> |

Kết quả trả về:&#x20;

HTTP Response Code:  200

| <p>Response:<br>{</p><p>"success": 1,</p><p>}</p> |
| ------------------------------------------------- |

II. API đổi quà&#x20;

1. Lịch sử tích điểm

URL: /history-point

Method: GET

Content-Type: application/json

| createdAtRangeFrom | number | <p><br></p> | Thời gian bắt đầu                                |
| ------------------ | ------ | ----------- | ------------------------------------------------ |
| createdAtRangeTo   | number | <p><br></p> | Thời gian kết thúc                               |
| phone              | String | <p><br></p> | Số điện thoại khách hàng                         |
| email              | String | <p><br></p> | Email khách hàng                                 |
| page               | number | <p><br></p> | Số thứ tự của trang, mỗi trang tối đa 20 bản ghi |

Kết quả trả về:&#x20;

HTTP Response Code:  200

| <p>Response:<br>\[{</p><p>  "type": 2, // loại đổi quà</p><p>  "score": 10, // số điểm dùng để đổi quà</p><p>  "status": 1,// trạng thái đổi quà (thành công : 1, thất bại: 0)</p><p>  "gift": {</p><p>    "code": "DAUMAY01", // mã code của phần quà</p><p>    "name": "Đầu máy", // tên phần quà</p><p>    "score": 10, // số điểm để đổi quà</p><p>    "id": "64d9f2ec2b3ba308b322c782"</p><p>  },</p><p>  "contact": {</p><p>    "phones": \[</p><p>      {</p><p>        "type": "Work",</p><p>        "\_id": "64db290a7796fe24bfe876a8",</p><p>        "value": "0867123456"</p><p>      }</p><p>    ],</p><p>    "name": "Garnacho",</p><p>    "emails": \[</p><p>      {</p><p>        "type": "Work",</p><p>        "\_id": "64db290a7796fe24bfe876a9",</p><p>        "value": "<garnacho@gmail.com>"</p><p>      }</p><p>    ],</p><p>    "customerId": 475, // id contact trên CRM</p><p>    "id": "64db290a7796fe24bfe876a7"</p><p>  },</p><p>  "org": "62c10674cbe832bc9245a5b8",</p><p>  "createdAt": 1692085265818, // thời gian đổi quà</p><p>  "id": "64db2c11cbad5f4fdd254567"</p><p>}]</p> |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

2. Tích điểm

URL: /redeem

Method: POST

Content-Type: application/json

| code | string | Y | Mã code phần quà                                                                                                                                                            |
| ---- | ------ | - | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| data | object | Y | <p>{<br>“email”: “<a href="mailto:xyz@example.com"><xyz@example.com></a>”, // email khách hàng đổi quà</p><p>“phone”: “023232” // số điện thoại khách hàng đổi quà<br>}</p> |

Kết quả trả về:&#x20;

HTTP Response Code:  200

| <p>Response:<br>{</p><p>"success": 1,</p><p>}</p> |
| ------------------------------------------------- |


---

# 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://docs.antbuddy.com/tai-lieu-antbuddy-huong-dan-su-dung-antbuddy-docs-user-guide/quan-tri-khach-hang-antcrm-antcrm-customer-management/khach-hang-than-thiet-loyalty/api-tich-diem-va-doi-qua.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.
