> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://contentful.com/developers/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://contentful.com/developers/docs/_mcp/server.

> **Info**
>
> **Note:** Currently, only a few of [our client libraries](/sdks/javascript/sdks) support Tags. Please ensure you're using the latest version of the client libraries.

Tags help you to easily search for specific content in your environment.

Tags are environment-scoped which means that they exist within and are unique to an environment.

Only tags with visibility `public` are accessible via the delivery and preview APIs.
To learn more about the different tag visibility options, see the [tags visibility documentation](/references/content-management-api/overview) in the management api reference page.

A tag includes the following properties:

* **name**: A human-readable unique identifier for the tag

* **id**: A unique identifier for referencing the tag

* **visibility**: A sys property with value `public` that makes the tag accessible via the delivery and preview API

## Tag Collection

[Get all tags](/references/content-preview-api/tags/get-all-tags)

Returns all the tags that exist in a given environment.

## Tag

[Get a tag](/references/content-preview-api/tags/get-a-tag)

Returns a single tag based on the given identifier.

## Tags on entries and assets

**Note:**

* Entries and assets payload come with a `metadata` property. This metadata property has as its value a `tags` list.
  The tags list contains links to all the tags that exist on the entry or asset.

* You can query for entries and assets by their tags. For entries, the search is across content types.

[Get an entry](/references/content-preview-api/entries/get-an-entry)

Returns an entry with a metadata property. The metadata property holds a list of tags.

The same behavior applies for assets.

## Querying content based on a set of tags

The query parameter starts with `metadata.tags.sys.id` with operator `[all]`.

To retrieve entries or assets that match a specific set of tag values, use the [Get all entries of a Space](/references/content-preview-api/entries/get-all-entries) endpoint, see example:

```
/spaces/yadj1kx9rmg0/environments/staging/entries?access_token=f0aa56e3659d58947f8e3ddd6301c9591c9b73a8b54c35435233b18b3e6752d5&metadata.tags.sys.id[all]=tagA,tagB
```

Returns a list of entries according to the specified set of tag IDs.

## Querying content based on one or more tags

The query parameter starts with `metadata.tags.sys.id` with operator `[in]`.

To retrieve entries or assets that match at least one of the specified tag values, use the [Get all entries of a Space](/references/content-preview-api/entries/get-all-entries) endpoint, see example:

```
/spaces/yadj1kx9rmg0/environments/staging/entries?access_token=f0aa56e3659d58947f8e3ddd6301c9591c9b73a8b54c35435233b18b3e6752d5&metadata.tags.sys.id[in]=tagA,tagB
```

Returns a list of entries according to one or more of the specified tag IDs.

## Querying content based on the tag presence

The query parameter starts with `metadata.tags` with operator `[exists]`.

To check the presence of a tag on entries or assets, use the [Get all entries of a Space](/references/content-preview-api/entries/get-all-entries) endpoint, see example:

```
/spaces/yadj1kx9rmg0/environments/staging/entries?access_token=f0aa56e3659d58947f8e3ddd6301c9591c9b73a8b54c35435233b18b3e6752d5&metadata.tags[exists]=true
```

Returns all entries that are assigned with tags.

This parameter value must be one of "true" or "false"; it is case sensitive, so "True" or "False" are not valid values.