Create Multiple Categories
Creates several categories in a single request. This is useful when importing a catalog from another system.
HTTP Request
- URL:
/categories/multiple - Method:
POST - Headers:
accessToken: Required. Your API access token.Content-Type:application/json
- Required scope:
READ_WRITE_CATEGORY
Request Body
Send a JSON array. Each item in the array is a category with the following fields.
| Field | Type | Required | Description |
|---|---|---|---|
name | String | Yes | Name of the category. |
url | String | No | URL slug of the category page. If omitted, it is generated from name. |
description | String | No | Description of the category. Can be empty. |
parentCategory | String | No | ID of the parent category, or null for a top-level category. |
image | String | No | URL of the category image. The image is copied to your store's media library. |
sortOrder | Number | No | Display order. Lower numbers appear first. Default is 0. |
isFeatured | Boolean | No | Whether the category is featured. Default is false. |
isShowNavBar | Boolean | No | Whether the category appears in the navigation bar. Default is false. |
seo | Object | No | SEO settings with pageTitle, metaKeywords and metaDescription. |
metaFields | Array | No | Custom field values, each with a code and a value. See Metafields. |
cURL Example
curl --location '<BASE_URL>/categories/multiple' \
--header 'accessToken: <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '[
{
"name": "Cordless Drills",
"parentCategory": "663a0cbe516313e5bc94aa87"
},
{
"name": "Impact Drivers",
"url": "impact-drivers",
"parentCategory": "663a0cbe516313e5bc94aa87"
}
]'
Response
- 200 OK: The categories were created successfully.
- 400 Bad Request: The access token is missing, invalid or lacks the required scope, or the request body is not valid.
Sample JSON Response
{
"success": true,
"message": "Categories added Successfully"
}
Response Details
| Field | Type | Description |
|---|---|---|
success | Boolean | true when the categories were created. |
message | String | Confirmation message. |
Notes
- New categories are visible on the storefront.
- The response does not include the new categories. Use Get All Categories to read them.