# Thêm sản phẩm

* API này dùng để thêm sản phẩm, tối đa 100 sản phẩm / request.

## Request

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

```curl
curl --location 'https://pos.open.nhanh.vn/v3.0/product/add?appId={{appId}}&businessId={{businessId}}' \
--header 'Authorization: {{accessToken}}' \
--header 'Content-Type: application/json' \
--data '[
    {
        "appProductId": "PID001",
        "name": "Sản phẩm 1",
        "status": 1,
        "importPrice": 50000,
        "importPriceVatMode": 2,
        "importPriceVat": 8,
        "priceVatMode": 2,
        "vat": 8,
        "price": 100000,
        "oldPrice": 120000,
        "wholesalePrice": 80000,
        "shippingWeight": 300,
        "description": "Mô tả ngắn 1",
        "content": "Nội dung sản phẩm 1",
        "externalImages": [
            "https://p16-oec-va.ibyteimg.com/tos-maliva-i-o3syd03w52-us/71e9c892eb054ee6a04594d56aca1055~tplv-o3syd03w52-origin-jpeg.jpeg?dr=15568&from=520841845&idc=maliva&ps=933b5bde&shcp=2c1af732&shp=1f0b6a75&t=555f072d",
            "https://p16-oec-va.ibyteimg.com/tos-maliva-i-o3syd03w52-us/fcc6b45f1ea240f7b52a8c5ec9e902c5~tplv-o3syd03w52-origin-jpeg.jpeg?dr=15568&from=520841845&idc=maliva&ps=933b5bde&shcp=2c1af732&shp=1f0b6a75&t=555f072d"
        ],
        "tagIds": [ID_1, ID_2]
    },
    {
        "appProductId": "PID002",
        "name": "Sản phẩm 2",
        "status": 2,
        "importPrice": 50000,
        "importPriceVatMode": 2,
        "importPriceVat": 8,
        "priceVatMode": 2,
        "vat": 8,
        "price": 200000,
        "oldPrice": 220000,
        "wholesalePrice": 80000,
        "shippingWeight": 300,
        "description": "Mô tả ngắn 2",
        "content": "Nội dung sản phẩm 2",
    }
]'
```

* Thông tin sản phẩm

| Key                | Type                               | Description                                                                                                                    |
| ------------------ | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| appProductId       | string $$^{{\color{red}\*}}$$      | ID sản phẩm trên hệ thống riêng của bạn                                                                                        |
| name               | string(255) $$^{{\color{red}\*}}$$ | Tên sản phẩm                                                                                                                   |
| code               | string(255)                        | Mã sản phẩm                                                                                                                    |
| barcode            | string(255)                        | Mã vạch của sản phẩm                                                                                                           |
| shippingWeight     | double                             | Cân nặng cả vỏ hộp tính bằng gram, được sử dụng để tính phí vận chuyển khi đặt hàng.                                           |
| vat                | int                                | % thuế giá trị gia tăng (VD: 5, 8, 10,..)                                                                                      |
| priceVatMode       | int                                | 2: Giá chưa bao gồm VAT (mặc định), 1: Giá đã bao gồm VAT (Xem bảng mô tả [priceVatMode](/v3/modelconstant.md#price-vat-mode)) |
| price              | double                             | Giá bán của sản phẩm                                                                                                           |
| oldPrice           | double                             | Giá cũ sản phẩm                                                                                                                |
| importPrice        | double                             | Giá nhập của sản phẩm                                                                                                          |
| importPriceVatMode | int                                | 2: Giá chưa bao gồm VAT (mặc định), 1: Giá đã bao gồm VAT (Xem bảng mô tả [priceVatMode](/v3/modelconstant.md#price-vat-mode)) |
| importPriceVat     | double                             | % thuế giá trị gia tăng (VD: 5, 8, 10,..)                                                                                      |
| wholesalePrice     | double                             | Giá bán sỉ của sản phẩm                                                                                                        |
| status             | int                                | Xem bảng mô tả [trạng thái sản phẩm](/v3/modelconstant.md#product-status)                                                      |
| categoryId         | int                                | ID danh mục sản phẩm                                                                                                           |
| unit               | string                             | Đơn vị tính                                                                                                                    |
| description        | text                               | Mô tả sản phẩm                                                                                                                 |
| content            | text                               | Nội dung chi tiết sản phẩm                                                                                                     |
| externalImages     | array                              | Đường dẫn ảnh không thuộc Nhanh.vn                                                                                             |
| tagIds             | array                              | [List ID nhãn sản phẩm](/v3/product/tags.md) (Lưu ý: tối đa chỉ được gắn 30 nhãn cho toàn bộ request)                          |

## 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,
  "data": [
    {
      "id": "(int) ID sản phẩm trên Nhanh.vn",
      "appProductId": "(string) ID sản phẩm trên app của bạn",
      "barcode": "(string) Mã vạch"
    }
  ]
}
```


---

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