# Flags

# Flag Index Endpoint

## Structure

See [View Flag Endpoint](https://support.aerocommerce.com/books/api/page/view-flag-endpoint) for the structure of the flag payload inside the `data` array.

## Example Request

```
GET /api/flags?per_page=2
```

## Example Response

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

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

# View Flag Endpoint

## Structure

<table border="1" id="bkmrk-name-type-descriptio" style="border-collapse: collapse; width: 100%; height: 737.907px;"><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><td>`id`</td><td>int</td><td>The id of the flag</td></tr><tr><td>`name`</td><td>string</td><td>The **unique** name for the flag</td></tr><tr><td>`color`</td><td>hexcode</td><td>The colour of the flag (format ##RRGGBB)</td></tr><tr><td>`created_at`</td><td>timestamp</td><td>The date the flag was created</td></tr></tbody></table>

## Example Request

```
GET /api/flags/{id|name}
```

## Example Response

```json
{
    "id": 1,
    "name": "Flag",
    "color": "#7f3434",
    "created_at": "2025-06-30T08:14:27.000000Z"
}
```

# Create Flag Endpoint

## Structure

<table border="1" id="bkmrk-name-type-descriptio" style="border-collapse: collapse; width: 100%; height: 737.907px;"><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><td>`id`</td><td>int</td><td>The id for the flag</td><td>No</td></tr><tr><td>`name`</td><td>string</td><td>The name of the flag</td><td>Yes</td></tr><tr><td>`color`</td><td>hexcode</td><td>The color of the flag (format ##RRGGBB)</td><td>Yes</td></tr></tbody></table>

## Example Request

```
POST /api/flags/
```

```json
{
    "name": "API Flag",
    "color": "#000000",
}
```

## Example Response

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

# Update Flag Endpoint

## Structure

<table border="1" id="bkmrk-name-type-descriptio" style="border-collapse: collapse; width: 100%; height: 737.907px;"><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><td>`name`</td><td>string</td><td>The name of the flag</td><td>No</td></tr><tr><td>`color`</td><td>hexcode</td><td>The color of the flag (format ##RRGGBB)</td><td>No</td></tr></tbody></table>

## Example Request

```
PUT /api/flags/{id|name}
```

```json
{
    "name": "API Flag Updated",
    "color": "#A1B2C3",
}
```

## Example Response

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

# Delete Flag Endpoint

## Example Request

```
DELETE /api/flags/{id|name}
```

## Example Response

```
204 No Content
```