> ## Documentation Index
> Fetch the complete documentation index at: https://help.lobyco.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Upsert full hierarchy tree

> Imports full hierarchies (upserts existing and adds new hierarchies with all their nodes). Usually performed via direct integration with Data Import service



## OpenAPI

````yaml openapi/product-catalog-v1.json POST /v1/Hierarchies/import
openapi: 3.0.4
info:
  title: ProductCatalog.Api 1.0
  version: '1.0'
servers:
  - url: https://{host}/product-catalog
    description: Your Lobyco environment
    variables:
      host:
        default: your-environment.lobyco.net
        description: >-
          The API host for your Lobyco environment. Replace it with the host you
          were given — this placeholder does not resolve.
security: []
paths:
  /v1/Hierarchies/import:
    post:
      tags:
        - Hierarchies
      summary: Upsert full hierarchy tree
      description: >-
        Imports full hierarchies (upserts existing and adds new hierarchies with
        all their nodes). Usually performed via direct integration with Data
        Import service
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/ProductCatalog.Contracts.Common.Hierarchy'
            examples:
              Single hierarchy:
                value:
                  - name: Root
                    id: '1001'
                    parentId: null
                    imageLink: null
              Multiple hierarchies:
                value:
                  - name: Root
                    id: '1001'
                    parentId: null
                    imageLink: null
                  - name: Food
                    id: '1002'
                    parentId: '1001'
                    imageLink: null
                  - name: Bakery
                    id: '1003'
                    parentId: '1002'
                    imageLink: https://example.com/images/Bakery.png
                  - name: Groceries
                    id: '2001'
                    parentId: '1002'
                    imageLink: https://example.com/images/groceries.png
                  - name: Beverages
                    id: '2002'
                    parentId: '2001'
                    imageLink: https://example.com/images/beverages.png
                  - name: Snacks
                    id: '2003'
                    parentId: '2001'
                    imageLink: https://example.com/images/snacks.png
                  - name: Soft Drinks
                    id: '2004'
                    parentId: '2002'
                    imageLink: https://example.com/images/softdrinks.png
                  - name: Chips
                    id: '2005'
                    parentId: '2003'
                    imageLink: https://example.com/images/chips.png
                  - name: Chocolate
                    id: '2006'
                    parentId: '2003'
                    imageLink: https://example.com/images/chocolate.png
          text/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/ProductCatalog.Contracts.Common.Hierarchy'
            examples:
              Single hierarchy:
                value:
                  - name: Root
                    id: '1001'
                    parentId: null
                    imageLink: null
              Multiple hierarchies:
                value:
                  - name: Root
                    id: '1001'
                    parentId: null
                    imageLink: null
                  - name: Food
                    id: '1002'
                    parentId: '1001'
                    imageLink: null
                  - name: Bakery
                    id: '1003'
                    parentId: '1002'
                    imageLink: https://example.com/images/Bakery.png
                  - name: Groceries
                    id: '2001'
                    parentId: '1002'
                    imageLink: https://example.com/images/groceries.png
                  - name: Beverages
                    id: '2002'
                    parentId: '2001'
                    imageLink: https://example.com/images/beverages.png
                  - name: Snacks
                    id: '2003'
                    parentId: '2001'
                    imageLink: https://example.com/images/snacks.png
                  - name: Soft Drinks
                    id: '2004'
                    parentId: '2002'
                    imageLink: https://example.com/images/softdrinks.png
                  - name: Chips
                    id: '2005'
                    parentId: '2003'
                    imageLink: https://example.com/images/chips.png
                  - name: Chocolate
                    id: '2006'
                    parentId: '2003'
                    imageLink: https://example.com/images/chocolate.png
          application/*+json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/ProductCatalog.Contracts.Common.Hierarchy'
            examples:
              Single hierarchy:
                value:
                  - name: Root
                    id: '1001'
                    parentId: null
                    imageLink: null
              Multiple hierarchies:
                value:
                  - name: Root
                    id: '1001'
                    parentId: null
                    imageLink: null
                  - name: Food
                    id: '1002'
                    parentId: '1001'
                    imageLink: null
                  - name: Bakery
                    id: '1003'
                    parentId: '1002'
                    imageLink: https://example.com/images/Bakery.png
                  - name: Groceries
                    id: '2001'
                    parentId: '1002'
                    imageLink: https://example.com/images/groceries.png
                  - name: Beverages
                    id: '2002'
                    parentId: '2001'
                    imageLink: https://example.com/images/beverages.png
                  - name: Snacks
                    id: '2003'
                    parentId: '2001'
                    imageLink: https://example.com/images/snacks.png
                  - name: Soft Drinks
                    id: '2004'
                    parentId: '2002'
                    imageLink: https://example.com/images/softdrinks.png
                  - name: Chips
                    id: '2005'
                    parentId: '2003'
                    imageLink: https://example.com/images/chips.png
                  - name: Chocolate
                    id: '2006'
                    parentId: '2003'
                    imageLink: https://example.com/images/chocolate.png
        required: true
      responses:
        '200':
          description: OK
          content:
            text/plain:
              schema:
                $ref: >-
                  #/components/schemas/ProductCatalog.Contracts.Results.EmptyResult
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/ProductCatalog.Contracts.Results.EmptyResult
            text/json:
              schema:
                $ref: >-
                  #/components/schemas/ProductCatalog.Contracts.Results.EmptyResult
        '400':
          description: Bad Request
          content:
            text/plain:
              schema:
                $ref: >-
                  #/components/schemas/ProductCatalog.Contracts.Results.DataImportErrorResult
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/ProductCatalog.Contracts.Results.DataImportErrorResult
            text/json:
              schema:
                $ref: >-
                  #/components/schemas/ProductCatalog.Contracts.Results.DataImportErrorResult
components:
  schemas:
    ProductCatalog.Contracts.Common.Hierarchy:
      type: object
      properties:
        name:
          type: string
          description: Name of the hierarchy node
        id:
          type: string
          description: Id of the hierarchy node
        parentId:
          type: string
          description: Id of the parent hierarchy node
          nullable: true
        imageLink:
          type: string
          description: Image link of the hierarchy node
          nullable: true
      additionalProperties: false
    ProductCatalog.Contracts.Results.EmptyResult:
      type: object
      additionalProperties: false
    ProductCatalog.Contracts.Results.DataImportErrorResult:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: >-
              #/components/schemas/LoopFoundation.Commons.Contracts.WebServiceError
      additionalProperties: false
      description: Class for integration with Data import service.
    LoopFoundation.Commons.Contracts.WebServiceError:
      required:
        - message
        - name
      type: object
      properties:
        name:
          minLength: 1
          type: string
        message:
          minLength: 1
          type: string
        details:
          nullable: true
      additionalProperties: false

````