# Upsell Groups

# Upsell Group Index Endpoint

<p class="callout warning">This endpoint is only available if `aerocargo/upsells` is installed.</p>

## Structure

See [<span class="s1">View Upsell Group Endpoint</span>](https://support.aerocommerce.com/books/api/page/view-upsell-group-endpoint) for the structure of the upsell group payload inside the `data` array.

## Example Request

```
GET /api/upsell-groups?per_page=2
```

## Example Response

```json
{
    "current_page": 1,
    "data": [
        //...
    ],
    "first_page_url": "http://aero.test/api/upsell-groups?page=1",
    "from": 1,
    "last_page": 3,
    "last_page_url": "http://aero.test/api/upsell-groups?page=3",
    "next_page_url": "http://aero.test/api/upsell-groups?page=2",
    "path": "http://aero.test/api/upsell-groups",
    "per_page": 2,
    "prev_page_url": null,
    "to": 2,
    "total": 5
}
```

<p class="callout info">See [<span class="s1">View Upsell Group Endpoint</span>](https://support.aerocommerce.com/books/api/page/view-upsell-group-endpoint) for the structure of the upsell group payload inside the `data` array.</p>

# View Upsell Group Endpoint

<p class="callout warning">This endpoint is only available if `aerocargo/upsells` is installed.</p>

## Structure

<table border="1" id="bkmrk-name-type-descriptio" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 33.3731%;"></col><col style="width: 33.3731%;"></col><col style="width: 33.3731%;"></col></colgroup><tbody><tr><td>**Name**  
</td><td>**Type**  
</td><td>**Description**  
</td></tr><tr><td>`key`</td><td>string</td><td>The key of the upsell group</td></tr><tr><td>`name`</td><td>string</td><td>The name for the upsell group</td></tr></tbody></table>

## Example Request

```
GET /api/upsell-groups/{key}
```

## Example Response

```json
{
    "key": "api-test",
    "name": "API Test"
}
```

# Create Upsell Group Endpoint

<p class="callout warning">This endpoint is only available if `aerocargo/upsells` is installed.</p>

## Structure

<table border="1" id="bkmrk-name-type-descriptio" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col></colgroup><tbody><tr><td>**Name**  
</td><td>**Type**  
</td><td>**Description**  
</td><td>**Required**  
</td></tr><tr><td>`key`</td><td>int</td><td>The key of the upsell group</td><td>Yes</td></tr><tr><td>`name`</td><td>string</td><td>The name for the upsell group</td><td>Yes</td></tr></tbody></table>

## Example Request

```
POST /api/upsell-groups/
```

```json
{
    "key": "api-test",
    "name": "API Test",
}
```

## Example Response

```json
{
    "upsellGroup": {
        "key": "api-test"
    }
}
```

# Update Upsell Group Endpoint

<p class="callout warning">This endpoint is only available if `aerocargo/upsells` is installed.</p>

## Structure

<table border="1" id="bkmrk-name-type-descriptio" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col></colgroup><tbody><tr><td>**Name**  
</td><td>**Type**  
</td><td>**Description**  
</td><td>**Required**  
</td></tr><tr><td>`key`</td><td>int</td><td>The key of the upsell group</td><td>No</td></tr><tr><td>`name`</td><td>string</td><td>The name for the upsell group</td><td>No</td></tr></tbody></table>

## Example Request

```
PUT /api/upsell-groups/{key}
```

```json
{
    "name": "API Test Updated",
}
```

## Example Response

```json
{
    "upsellGroup": {
        "key": "api-test"
    }
}
```