Get All Categories
Retrieves a list of categories. You can filter the list by name, parent category, position in the category tree, visibility, IDs, dates and metafield values.
HTTP Request
- URL:
/categories - Method:
GET - Headers:
accessToken: Required. Your API access token.
- Required scope:
READ_CATEGORYorREAD_WRITE_CATEGORY
Query Parameters
| Parameter | Type | Description |
|---|---|---|
page | Integer | Page number to return. Default is 1. |
limit | Integer | Number of categories per page. Default is 10. |
name | String | Filter categories whose name contains this text (case-insensitive). |
parentId | String | Return the direct subcategories of this category. |
parentId:in | String | Comma-separated list of parent category IDs. |
isVisible | Boolean | Filter by storefront visibility: true or false. |
hasParent | Boolean | true returns subcategories; false returns top-level categories. |
hasChildren | Boolean | true returns categories that have subcategories; false returns the rest. |
id | String | Return only the category with this ID. |
id:in | String | Comma-separated list of category IDs to return. |
date_created:min | String | Return categories created on or after this date (for example 2024-05-01). |
date_created:max | String | Return categories created on or before this date. |
date_modified:min | String | Return categories last updated on or after this date. |
date_modified:max | String | Return categories last updated on or before this date. |
metafields:<code> | String | Filter categories whose metafield <code> equals this value, for example metafields:category_pim_id=1045. |
metafields-in:<code> | String | Filter categories whose metafield <code> matches any of these comma-separated values, for example metafields-in:category_pim_id=1045,1046. |
cURL Example
curl --location '<BASE_URL>/categories?parentId=663a0cbe516313e5bc94aa87&isVisible=true&limit=50' \
--header 'accessToken: <ACCESS_TOKEN>'
Response
- 200 OK: The list of categories was returned successfully.
- 400 Bad Request: The access token is missing, invalid or lacks the required scope, or a filter value 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"
}
],
"pagination": {
"page": 1,
"total": 1,
"count": 1
}
}
Response Details
Category Data
Each item in data is a category. See Get Category for the full list of category fields.
| 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. |
parentCategory | String | ID of the parent category. |
hasParent | Boolean | Whether the category has a parent category. |
hasChildren | Boolean | Whether the category has subcategories. |
isShow | Boolean | Whether the category is visible on the storefront. |
Pagination Details
| Field | Type | Description |
|---|---|---|
page | Number | Current page number. |
total | Number | Total number of categories matching the filters. |
count | Number | Number of categories returned on this page. |
Notes
- Metafield values are matched as text. If you pass more than one metafield filter, categories matching any of them are returned. See Metafields for the available codes.
- Use ISO 8601 dates (for example
2024-05-01or2024-05-01T00:00:00Z) in date filters.