Category trees

Catalog - Category trees

The Catalog API manages products, categories, brands, bulk pricing rules, and more. To learn more about catalog resources, see the Catalog overview.

Our Catalog category trees and their categories endpoints are the more modern and performant counterparts to the categories (deprecated) endpoints. Although the category trees endpoints and objects are designed to center an MSF-compatible, multi-tenant category tree architecture, the endpoints work just as well in a single storefront context and support batch requests. Use catalog trees categories endpoints, instead of categories (deprecated) endpoints.

The category trees endpoints let you get the categories for a specific tree, and bulk create, bulk update, and bulk delete categories. You can also bulk update the properties of category trees, which includes changing the channels to which a tree is assigned.

The terms "category tree" and "catalog tree" are used interchangeably throughout the documentation.

To learn more about authenticating Catalog endpoints, locate the Authentication section at the top of each endpoint, then click Show Details.

Resources

Webhooks

Learn more about Category tree webhook events.

Additional Catalog endpoints

Get all category trees

GET /catalog/trees

Request

Returns a list of category trees.

Authentication

  • X-Auth-Token in header

Parameters

  • store_hash in path - string
  • Accept in header with default of application/json - string
    required
    The MIME type of the response body.
  • id:in in query - array
    Filter by supplying a comma-separated list of category tree IDs.
    Type: array[integer]
  • channel_id:in in query - array
    Filter by supplying a comma-separated list of channel IDs.
    Type: array[integer]

example

curl --request GET \
--url 'https://api.bigcommerce.com/stores/[store_hash]/v3/catalog/trees' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: {{token}}'

Response

List of category trees.

Body

object | application/json
  • data
    array[object]

  • meta
    object

example

{
"data": [
{
"id": 0,
"name": "string",
"channels": [
0
]
}
],
"meta": {
"pagination": {
"total": 246,
"count": 5,
"per_page": 5,
"current_page": 1,
"total_pages": 50,
"links": {
"next": "?limit=5&page=2",
"current": "?limit=5&page=1"
}
}
}
}

Upsert category trees

PUT /catalog/trees

Request

Upserts category trees.

This single endpoint updates and creates category trees. If a tree object contains an ID, it is processed as an update operation using that ID. If you do not provide an ID, a new tree is created. The category tree name field is required to create trees, but is not required on the update.

Usage Notes

  • Channel ID in the channels field is required to create a category tree. You can only assign a category tree to one channel.
  • The channels field must be absent when updating a category tree. This field is currently unsupported during a category tree update.

Authentication

  • X-Auth-Token in header

Parameters

  • store_hash in path - string
  • Accept in header with default of application/json - string
    required
    The MIME type of the response body.
  • Content-Type in header with default of application/json - string
    required
    The MIME type of the request body.

Body

array | application/json
  • id
    integer

  • name
    string

    >= 1 characters<= 255 characters
  • channels
    array[integer]

example

[
{
"id": 0,
"name": "string",
"channels": [
0
]
}
]

Response

Created a category tree.

Body

object | application/json
  • data
    array[object]

  • meta
    object

    Response metadata.

example

{
"data": [
{
"id": 0,
"name": "string",
"channels": [
0
]
}
],
"meta": {}
}

Delete category trees

DELETE /catalog/trees

Request

Deletes category trees. A filter must be supplied with the endpoint.

Authentication

  • X-Auth-Token in header

Parameters

  • store_hash in path - string
  • Accept in header with default of application/json - string
    required
    The MIME type of the response body.
  • id:in in query - array
    Filter by supplying a comma-separated list of category tree IDs.
    Type: array[integer]

example

curl --request DELETE \
--url 'https://api.bigcommerce.com/stores/[store_hash]/v3/catalog/trees' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: {{token}}'

Response

Deleted

Get a category tree

GET /catalog/trees/{tree_id}/categories

Request

Returns a category tree.

Authentication

  • X-Auth-Token in header

Parameters

  • store_hash in path - string
  • Accept in header with default of application/json - string
    required
    The MIME type of the response body.
  • tree_id in path - integer
    required
    The ID of the category tree.
  • depth in query - integer
    Max depth for a tree of categories.

example

curl --request GET \
--url 'https://api.bigcommerce.com/stores/[store_hash]/v3/catalog/trees/[tree_id]/categories' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: {{token}}'

Response

Categories tree

Body

object | application/json
  • data
    array[object]

  • meta
    object

    Response metadata.

example

{
"data": [
{
"id": 0,
"parent_id": 0,
"depth": 0,
"path": [
0
],
"name": "string",
"is_visible": true,
"children": [
"string"
]
}
],
"meta": {
"type": "object",
"properties": {},
"description": "Empty meta object; reserved for use later."
}
}

See something you can improve? Edit this file on GitHub

Did you find what you were looking for?