# Tag Groups

# Tag Group Index Endpoint

## Structure

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

## Example Request

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

## Example Response

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

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

# View Tag Group Endpoint

## Structure

### Tag Group

<table border="1" id="bkmrk-name-type-descriptio" style="border-collapse: collapse; width: 100%; height: 188.18px;"><colgroup><col style="width: 33.3731%;"></col><col style="width: 33.3731%;"></col><col style="width: 33.3731%;"></col></colgroup><tbody><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**Name**  
</td><td style="height: 29.7969px;">**Type**  
</td><td style="height: 29.7969px;">**Description**  
</td></tr><tr style="height: 46.5938px;"><td style="height: 46.5938px;">`name`</td><td style="height: 46.5938px;">string</td><td style="height: 46.5938px;">The name of the tag group (e.g., Size or Colour)</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">`reference`</td><td style="height: 29.7969px;">string</td><td style="height: 29.7969px;">The reference of the tag group</td></tr><tr style="height: 46.5938px;"><td style="height: 46.5938px;">`show_in_filters`</td><td style="height: 46.5938px;">boolean</td><td style="height: 46.5938px;">Whether the tag group shows in filters on listings page</td></tr><tr style="height: 35.3984px;"><td style="height: 35.3984px;">`tags`</td><td style="height: 35.3984px;">array</td><td style="height: 35.3984px;">An array of [Tag](https://support.aerocommerce.com/books/api/page/view-tag-group-endpoint#bkmrk-tag) objects</td></tr></tbody></table>

### Tag

<table border="1" id="bkmrk-name-type-descriptio-1" 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>`name`</td><td>string</td><td>The name of the tag (e.g., Small or Red)</td></tr><tr><td>`slug`</td><td>string</td><td>The slug of the tag, if not present it is auto-generated from name</td></tr><tr><td>`reference`</td><td>string</td><td>The reference of the tag</td></tr><tr><td>`image`</td><td>object</td><td>The image of the tag, see [Image](https://support.aerocommerce.com/books/api/page/view-tag-group-endpoint#bkmrk-image)</td></tr><tr><td>`has_slug`</td><td>boolean</td><td>Whether the tag has a slug or not</td></tr></tbody></table>

### Image

<table border="1" id="bkmrk-name-type-descriptio-2" 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>`url`</td><td>string</td><td>The url of the image</td></tr></tbody></table>

## Example Request

```
GET /api/tag-groups/{id|name}
```

## Example Response

```json
{
    "id": 1,
    "name": "Size",
    "reference": null,
    "show_in_filters": true,
    "tags": [
        {
            "id": 1,
            "name": "Small",
            "reference": null,
            "slug": "small",
            "image": {
                "url": null
            },
            "has_slug": true
        }
    ]
}
```

# Create Tag Group Endpoint

## Structure

### Tag Group

<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>`id`</td><td>int</td><td>The id for the tag group</td><td>No</td></tr><tr><td>`name`</td><td>string</td><td>The name of the tag group (e.g., Size or Colour)</td><td>Yes</td></tr><tr><td>`reference`</td><td>string</td><td>The reference of the tag group</td><td>No</td></tr><tr><td>`show_in_filters`</td><td>boolean</td><td>Whether the tag group shows in filters on listings page (defaults to `true`)</td><td>No</td></tr><tr><td>`tags`</td><td>array</td><td>An array of [Tag](https://support.aerocommerce.com/books/api/page/create-tag-group-endpoint#bkmrk-tag) objects</td><td>No</td></tr></tbody></table>

### Tag

<table border="1" id="bkmrk-name-type-descriptio-1" 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>`id`</td><td>int</td><td>The id for the tag</td><td>No</td></tr><tr><td>`name`</td><td>string</td><td>The name of the tag (e.g., Small or Red)</td><td>Yes</td></tr><tr><td>`slug`</td><td>string</td><td>The slug of the tag, if not present it is auto-generated from name (unless `has_slug` is `false`)</td><td>Conditional</td></tr><tr><td>`reference`</td><td>string</td><td>The reference of the tag</td><td>No</td></tr><tr><td>`image`</td><td>object</td><td>The [Image](https://support.aerocommerce.com/books/api/page/create-tag-group-endpoint#bkmrk-image) of the tag</td><td>No</td></tr><tr><td>`has_slug`</td><td>boolean</td><td>Whether the tag has a slug or not (defaults to `false`, unless `slug` is provided)</td><td>No</td></tr></tbody></table>

### Image

<table border="1" id="bkmrk-name-type-descriptio-2" 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>`src`</td><td>string</td><td>The source url of the image</td><td>Yes</td></tr></tbody></table>

## Example Request

```
POST /api/tag-groups/
```

```json
{
    "name": "Colour",
    "show_in_filters": false,
    "tags": [
        {
            "name": "Blue",
            "slug": "blueeee",
            "reference": "blue"
        },
        {
            "name": "red",
            "has_slug": false
        }
    ]
}
```

## Example Response

```json
{
    "tagGroup": {
        "id": 1
    }
}
```

# Update Tag Group Endpoint

## Structure

<table border="1" id="bkmrk-name-type-descriptio" style="border-collapse: collapse; width: 100%; height: 59.5938px;"><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 style="height: 29.7969px;"><td style="height: 29.7969px;">**Name**  
</td><td style="height: 29.7969px;">**Type**  
</td><td style="height: 29.7969px;">**Description**  
</td><td style="height: 29.7969px;">**Required**  
</td></tr><tr style="height: 29.7969px;"><td>`name`</td><td>string</td><td>The name of the tag group (e.g., Size or Colour)</td><td>No</td></tr><tr><td>`reference`</td><td>string</td><td>The reference of the tag group</td><td>No</td></tr><tr><td>`show_in_filters`</td><td>boolean</td><td>Whether the tag group shows in filters on listings page</td><td>No</td></tr></tbody></table>

## Example Request

```
PUT /api/tag-groups/{id|name}
```

```json
{
    "name": "Updated Size",
    "show_in_filters": false
}
```

## Example Response

```json
{
    "tagGroup": {
        "id": 1
    }
}
```

# Delete Tag Group Endpoint

## Example Request

```
DELETE /api/tag-groups/{id|name}
```

## Example Response

```
204 No Content
```