# Sản phẩm xuất nhập kho

* Tính năng này dùng để lấy danh sách sản phẩm xuất nhập kho của doanh nghiệp.
* Tương đương dữ liệu tại mục: Kho hàng > Xuất nhập kho > [Sản phẩm xuất nhập kho](https://nhanh.vn/inventory/imex/index)

## Request

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

```curl
curl --location 'https://pos.open.nhanh.vn/v3.0/bill/imexs?appId={{appId}}&businessId={{businessId}}' \
--header 'Authorization: {{accessToken}}' \
--header 'Content-Type: application/json'
--data '{
    "filters": {
        "fromDate": "2025-05-01",
        "toDate": "2025-05-31"
    },
    "paginator": {
        "size": 50
    }
}'
```

### Filters

| Key            | Type  | Description                                              |
| -------------- | ----- | -------------------------------------------------------- |
| id             | int   | ID bản ghi sản phẩm xuất nhập kho                        |
| fromDate       | date  | Thời gian từ ngày định dạng (yyyy-mm-dd). VD: 2022-09-25 |
| toDate         | date  | Thời gian đến ngày (yyyy-mm-dd). VD: 2022-09-25          |
| billId         | int   | ID hóa đơn xuất nhập kho                                 |
| type           | int   | Loại xuất nhập kho                                       |
| mode           | int   | Kiểu xuất nhập kho                                       |
| depotId        | int   | ID kho hàng xuất đi                                      |
| relatedDepotId | int   | ID kho liên quan                                         |
| warrantyBillId | int   | ID phiếu bảo hành                                        |
| orderId        | int   | ID đơn hàng                                              |
| orderIds       | array | List ID đơn hàng (chỉ hỗ trợ lọc tối đa 100 ID đơn hàng) |
| supplierId     | int   | ID nhà cung cấp                                          |
| product        | array | Mảng thông tin sản phẩm (xem ở bảng bên dưới)            |

* Thông tin **product**

| Key                | Type | Description           |
| ------------------ | ---- | --------------------- |
| id                 | int  | ID sản phẩm           |
| relatedId          | int  | ID sản phẩm liên quan |
| categoryId         | int  | ID danh mục           |
| internalCategoryId | int  | ID danh mục nội bộ    |
| brandId            | int  | ID thương hiệu        |
| typeId             | int  | Loại sản phẩm         |
| imei               | int  | IMEI sản phẩm         |
| imeiId             | int  | ID IMEI sản phẩm      |

## 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

```json
{
  "code": 1,
  "paginator": {
    "next": "Dùng để lấy dữ liệu trang tiếp theo"
  },
  "data": [
    {
      "id": "(int) ID bản ghi sản phẩm xuất nhập kho",
      "billId": "(int) ID hóa đơn xuất nhập kho",
      "type": "(int) Loại hóa đơn",
      "mode": "(int) Kiểu hóa đơn",
      "date": "(string) Ngày xuất nhập kho",
      "reference": {
        "orderId": "(int) ID đơn hàng liên quan",
        "requirementBillId": "(int) ID phiếu nháp liên quan",
        "inventoryCheckId": "(int) ID phiếu kiểm kho liên quan",
        "warrantyBillId": "(int) ID phiếu bảo hành liên quan",
      },
      "depot": {
        "id": "(int) ",
        "name": "(string) Tên kho hàng"
      },
      "relatedDepot": {
        "id": "(int) ID kho hàng liên quan",
        "name": "(string) Tên kho hàng liên quan"
      },
      "supplier": {
        "id": "(int) ID nhà cung cấp",
        "name": "(string) Tên nhà cung cấp",
        "mobile": "(string) Số điện thoại nhà cung cấp"
      },
      "product": {
        "id": "(int) ID sản phẩm",
        "code": "(string) Mã sản phẩm",
        "barcode": "(string) Mã vạch sản phẩm",
        "name": "(string) Tên sản phẩm",
        "prices": {
          "retail": "(double) Giá bán",
          "import": "(double) Giá nhập",
          "avgCost": "(double) Giá vốn"
        }
      },
      "imei": {
        "id": "(int) ID IMEI",
        "code": "(string) Số IMEI"
      },
      "avgCost": "(int) Giá vốn lần xuất nhập kho",
      "productPrice": "(int) Giá bán lần xuất nhập kho",
      "quantity": "(int) Số lượng",
      "vat": "(int) VAT",
      "vatPercent": "(int) Phần trăm VAT",
      "discount": "(int) Chiết khấu",
      "description": "(string) Ghi chú",
      "points": "(int) Số điểm được cộng",
      "usedPoints": "(int) Số điểm đã tiêu",
      "usedPointAmount": "(int) Số tiền đã tiêu",
      "createdAt": "(int) Thời gian tạo (định dạng timestamp)",
      "saleBonus": "(int) Số tiền hoa hồng cho nhân viên bán hàng",
      "extendedWarranty": {
        "id": "(int) ID bảo hành mở rộng",
        "amount": "(int) Số tiền bảo hành mở rộng",
        "month": "(int) Số tháng bảo hành mở rộng"
      },
      "warrantyReasonId": "(int) ID lý do bảo hành"
    }
  ]
}
```


---

# 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/imexs.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.
