> ## Documentation Index
> Fetch the complete documentation index at: https://docs.metabind.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Tags

> Query tags for organizing content

## List Tags

Fetch a paginated list of tags with optional search.

```graphql theme={null}
query GetTags($search: String, $cursor: String, $limit: Int) {
  tags(search: $search, cursor: $cursor, limit: $limit) {
    data {
      id
      name
      slug
      description
    }
    pagination {
      cursor
      hasMore
      limit
    }
  }
}
```

### Parameters

| Parameter | Type   | Default | Description           |
| --------- | ------ | ------- | --------------------- |
| `search`  | String | -       | Filter by name        |
| `cursor`  | String | null    | Cursor for pagination |
| `limit`   | Int    | 20      | Items per page        |

### Example

```graphql theme={null}
query {
  tags(search: "tutorial", limit: 20) {
    data {
      id
      name
      slug
      description
    }
    pagination {
      cursor
      hasMore
    }
  }
}
```

Response:

```json theme={null}
{
  "data": {
    "tags": {
      "data": [
        {
          "id": "tag123",
          "name": "Tutorial",
          "slug": "tutorial",
          "description": "Educational content and guides"
        },
        {
          "id": "tag124",
          "name": "Advanced Tutorial",
          "slug": "advanced-tutorial",
          "description": "In-depth technical tutorials"
        }
      ],
      "pagination": {
        "cursor": null,
        "hasMore": false
      }
    }
  }
}
```

## Get Single Tag

Fetch a specific tag by ID.

```graphql theme={null}
query GetTag($id: ID!) {
  tag(id: $id) {
    id
    name
    slug
    description
  }
}
```

### Parameters

| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `id`      | ID!  | Yes      | Tag ID      |

### Example

```graphql theme={null}
query {
  tag(id: "tag123") {
    id
    name
    slug
    description
  }
}
```

Response:

```json theme={null}
{
  "data": {
    "tag": {
      "id": "tag123",
      "name": "Tutorial",
      "slug": "tutorial",
      "description": "Educational content and guides"
    }
  }
}
```

## Tag Fields

| Field         | Type    | Description         |
| ------------- | ------- | ------------------- |
| `id`          | ID!     | Unique identifier   |
| `name`        | String! | Tag display name    |
| `slug`        | String! | URL-safe identifier |
| `description` | String  | Tag description     |

## Using Tags in Queries

Tags can be used to filter content and assets:

```graphql theme={null}
# Filter content by tags
query {
  contents(tags: ["tutorial", "beginner"]) {
    data {
      id
      name
      tags
    }
  }
}

# Filter assets by tags
query {
  assets(tags: ["hero"]) {
    data {
      id
      name
      url
      tags
    }
  }
}
```

<Note>
  When filtering by multiple tags, the query uses AND logic. Only items with all specified tags are returned.
</Note>
