Skip to main content

category

Requires permission categories:category:read.

Returns one category with its parent, subcategories and product counts. Fails if the category does not exist. Requires permission to read categories.

Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.

Example:

query Category($id: String!) {
category(id: $id) {
id
code
name
createdAt
childrenCount
deletedAt
children {
id
code
name
createdAt
childrenCount
deletedAt
}
}
}

Variables:

{
"id": "string"
}

Response:

{
"data": {
"category": {
"id": "id",
"code": "string",
"name": "string",
"createdAt": "2025-01-15T00:00:00Z",
"childrenCount": 0,
"deletedAt": "2025-01-15T00:00:00Z",
"children": [
{
"id": "id",
"code": "string",
"name": "string",
"createdAt": "2025-01-15T00:00:00Z",
"childrenCount": 0,
"deletedAt": "2025-01-15T00:00:00Z"
}
]
}
}
}
category(
id: String!
): Category!

Arguments​

category.id ● String! non-null scalar​

The ID of the category.

Type​

Category object​

A node in the category tree. A root category is an ordinary category.