# Tags

> Source: https://developers.cloud66.com/v3/endpoints/tags/

## List Tags

URL: https://developers.cloud66.com/v3/endpoints/tags/#list
Endpoint: GET /tags/:entity_type/:entity_id
OAuth scope: public

Get a list of tags for entities (servers & loadbalancers) by entity type and entity ID.

**Related models:** Tag, Pagination

### Parameters

- `entity_type` (string, required) — Type of the entity
- `entity_id` (string, required) — ID of the entity

### Response

```json
{
  "response":[
    {
      "entity_type":"loadbalancer",                    
      "entity_id":"17823",                      
      "tags": [{"value":"foo","reserved":false},{"value":"bar","reserved":false}],
      "created_at_iso":"2021-01-04T21:32:33+0000",
      "updated_at_iso":"2021-01-05T11:12:23+0000"
    }
  ],
  "count":1,
  "pagination":
    {
      "previous":null,
      "next":null,
      "current":1,
      "per_page":30,
      "count":1,
      "pages":1
    }
}
```

---

## Add Tags

URL: https://developers.cloud66.com/v3/endpoints/tags/#add
Endpoint: POST /tags/:entity_type/:entity_id
OAuth scope: public

Add tags to an entity (server or loadbalancer). Completely **replaces** tags of the object with tags provided.

**Related models:** Tag

### Parameters

- `entity_type` (string, required) — Type of the entity
- `entity_id` (string, required) — ID of the entity
- `tags` (array, required) — Array of tag values to be POSTed

### Response

```json
{
  "response":[
    {
      "entity_type":"loadbalancer",                    
      "entity_id":"17823",                      
      "tags": [{"value":"foo","reserved":false},{"value":"bar","reserved":false}],
      "created_at_iso":"2021-01-04T21:32:33+0000",
      "updated_at_iso":"2021-01-05T11:12:23+0000"
    }
  ],
  "count":1,
  "pagination":
    {
      "previous":null,
      "next":null,
      "current":1,
      "per_page":30,
      "count":1,
      "pages":1
    }
}
```

---

## Update Tags

URL: https://developers.cloud66.com/v3/endpoints/tags/#update
Endpoint: PATCH /tags/:entity_type/:entity_id
OAuth scope: public

Update tags on an entity (server or loadbalancer). **Adds** or **deletes** tags based on the `operations` parameter. Deleting non-existent tags is not an error, will simply be ignored. Performs deletions first, then additions.

**Related models:** Tag

### Parameters

- `entity_type` (string, required) — Type of the entity
- `entity_id` (string, required) — ID of the entity
- `operations` (array, required) — An array of operation objects with "op" (add or delete) and "tags" array

### Response

```json
{
  "response":[
    {
      "entity_type":"loadbalancer",                    
      "entity_id":"17823",                      
      "tags": [{"value":"foo","reserved":false},{"value":"bar","reserved":false}],
      "created_at_iso":"2021-01-04T21:32:33+0000",
      "updated_at_iso":"2021-01-05T11:12:23+0000"
    }
  ],
  "count":1,
  "pagination":
    {
      "previous":null,
      "next":null,
      "current":1,
      "per_page":30,
      "count":1,
      "pages":1
    }
}
```

---

## Delete Tags

URL: https://developers.cloud66.com/v3/endpoints/tags/#delete
Endpoint: DELETE /tags/:entity_type/:entity_id
OAuth scope: public

Delete all tags on an entity (server or loadbalancer).

**Related models:** Tag

### Parameters

- `entity_type` (string, required) — Type of the entity
- `entity_id` (string, required) — ID of the entity

### Response

```json
{
  "response":[
    {
      "entity_type":"loadbalancer",                    
      "entity_id":"17823",                      
      "tags": [],
      "created_at_iso":"2021-01-04T21:32:33+0000",
      "updated_at_iso":"2021-01-05T11:12:23+0000"
    }
  ],
  "count":1,
  "pagination":
    {
      "previous":null,
      "next":null,
      "current":1,
      "per_page":30,
      "count":1,
      "pages":1
    }
}
```
