# Danh sách xuất nhập kho nháp

* API này dùng để lấy [danh sách phiếu nháp](https://nhanh.vn/inventory/requirement/bill): hóa đơn nháp nhà cung cấp, bán lẻ, bán sỉ, chuyển kho.
  * Các loại hóa đơn khác bạn có thể xem 2 request params là type và mode ở bên dưới để làm tương tự.
* **Chú ý:**
  * Hệ thống chỉ hỗ trợ lấy hóa đơn trong khoảng 31 ngày.
  * Nếu bạn không truyền param lastUpdatedAt mặc định sẽ lấy 31 ngày gần nhất. Nếu bạn muốn lấy dữ liệu các ngày cũ hơn, xin vui lòng truyền lastUpdatedAtFrom và lastUpdatedAtTo trong khoảng 31 ngày, VD: 2025-08-01 => 2025-08-31.
  * Khi lọc theo ids thì bỏ qua khoảng ngày.

## Request

```curl
curl --location 'https://pos.open.nhanh.vn/v3.0/bill/draftlist?appId={{appId}}&businessId={{businessId}}' \
--header 'Authorization: {{accessToken}}' \
--header 'Content-Type: application/json' \
--data '{
    "filters": {
        "modes": [2],
        "lastUpdatedAtFrom": 1753981239,
        "lastUpdatedAtTo": 1756659639,
        "depotIds": [31010]
    },
     "paginator": {
        "size": 50,
        "next": {"id": 100}
    },
}'
```

### Filters

| Key               | Type  | Description                                               |
| ----------------- | ----- | --------------------------------------------------------- |
| ids               | array | ID phiếu xuất nhập kho                                    |
| types             | array | [Loại xuất nhập kho](/v3/modelconstant.md#inventory-type) |
| modes             | array | [Kiểu xuất nhập kho](/v3/modelconstant.md#inventory-mode) |
| depotIds          | array | Mảng ID kho hàng                                          |
| statuses          | array | List trạng thái phiếu nháp                                |
| lastUpdatedAtFrom | int   | Thời gian cập nhật cuối từ (timestamp)                    |
| lastUpdatedAtTo   | int   | Thời gian cập nhật cuối đến (timestamp)                   |

### Paginator

* Xem cấu trúc chung [tại đây](/v3/readme.md#paginator).

## Response

* Xem cấu trúc chung [tại đây](/v3/readme.md#response).

### Failed response

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

### Successful response

* Xem const [Loại xuất nhập kho](/v3/modelconstant.md#inventory-type)
* Xem const [Kiểu xuất nhập kho](/v3/modelconstant.md#inventory-mode)

```json
{
  "code": 1,
  "paginator": {
    "next": "1900073"
  },
  "data": [
    {
      "id": "(int) ID phiếu nháp",
      "type": "(int) Loại xuất nhập kho",
      "mode": "(int) Kiểu xuất nhập kho",
      "fromDepotId": "(int) ID kho hàng xuất",
      "toDepotId": "(int) ID kho hàng nhận",
      "status": "(int) ID trạng thái phiếu nháp",
      "lastUpdatedAt": "(int) Thời gian cập nhật cuối (timestamp)",
      "created": {
        "userId": "(int) ID người tạo phiếu nháp",
        "createdAt": "(int) Thời gian tạo phiếu nháp (timestamp)"
      },
      "approved": {
        "userId": "(int) ID người duyệt phiếu nháp",
        "approvedAt": "(int) Thời gian duyệt phiếu nháp (timestamp)"
      },
      "confirmed": {
        "userId": "(int) ID người xác nhận phiếu nháp",
        "approvedAt": "(int) Thời gian xác nhận phiếu nháp (timestamp)"
      },
      "payment": {
        "discount": "(double) Số tiền chiết khấu theo đơn"
      },
      "description": "(string) Ghi chú thêm"
    }
  ]
}
```


---

# 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/bill/draftlist.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.
