The following below Magento Open Source / Adobe Commerce 2.x GraphQL Query to get List of Categories
The category List query returns list of categories that match the criteria specified in filters
The categoryList query supports the following below filters. User can specify multiple filters in a query as per business need.
Category ID
Category name
Parent category ID
URL key
URL path
If you are not providing any filter input, the query returns the root category.
Syntax
categoryList (
filters: CategoryFilterInput
): CategoryTree
{
categoryList(
filters: {
ids: {in: ["20", "11"]}
parent_id: {in: ["2"]}
}
) {
children_count
children {
uid
level
name
path
url_path
url_key
children {
uid
level
name
path
url_path
url_key
}
}
}
}