Skip to main content

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_CATEGORY or READ_WRITE_CATEGORY

Path Parameters​

ParameterTypeDescription
idStringRequired. 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​

FieldTypeDescription
idStringUnique identifier of the category.
nameStringName of the category.
urlStringURL slug of the category page on the storefront.
descriptionStringDescription of the category.
imageStringURL of the category image.
parentCategoryStringID of the parent category. Empty for a top-level category.
pathStringIDs of the category's ancestors and the category itself, from the top level down.
hasParentBooleanWhether the category has a parent category.
hasChildrenBooleanWhether the category has subcategories.
productCountNumberNumber of products in the category.
sortOrderNumberDisplay order. Lower numbers appear first. Default is 0.
isFeaturedBooleanWhether the category is featured. Default is false.
isShowBooleanWhether the category is visible on the storefront. Default is true.
isShowNavBarBooleanWhether the category appears in the navigation bar. Default is false.
seoObjectSEO settings for the category page. See below.
metaFieldsArrayCustom field values. See Metafields.
createdAtStringDate and time the category was created (ISO 8601).
updatedAtStringDate and time the category was last updated (ISO 8601).

SEO Object​

FieldTypeDescription
pageTitleStringPage title for the category.
metaKeywordsStringMeta keywords.
metaDescriptionStringMeta description.

Notes​

  • If no category matches the ID, data is an empty object.