Product Categories API Routes
Products can be categorized into categories.
Categories are nested and their heirarchy can be managed, giving admin users flexibility in how they categorize their products.
These API routes allow admin users to manage categories and the products in them.
GET /admin/product-categories#
List Product Categories
Retrieve a list of product categories. The product categories can be filtered by fields such as id. The product categories can also be sorted or paginated.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Query parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields. This API route restricts the fields that can be selected. Learn how to override the retrievable fields in the Retrieve Custom Links documentation.offsetnumberOptionallimitnumberOptionalorderstringOptional-.qstringOptionalidstring | string[]Optionaldescriptionstring | string[]Optionalq parameter instead.handlestring | string[]Optionalparent_category_idstring | string[]Optionalinclude_ancestors_treebooleanOptionalfields query parameter parent_category to set the parent of a category in this field. You can either pass *parent_category to retreieve the fields of all parent categories, or select specific fields to make the response size smaller. For example, fields=parent_category.id,parent_category.name.include_descendants_treebooleanOptionalfields query parameter category_children to set the children of a category in this field. You can either pass *category_children to retreieve the fields of all child categories, or select specific fields to make the response size smaller. For example, fields=category_children.id,category_children.name.is_internalbooleanOptionalis_activebooleanOptionalcreated_atobjectOptionalupdated_atobjectOptionaldeleted_atobjectOptional$andobject[]Optional$orobject[]Optionalwith_deletedbooleanOptionalexternal_idstring | string[]OptionalRequest examples
Responses
200 OK
limitnumberoffsetnumbercountnumberproduct_categoriesobject[]The list of product categories.
product_categoriesobject[]estimate_countnumberOptional400, 401, 404, 409, 422, 500: an error response is returned.
POST /admin/product-categories#
Create Product Category
Create a product category.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Query parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields. This API route restricts the fields that can be selected. Learn how to override the retrievable fields in the Retrieve Custom Links documentation.include_ancestors_treebooleanOptionalfields query parameter parent_category to set the parent of a category in this field. You can either pass *parent_category to retreieve the fields of all parent categories, or select specific fields to make the response size smaller. For example, fields=parent_category.id,parent_category.name.include_descendants_treebooleanOptionalfields query parameter category_children to set the child of a category in this field. You can either pass *category_children to retreieve the fields of all child categories, or select specific fields to make the response size smaller. For example, fields=category_children.id,category_children.name.Request body (application/json)
namestringdescriptionstringOptionalhandlestringOptionalis_internalbooleanOptionalis_activebooleanOptionalparent_category_idstringOptionalranknumberOptionalmetadataobjectOptionalexternal_idstringOptionalRequest examples
Responses
200 OK
product_categoryobjectThe product category's details.
product_categoryobject400, 401, 404, 409, 422, 500: an error response is returned.
Emitted events
product-category.created: Emitted when product categories are created.
GET /admin/product-categories/{id}#
Get a Product Category
Retrieve a product category by its ID. You can expand the product category's relations or select the fields that should be returned.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringQuery parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields. This API route restricts the fields that can be selected. Learn how to override the retrievable fields in the Retrieve Custom Links documentation.include_ancestors_treebooleanOptionalfields query parameter parent_category to set the parent of a category in this field. You can either pass *parent_category to retreieve the fields of all parent categories, or select specific fields to make the response size smaller. For example, fields=parent_category.id,parent_category.name.include_descendants_treebooleanOptionalfields query parameter category_children to set the children of a category in this field. You can either pass *category_children to retreieve the fields of all child categories, or select specific fields to make the response size smaller. For example, fields=category_children.id,category_children.name.is_internalbooleanOptionalis_activebooleanOptionalqstringOptionalidstring | string[]Optionaldescriptionstring | string[]Optionalparent_category_idstring | string[]Optionalhandlestring | string[]Optionalcreated_atobjectOptionalupdated_atobjectOptionaldeleted_atobjectOptionallimitnumberOptionaloffsetnumberOptionalorderstringOptional-.with_deletedbooleanOptional$andobject[]Optional$orobject[]Optionalexternal_idstring | string[]OptionalRequest examples
Responses
200 OK
product_categoryobjectThe product category's details.
product_categoryobject400, 401, 404, 409, 422, 500: an error response is returned.
POST /admin/product-categories/{id}#
Update a Product Category
Update a product category's details.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringQuery parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields. This API route restricts the fields that can be selected. Learn how to override the retrievable fields in the Retrieve Custom Links documentation.include_ancestors_treebooleanOptionalfields query parameter parent_category to set the parent of a category in this field. You can either pass *parent_category to retreieve the fields of all parent categories, or select specific fields to make the response size smaller. For example, fields=parent_category.id,parent_category.name.include_descendants_treebooleanOptionalfields query parameter category_children to set the child of a category in this field. You can either pass *category_children to retreieve the fields of all child categories, or select specific fields to make the response size smaller. For example, fields=category_children.id,category_children.name.Request body (application/json)
namestringOptionaldescriptionstringOptionalhandlestringOptionalis_internalbooleanOptionalis_activebooleanOptionalparent_category_idstringOptionalmetadataobjectOptionalranknumberOptionalexternal_idstringOptionalRequest examples
Responses
200 OK
product_categoryobjectThe product category's details.
product_categoryobject400, 401, 404, 409, 422, 500: an error response is returned.
Emitted events
product-category.updated: Emitted when product categories are updated.
DELETE /admin/product-categories/{id}#
Delete a Product Category
Delete a product category. This doesn't delete the products in that category. A product category that has child categories can't be deleted, so you must delete its child categories first.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringRequest examples
Responses
200 OK
idstringobjectstringDefault: "product_category"
deletedboolean400, 401, 404, 409, 422, 500: an error response is returned.
Emitted events
product-category.deleted: Emitted when product categories are deleted.
POST /admin/product-categories/{id}/products#
Manage Products in Product Category
Manage products of a category to add or remove them.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringQuery parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields. This API route restricts the fields that can be selected. Learn how to override the retrievable fields in the Retrieve Custom Links documentation.include_ancestors_treebooleanOptionalfields query parameter parent_category to set the parent of a category in this field. You can either pass *parent_category to retreieve the fields of all parent categories, or select specific fields to make the response size smaller. For example, fields=parent_category.id,parent_category.name.include_descendants_treebooleanOptionalfields query parameter category_children to set the child of a category in this field. You can either pass *category_children to retreieve the fields of all child categories, or select specific fields to make the response size smaller. For example, fields=category_children.id,category_children.name.Request body (application/json)
addstring[]Optionalremovestring[]OptionalRequest examples
Responses
200 OK
product_categoryobjectThe product category's details.
product_categoryobject400, 401, 404, 409, 422, 500: an error response is returned.
Emitted events
product.updated: Emitted when products are updated.