---
type: api
title: Get agent tags
description: Get a list of all tags used across enrolled agents.<br/><br/>[Required authorization] Route required privileges: fleet-agents-read.
url: https://www.elastic.co/docs/api/doc/kibana/operation/operation-get-fleet-agents-tags
resource: https://www.elastic.co/docs/api/doc/kibana/operation/operation-get-fleet-agents-tags
products:
  - Kibana
---

# Get agent tags

Authentication: required

- Server: `https://{kibana_url}`

## Paths

- `GET` `/api/fleet/agents/tags`
- `GET` `/s/{space_id}/api/fleet/agents/tags`

#### Path parameters

- `space_id` (string) — optional
  An identifier for the space. If `space_id` is not provided in the URL, the default space is used. Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

## Description

Get a list of all tags used across enrolled agents.

## Required privileges

- Privileges: `fleet-agents-read`

## Query string parameters

- `kuery` (string · min length: 0) — optional
  A KQL query string to filter results
- `showInactive` (boolean · default: false) — optional
  When true, include tags from inactive agents

## Responses

#### `200`

Successful response

`application/json`

- `items` (string[] · max items: 10000)
#### `400`

Bad Request

`application/json`

- `attributes` (object)
- `error` (string)
- `errorType` (string)
- `message` (string)
- `statusCode` (number)
## Code examples

#### Console

```console
GET kbn:/api/fleet/agents/tags
```

#### curl

```curl
curl -X GET "${KIBANA_URL}/api/fleet/agents/tags" \
  -H "Authorization: ApiKey ${API_KEY}"
```

## Response examples

#### Get agent tags

`application/json`

List of tags used across agents

```json
{
  "items": [
    "production",
    "linux",
    "datacenter-1"
  ]
}
```

#### Generic error response

`application/json`

Example of a generic error response

```json
{
  "error": "Bad Request",
  "message": "An error message describing what went wrong",
  "statusCode": 400
}
```

