Relationships

You can use the Categories API to associate categories with each other in a hierarchical tree structure. The relationship between Categories is known as parents and children.

You can create relationships between categories by attaching parent and child category IDs to the category of interest. A category can have 1 parent but many children.

The Category Relationship endpoint allows you to specify the parent and children of a category in one request.

Get the Categories tree

GET https://api.moltin.com/v2/categories/tree

Headers

NameTypeDescription

Authorization

string

The Bearer token to grant access to the API

{
  "data": [
    {
      "id": "59a8c4e2-bd2d-4a14-9f1a-a497330cdf11",
      "type": "category",
      "status": "live",
      "name": "Mens",
      "slug": "mens",
      "description": "Browse our mens clothing line",
      "children": [
        {
          "id": "b438be03-9ae7-4e6a-8fb6-7ee41ce0ae71",
          "type": "category",
          "status": "live",
          "name": "Mens apparel",
          "slug": "mens-apparel",
          "description": "Browse our mens apparel",
          "children": [
            {
              "id": "6272a049-dc98-428b-ad90-65572add46c0",
              "type": "category",
              "status": "live",
              "name": "Clothing",
              "slug": "clothing",
              "description": "Browse our clothing line"
                }
              ]
            }
          ]
        }
      ]
    }
curl -X GET https://api.moltin.com/v2/categories/tree \
     -H "Authorization: Bearer XXXX"

Last updated