Skip to content
OmniRetailConnect Docs

Commerce · REST API

Categories

Read the product category tree.

View as Markdown

List categories

GET /api/v1/categories

Needs commerce.read. Equivalent MCP tool: list_categories.

Query parameters of GET /categories
Name Type Required Description
parent string Optional Category id or slug. Omit it for the top level.
depth integer Optional 1 to 3, default 2.
curl
export COMMERCE_API_TOKEN='ocm_<token>'

curl -sS "https://<your-shop-domain>/api/v1/categories?depth=3" \
  -H "Authorization: Bearer $COMMERCE_API_TOKEN"
Example response · 200
{
    "data": {
        "categories": [
            {
                "id": 12,
                "slug": "gereedschap",
                "name": "Gereedschap",
                "parent_id": null,
                "product_count": 48,
                "children": [
                    {
                        "id": 14,
                        "slug": "handgereedschap",
                        "name": "Handgereedschap",
                        "parent_id": 12,
                        "product_count": 21,
                        "children": []
                    }
                ]
            }
        ],
        "truncated": false
    }
}
Fields of data
Field Type Description
categories array Nodes with id, slug, name, parent_id, product_count and children.
product_count integer Published products in the category and its subcategories.
truncated boolean true when the tree was cut at 500 nodes.

Use a category id or slug as collection in Search products.

Errors

Errors of GET /categories
Status error.code When
401 unauthenticated Missing, malformed, unknown, revoked or expired token, or a token without the api channel.
404 not_found The parent category does not exist.
422 invalid_argument depth outside 1 to 3, or an unknown parameter.
429 too_many_requests Rate limit reached. Wait the number of seconds in Retry-After.