> ## Documentation Index
> Fetch the complete documentation index at: https://developers.lightyshare.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Bundles

> Learn how to create and manage product bundles in the Lightyshare API

Bundles are collections of multiple products that are rented together as a package. They allow you to offer complete solutions to your customers by combining related items.

## What are Bundles?

Bundles are product packs that include multiple individual products. They're perfect for:

* **Complete kits**: Camera + lens + tripod + lighting
* **Event packages**: Multiple cameras for different angles
* **Professional setups**: Full studio equipment packages
* **Seasonal offers**: Themed equipment collections

## Creating a Bundle

### Basic Bundle Creation

```bash theme={null}
curl -X POST https://lightyshare.com/api/token-secured/bundle \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "bundle": {
      "title": "Complete LED Studio Pack",
      "description": "Professional kit for studio shooting",
      "rent": 190.0,
      "items": [
        {
          "ad_id": 123,
          "quantity": 2
        },
        {
          "ad_id": 456,
          "quantity": 1
        },
        {
          "ad_id": 789,
          "quantity": 3
        }
      ],
      "online": true
    }
  }'
```

### Bundle with Images

```bash theme={null}
curl -X POST https://lightyshare.com/api/token-secured/bundle \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "bundle": {
      "title": "Professional Video Kit",
      "description": "Complete setup for professional video production",
      "rent": 450.0,
      "items": [
        {
          "ad_id": 101,
          "quantity": 1
        },
        {
          "ad_id": 102,
          "quantity": 2
        },
        {
          "ad_id": 103,
          "quantity": 1
        },
        {
          "ad_id": 104,
          "quantity": 4
        }
      ],
      "images": [
        {
          "src": "https://cdn.example.com/bundle-studio.jpg"
        },
        {
          "src": "https://cdn.example.com/bundle-equipment.jpg"
        }
      ],
      "online": true
    }
  }'
```

## Bundle Fields

### Required Fields

| Field   | Type   | Description                    | Example                    |
| ------- | ------ | ------------------------------ | -------------------------- |
| `title` | string | Bundle title (max 255 chars)   | "Complete LED Studio Pack" |
| `items` | array  | List of products in the bundle | See example above          |

### Optional Fields

| Field         | Type    | Description           | Example                                |
| ------------- | ------- | --------------------- | -------------------------------------- |
| `description` | string  | Bundle description    | "Professional kit for studio shooting" |
| `rent`        | float   | Bundle rental price   | 190.0                                  |
| `images`      | array   | Bundle images (max 5) | See example above                      |
| `online`      | boolean | Available for rental  | true                                   |
| `archived`    | boolean | Archived bundle       | false                                  |

## Bundle Items

Each item in a bundle requires:

```json theme={null}
{
  "ad_id": 123,
  "quantity": 2
}
```

* **ad\_id**: The ID of the product to include in the bundle
* **quantity**: Number of units of this product in the bundle

### Requirements

* Minimum 1 item per bundle
* Maximum 30 items per bundle
* All referenced products must exist and belong to your account
* Products must be available (online: true)

## Pricing

### Automatic Pricing

If you don't specify a `rent` value, the bundle price will be automatically calculated based on the sum of the included products' rental prices.

### Manual Pricing

You can set a custom rental price for the bundle, which may be different from the sum of individual product prices. This is useful for:

* **Volume discounts**: Offering a lower price than the sum of individual items
* **Premium pricing**: Charging extra for the convenience of a complete package
* **Seasonal pricing**: Special rates for bundled offerings

## Response Examples

### Successful Creation

```json theme={null}
{
  "success": true,
  "id": 98765
}
```

## Error Handling

### Validation Errors

```json theme={null}
{
  "success": false,
  "errors": [
    {
      "field": "items",
      "code": "MIN_ITEMS",
      "message": "Bundle must contain at least one item"
    },
    {
      "field": "items[0].ad_id",
      "code": "NOT_FOUND",
      "message": "Product with ID 123 not found"
    }
  ]
}
```

### Common Error Codes

* `MIN_ITEMS`: Bundle must contain at least one item
* `MAX_ITEMS`: Bundle cannot contain more than 30 items
* `NOT_FOUND`: Referenced product doesn't exist
* `ACCESS_DENIED`: Product doesn't belong to your account
* `PRODUCT_OFFLINE`: Referenced product is not available

## Best Practices

### 1. Bundle Design

* **Logical grouping**: Group related products that are commonly used together
* **Complete solutions**: Offer bundles that solve specific use cases
* **Flexible options**: Provide different bundle sizes for different needs

### 2. Pricing Strategy

* **Competitive pricing**: Ensure bundle prices are attractive compared to individual items
* **Clear value**: Make the benefit of bundling obvious to customers
* **Seasonal adjustments**: Adjust pricing based on demand and seasons

### 3. Inventory Management

* **Stock availability**: Ensure all bundle items are in stock
* **Quantity planning**: Plan quantities based on expected demand
* **Restock coordination**: Coordinate restocking of bundle components

### 4. Marketing

* **Clear descriptions**: Explain what's included and the benefits
* **High-quality images**: Show the complete bundle setup
* **Use case examples**: Provide examples of when to use the bundle

## Example Bundle Scenarios

### Photography Bundle

```json theme={null}
{
  "title": "Professional Photography Kit",
  "description": "Complete setup for professional photography",
  "items": [
    {"ad_id": 1001, "quantity": 1}, // Camera body
    {"ad_id": 1002, "quantity": 2}, // Lenses
    {"ad_id": 1003, "quantity": 1}, // Tripod
    {"ad_id": 1004, "quantity": 2}, // Lighting
    {"ad_id": 1005, "quantity": 4}  // Batteries
  ]
}
```

### Event Bundle

```json theme={null}
{
  "title": "Event Coverage Package",
  "description": "Multiple cameras for comprehensive event coverage",
  "items": [
    {"ad_id": 2001, "quantity": 3}, // Main cameras
    {"ad_id": 2002, "quantity": 2}, // Backup cameras
    {"ad_id": 2003, "quantity": 6}, // Batteries
    {"ad_id": 2004, "quantity": 4}  // Memory cards
  ]
}
```
