# Tồn kho

* Khi tồn kho trên Nhanh.vn có thay đổi, Nhanh.vn sẽ bắn webhooks về cho hệ thống của bạn.
  * Khi các hóa đơn, đơn hàng phát sinh xuất nhập kho gần nhau, hoặc khi app của bạn lỗi xử lý webhooks: Nhanh bắn webhooks có thể gom nhiều sản phẩm lại chung 1 request webhooks, tối đa 100 sản phẩm (Chú ý số 100 này có thể thay đổi trong tương lai, xin vui lòng theo dõi tài liệu để cập nhật).
* Xem cách [đăng kí nhận và xử lý webhooks](https://apidocs.nhanh.vn/webhooks/webhooks)
* Để nhận được webhooks tồn kho, app phải có quyền [Danh sách sản phẩm](https://apidocs.nhanh.vn/product/index)

```javascript
{
    "event": "inventoryChange",
    "businessId": int, // ID doanh nghiệp trên Nhanh.vn
    "webhooksVerifyToken": string, // Key xác minh khi nhận dữ liệu, tương ứng với webhooks verify token trong app của bạn
    "data": {
        "id": {
            "id": int, // ID sản phẩm trên Nhanh.vn,
            "shopProductId": string, // shop product ID nếu sản phẩm được bắn từ các hệ thống khác sang Nhanh.vn
            "remain": int, // số lượng tồn
            "shipping": int, // số lượng đang giao hàng
            "holding": int, // số lượng tạm giữ
            "damage": int, // số lượng hàng lỗi
            "available": int, // số lượng có thể bán, sử dụng số này để hiển thị số tồn trên website hoặc chặn việc đặt các sản phẩm hết hàng.
            "depots": { // số tồn chi tiết trong từng kho
                "depotId1": {
                    "remain": int, // số lượng tồn
                    "shipping": int, // số lượng đang giao hàng
                    "holding": int, // số lượng tạm giữ
                    "damage": int, // số lượng hàng lỗi
                    "available": int, // số lượng có thể bán, sử dụng số này để hiển thị số tồn trên website hoặc chặn việc đặt các sản phẩm hết hàng.
                },
                "depotId2": {
                    ...
                }
            }
        },
        "id": {
            ...
        }
    }
}
```


---

# 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/v2/webhooks/inventory.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.
