---
title: "Get the category tree starting from the specified root node."
url: "https://developer.migros.ch/apis/categories-8/versions/c52b807c-f583-4cb5-9293-3a0befc40a44/operations/get-category-tree"
---

> Full API specification: https://developer.migros.ch/apis/categories-8/versions/c52b807c-f583-4cb5-9293-3a0befc40a44.md

# Get the category tree starting from the specified root node.

`GET` `/migros/products/v8/category-tree/{id}`

Operation ID: `get-category-tree`

Get the category tree starting from the specified root node.

## Path parameters

- `id` (string, required)

## Query parameters

- `depth` (integer, optional) - Depth of levels from the root node
- `lang` (string, optional) - Defines the language (de/fr/it/en) for this request as query parameter. Either use the query param "lang" or header "Accept-Language", not both.

## Header parameters

- `Accept-Language` (string, optional) - Defines the language (de/fr/it/en) for this request as request header. Either use the query param "lang" or header "Accept-Language", not both.

## Responses

- `200` - Returned when successful
- `404` - Returned when the requested resource could not be not found.

## OpenAPI definition

```yaml
openapi: 3.0.0
info:
  title: Categories
  version: "8"
servers:
  - description: Public Kong Gateway URL
    url: https://api.migros.ch
paths:
  /migros/products/v8/category-tree/{id}:
    get:
      description: Get the category tree starting from the specified root node.
      operationId: get-category-tree
      parameters:
        - in: path
          name: id
          required: true
          schema:
            pattern: ^[a-zA-Z0-9\-_/]+$
            type: string
        - description: Depth of levels from the root node
          in: query
          name: depth
          schema:
            default: 3
            type: integer
        - $ref: "#/components/parameters/lang"
        - $ref: "#/components/parameters/Accept-Language"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CategoryNode"
          description: Returned when successful
        "404":
          $ref: "#/components/responses/404"
      summary: Get the category tree starting from the specified root node.
      tags:
        - Categories
security:
  - Kong-Api-Key: []
    basicAuth: []
components:
  parameters:
    lang:
      description: Defines the language (de/fr/it/en) for this request as query
        parameter. Either use the query param "lang" or header
        "Accept-Language", not both.
      in: query
      name: lang
      schema:
        default: de
        enum:
          - de
          - fr
          - it
          - en
        type: string
    Accept-Language:
      description: Defines the language (de/fr/it/en) for this request as request
        header. Either use the query param "lang" or header "Accept-Language",
        not both.
      in: header
      name: Accept-Language
      schema:
        default: de
        enum:
          - de
          - fr
          - it
          - en
        type: string
  schemas:
    CategoryNode:
      description: >-
        Recursive element of the category tree.


        This is an alternate representation of categories instead of Category &
        BaseCategory to output the tree structure

        on the dedicated API end point.
      properties:
        code:
          description: ID of the category.
          type: string
        name:
          type: string
      type: object
  responses:
    "404":
      description: Returned when the requested resource could not be not found.
  securitySchemes:
    Kong-Api-Key:
      description: Kong key-auth authentication
      in: header
      name: X-Api-Key
      type: apiKey
    basicAuth:
      scheme: basic
      type: http
```
