# Lịch sử đơn hàng

* API này dùng để lấy lịch sử thao tác với đơn hàng.

## Request

* Xem [common request params](/v3/readme.md#request-params).

```curl
curl --location 'https://pos.open.nhanh.vn/v3.0/order/history?appId={{appId}}&businessId={{businessId}}' \
--header 'Authorization: {{accessToken}}' \
--header 'Content-Type: application/json' \
--data '{
    "filters" : {
      "orderIds": [100, 101],
      "steps": [1, 7]
    }
}'
```

### Filters

| Key           | Type                         | Description                                                                                                                               |
| ------------- | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| orderIds      | array $$^{{\color{red}\*}}$$ | Mảng ID đơn hàng, tối đa 100                                                                                                              |
| type          | string                       | <p><strong>loguser</strong>: Lấy lịch sử thao tác trên Nhanh.<br><strong>logcarrier</strong>: Lấy lịch sử đơn hàng từ hãng vận chuyển</p> |
| createdAtFrom | int                          | Ngày tạo lịch sử thao tác đơn hàng từ ngày (định dạng timestamp)                                                                          |
| createdAtTo   | int                          | Ngày tạo lịch sử thao tác đơn hàng đến ngày (định dạng timestamp)                                                                         |
| steps         | array                        | Mảng [hành động thao tác](/v3/modelconstant.md#order-step)                                                                                |

## Response

* Xem cấu trúc chung [tại đây](/v3/readme.md#response).
* Xem const hành động [tại đây](/v3/modelconstant.md#order-step).

### Failed response

* Xem các mã lỗi chung [tại đây](/v3/readme.md#failed-response).

### Successful response

```json
{
    "code": 1,
    "paginator": {
        "next": "Giá trị để lấy dữ liệu trang tiếp theo"
    },
    "data": [
        {
            "logId": "(string) ID log thao tác đơn hàng",
            "orderId": "(int) ID đơn hàng trên Nhanh.vn",
            "step": "(int) ID hành động",
            "status": {
                "old": "(int) ID trạng thái cũ",
                "new": "(int) ID trạng thái mới"
            },
            "createdAt": "(int) Thời gian tạo (định dạng timestamp)",
            "createdById": "(int) ID người thao tác",
            "createdBy": "(string) Người thao tác"
        },
        {
            "logId": "(string) ID log thao tác đơn hàng",
            "orderId": "(int) ID đơn hàng trên Nhanh.vn",
            "step": "(int) ID hành động",
            "status": {
                "old": "(int) ID trạng thái cũ",
                "new": "(int) ID trạng thái mới"
            },
            "createdAt": "(int) Thời gian tạo (định dạng timestamp)",
            "createdById": "(int) ID người thao tác",
            "createdBy": "(string) Người thao tác"
        }
    ]
}
```


---

# 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://apidocs.nhanh.vn/v3/order/history.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.
