Get Category
Retrieves the details of a single category, including its place in the category tree, SEO settings, visibility options and metafields.
HTTP Request
- URL:
/categories/{id} - Method:
GET - Headers:
accessToken: Required. Your API access token.
- Required scope:
READ_CATEGORYorREAD_WRITE_CATEGORY
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | String | Required. The ID of the category to retrieve. |
cURL Example
curl --location '<BASE_URL>/categories/66acedf2bf8641f96544253b' \
--header 'accessToken: <ACCESS_TOKEN>'
Response
- 200 OK: The category was returned successfully.
- 400 Bad Request: The access token is missing, invalid or lacks the required scope, or the category ID is not valid.
Sample JSON Response
{
"success": true,
"data": {
"id": "66acedf2bf8641f96544253b",
"name": "Cordless Drills",
"url": "cordless-drills",
"description": "Battery-powered drills and drivers.",
"image": "https://cdn.example.com/categories/cordless-drills.webp",
"parentCategory": "663a0cbe516313e5bc94aa87",
"path": "/663a0cbe516313e5bc94aa87/66acedf2bf8641f96544253b/",
"hasParent": true,
"hasChildren": false,
"productCount": 42,
"sortOrder": 0,
"isFeatured": false,
"isShow": true,
"isShowNavBar": false,
"seo": {
"pageTitle": "Cordless Drills",
"metaKeywords": "cordless, drill",
"metaDescription": "Shop cordless drills."
},
"metaFields": [],
"createdAt": "2024-08-02T14:32:18.344Z",
"updatedAt": "2024-10-09T13:05:59.036Z"
}
}
Response Details
Category Data
| Field | Type | Description |
|---|---|---|
id | String | Unique identifier of the category. |
name | String | Name of the category. |
url | String | URL slug of the category page on the storefront. |
description | String | Description of the category. |
image | String | URL of the category image. |
parentCategory | String | ID of the parent category. Empty for a top-level category. |
path | String | IDs of the category's ancestors and the category itself, from the top level down. |
hasParent | Boolean | Whether the category has a parent category. |
hasChildren | Boolean | Whether the category has subcategories. |
productCount | Number | Number of products in the category. |
sortOrder | Number | Display order. Lower numbers appear first. Default is 0. |
isFeatured | Boolean | Whether the category is featured. Default is false. |
isShow | Boolean | Whether the category is visible on the storefront. Default is true. |
isShowNavBar | Boolean | Whether the category appears in the navigation bar. Default is false. |
seo | Object | SEO settings for the category page. See below. |
metaFields | Array | Custom field values. See Metafields. |
createdAt | String | Date and time the category was created (ISO 8601). |
updatedAt | String | Date and time the category was last updated (ISO 8601). |
SEO Object
| Field | Type | Description |
|---|---|---|
pageTitle | String | Page title for the category. |
metaKeywords | String | Meta keywords. |
metaDescription | String | Meta description. |
Notes
- If no category matches the ID,
datais an empty object.