> For the complete documentation index, see [llms.txt](https://apidocs.nhanh.vn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.nhanh.vn/v3/product/edit.md).

# Sửa sản phẩm

* API này dùng để sửa sản phẩm.
* Chú ý: Khác với API thêm sản phẩm truyền lên 1 mảng, API sửa sản phẩm là sửa từng sản phẩm, không phải 1 mảng sản phẩm.

## 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/edit?appId={{appId}}&businessId={{businessId}}' \
--header 'Authorization: {{accessToken}}' \
--header 'Content-Type: application/json' \
--data '{
      "id": "12401",
      "name": "Sản phẩm 3 mới tạo từ API V3 ngày 21/04/2025",
      "price": 100000,
      "importPrice": 50000,
      "oldPrice": 12500,
      "wholesalePrice": 9000,
      "shippingWeight": 300,
      "tagIds": [ID_1, ID_2]
}'
```

* Thông tin sản phẩm:

| Key                | Type                       | Description                                                                                                                    |
| ------------------ | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| id                 | int $$^{{\color{red}\*}}$$ | ID sản phẩm trên Nhanh.vn                                                                                                      |
| name               | string(255)                | 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                                                                                                     |
| tagIds             | array                      | [List ID nhãn sản phẩm](/v3/product/tags.md) (Lưu ý: 1 sản phẩm được gắn tối đa 30 nhãn)                                       |

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