Fetch a paginated list of tags with optional search.
query GetTags($search: String, $page: Int, $limit: Int) {
tags(search: $search, page: $page, limit: $limit) {
data {
id
name
slug
description
}
pagination {
page
limit
total
pages
}
}
}
Parameters
| Parameter | Type | Default | Description |
|---|
search | String | - | Filter by name |
page | Int | 1 | Page number |
limit | Int | 20 | Items per page |
Example
query {
tags(search: "tutorial", page: 1, limit: 20) {
data {
id
name
slug
description
}
pagination {
total
}
}
}
Response:
{
"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": {
"total": 2
}
}
}
}
Get Single Tag
Fetch a specific tag by ID.
query GetTag($id: ID!) {
tag(id: $id) {
id
name
slug
description
}
}
Parameters
| Parameter | Type | Required | Description |
|---|
id | ID! | Yes | Tag ID |
Example
query {
tag(id: "tag123") {
id
name
slug
description
}
}
Response:
{
"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 |
Tags can be used to filter content and assets:
# 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
}
}
}
When filtering by multiple tags, the query uses AND logic. Only items with all specified tags are returned.