Get Category
About
The category query retrieves detailed information about a single category by its ID. Use this query to:
- Display category detail pages with complete information
- Show category images, descriptions, and SEO metadata
- Retrieve display settings and configuration options
- Build breadcrumb navigation
- Get category hierarchy information
- Access all translations for multi-language support
- Display category children and sub-categories
- Render category-specific layouts and content
This query returns comprehensive category data including logos, banners, all translations, display modes, and child category information.
Arguments
| Argument | Type | Description |
|---|---|---|
id | ID! | Category ID. Supports two formats: numeric ID (e.g., 1) or IRI format (e.g., /api/shop/categories/1). Required. |
Possible Returns
| Field | Type | Description |
|---|---|---|
id | ID! | Unique category API identifier. |
_id | Int! | Numeric category ID. |
position | Int | Display position among siblings. |
logoPath | String | File path to category logo. |
logoUrl | String | Full URL to category logo image. |
bannerPath | String | File path to category banner. |
bannerUrl | String | Full URL to category banner image. |
status | Int | Category status (0 = inactive, 1 = active). |
displayMode | String | Display mode: products_only, category_and_products, products_and_description. |
_lft | Int | Left value for nested set tree structure. |
_rgt | Int | Right value for nested set tree structure. |
additional | String | Additional metadata (JSON format). |
translation | CategoryTranslation! | Default locale translation. |
translation.id | ID! | Translation identifier. |
translation._id | Int! | Numeric translation ID. |
translation.categoryId | Int! | Associated category ID. |
translation.name | String! | Category name in current language. |
translation.slug | String! | URL slug for the category. |
translation.urlPath | String! | Full URL path including hierarchy. |
translation.description | String | Category description text. |
translation.metaTitle | String | SEO meta title tag. |
translation.metaDescription | String | SEO meta description. |
translation.metaKeywords | String | SEO keywords. |
translation.localeId | Int | Locale identifier. |
translation.locale | String! | Language locale code (e.g., 'en', 'ar', 'fr'). |
translations | CategoryTranslationCollection! | All available translations. |
translations.edges | [Edge!]! | Translation edges with cursors. |
translations.edges.node | CategoryTranslation! | Individual translation. |
translations.edges.cursor | String! | Pagination cursor for this translation. |
translations.pageInfo | PageInfo! | Pagination info for translations. |
translations.pageInfo.hasNextPage | Boolean! | More translations available. |
translations.pageInfo.hasPreviousPage | Boolean! | Previous translations available. |
translations.pageInfo.startCursor | String | First translation cursor. |
translations.pageInfo.endCursor | String | Last translation cursor. |
translations.totalCount | Int! | Total translations for this category. |
createdAt | DateTime! | Category creation timestamp. |
updatedAt | DateTime! | Last update timestamp. |
url | String | Full category URL. |
children | CategoryCollection! | Child categories. |
children.edges | [Edge!]! | Child category edges. |
children.edges.node | Category! | Individual child category. |
children.pageInfo | PageInfo! | Pagination info for children. |
children.totalCount | Int! | Total child categories. |
Display Modes
| Mode | Description |
|---|---|
products_only | Show only products, no category description. |
category_and_products | Show category and products together. |
products_and_description | Show products with category description. |
Use Cases
1. Category Detail Page
Use the "Complete Details" example to display a full category page with all information.
2. SEO Optimization
Use the "With SEO Data" example to get all metadata for search engines.
3. Category Display Settings
Use the "Display Settings" example to configure how the category should be rendered.
4. Category Hierarchy
Use the "With All Children" example to show subcategories.
Best Practices
- Cache Category Data - Categories change infrequently, cache the response
- Include All Translations - Fetch all translations for multi-language support
- Use Correct ID Format - Use
/api/shop/categories/{id}format when available - Optimize Field Selection - Request only fields your UI needs
- Include SEO Data - Always fetch meta tags for optimization
- Check Status - Verify category is active before displaying
Related Resources
- Categories - Get all categories with pagination
- Tree Categories - Get hierarchical category tree
- Get Products - Query products within a category
- Pagination Guide - Cursor pagination documentation
- Shop API Overview - Overview of Shop API resources

