# Danh mục sản phẩm

* API này dùng để lấy [danh mục sản phẩm](https://nhanh.vn/product/category/index).
* Danh mục sản phẩm thường rất ít khi bị thay đổi, bạn có thể lấy dữ liệu và cache khoảng 24h (và có chức năng để user có thể xóa cache, để lấy dữ liệu mới nhất khi cần) giúp giảm tải việc gọi API.

## Request

* Xem [common request params](/v3/readme.md#request-params).
* Xem [Postman sample](https://www.postman.com/nhanh-vn/pos-open-nhanh-vn/request/svrw042/product-category).

```curl
curl --location 'https://pos.open.nhanh.vn/v3.0/product/category?appId={{appId}}&businessId={{businessId}}' \
--header 'Authorization: {{accessToken}}' \
--header 'Content-Type: application/json'
--data '{
    "filters": {
        "status": 1
    },
    "paginator": {
        "size": 50
    }
}'
```

### Filters

| Key    | Type   | Description                                             |
| ------ | ------ | ------------------------------------------------------- |
| ids    | array  | Mảng ID danh mục, tối đa 100                            |
| name   | string | Tên danh mục                                            |
| code   | string | Mã danh mục                                             |
| status | int    | <p>Trạng thái danh mục (1 = Active<br>2 = Inactive)</p> |

## 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 danh mục 1",
      "parentId": "(int) ID danh mục cha 1",
      "code": "(string) Mã danh mục 1",
      "name": "(string) Tên danh mục 1",
      "order": "(int) Thứ tự",
      "image": "(string) Đường dẫn ảnh danh mục",
      "content": "(string) Nội dung",
      "status": "(int) Trạng thái: 1 = Active, 2 = Inactive"
    },
   {
      "id": "(int) ID danh mục 2",
      "parentId": "(int) ID danh mục cha 2",
      "code": "(string) Mã danh mục 2",
      "name": "(string) Tên danh mục 2",
      "order": "(int) Thứ tự",
      "image": "(string) Đường dẫn ảnh danh mục",
      "content": "(string) Nội dung",
      "status": "(int) Trạng thái: 1 = Active, 2 = Inactive"
    }
  ]
}
```


---

# 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/product/category.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.
