> For the complete documentation index, see [llms.txt](https://www.boxhero.io/docs/llms.txt). Every page is available as Markdown by appending `.md` to its URL; this page is [Markdown](https://www.boxhero.io/docs/zh-cn/developers/api/reference/bundles.md).

# Bundles

> Bundles — fixed groups of existing items, each with a set quantity, that can be sold or purchased together as a single line item.

Bundles have no stock of their own; inventory is tracked at the component-item level, and processing a bundle in an order adjusts each component's stock accordingly.

## Bundle 对象

A bundle with its component items. Bundles have no stock of their own; inventory is tracked at the component-item level.

- `id` (integer, minimum 0, maximum 2147483647, 必填): Bundle id.
- `name` (string, 必填): Bundle display name.
- `sku` (string, 必填): Stock Keeping Unit. Unique within the team.
- `barcode` (string, 必填): Primary barcode for the bundle. Empty string when not assigned.
- `cost` (string, 必填): Cost per bundle, as a decimal string. Independent from component item costs.
- `price` (string, 必填): Selling price per bundle, as a decimal string. Independent from component item prices.
- `photo_url` (string, nullable, 必填): URL of the bundle photo. `null` when no photo is set.
- `memo` (string, 必填): Free-text memo. Empty string when not set.
- `components` (array of BundleComponent, 必填): Component list. Bundles cannot contain other bundles.

  - `item` (ExtendedItemEntity, 必填): Reference to an item or bundle embedded in order, return, transaction, and bundle component responses.

    - `id` (integer, minimum 0, maximum 2147483647, 必填): Item or bundle id.
    - `name` (string, 必填): Display name.
    - `sku` (string, 必填): SKU. Empty string when unset.
    - `barcode` (string, 必填): Barcode. Empty string when unset.
    - `deleted` (boolean, 必填): Whether the underlying item or bundle is deleted.
  - `quantity` (number, 必填): Quantity of this item required per bundle.

示例

```json
{
  "id": 4042,
  "name": "Starter Kit",
  "sku": "BUNDLE-STARTER",
  "barcode": "8801234567890",
  "cost": "12.50",
  "price": "29.99",
  "photo_url": null,
  "memo": "",
  "count_of_components": 2,
  "components": [
    {
      "item": {
        "id": 14290445,
        "name": "Finish Setting Powder",
        "sku": "SKU-12345678",
        "barcode": "2097678335587",
        "deleted": false
      },
      "quantity": 1
    },
    {
      "item": {
        "id": 14290446,
        "name": "Hydrating Face Toner",
        "sku": "SKU-12345679",
        "barcode": "2097678335588",
        "deleted": false
      },
      "quantity": 2
    }
  ]
}
```

## 端点

- [List bundles](https://www.boxhero.io/docs/zh-cn/developers/api/reference/bundles/list-bundles) `GET /v1/bundles`
- [Create a bundle](https://www.boxhero.io/docs/zh-cn/developers/api/reference/bundles/create-bundle) `POST /v1/bundles`
- [Get a bundle](https://www.boxhero.io/docs/zh-cn/developers/api/reference/bundles/get-bundle) `GET /v1/bundles/{bundle_id}`
- [Update a bundle](https://www.boxhero.io/docs/zh-cn/developers/api/reference/bundles/update-bundle) `PUT /v1/bundles/{bundle_id}`
- [Delete a bundle](https://www.boxhero.io/docs/zh-cn/developers/api/reference/bundles/delete-bundle) `DELETE /v1/bundles/{bundle_id}`
- [Get a bundle by SKU](https://www.boxhero.io/docs/zh-cn/developers/api/reference/bundles/get-bundle-by-sku) `GET /v1/bundles/by-sku/{sku}`
- [Update a bundle by SKU](https://www.boxhero.io/docs/zh-cn/developers/api/reference/bundles/update-bundle-by-sku) `PUT /v1/bundles/by-sku/{sku}`
- [Delete a bundle by SKU](https://www.boxhero.io/docs/zh-cn/developers/api/reference/bundles/delete-bundle-by-sku) `DELETE /v1/bundles/by-sku/{sku}`
