> ## 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 reference book

> Imports hierarchy reference book (upserts existing levels and adds new levels). Usually performed via direct integration with Data Import service.



## OpenAPI

````yaml openapi/product-catalog-v1.json POST /v1/HierarchyReferenceBook/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/HierarchyReferenceBook/Import:
    post:
      tags:
        - HierarchyReferenceBook
      summary: Upsert reference book
      description: >-
        Imports hierarchy reference book (upserts existing levels and adds new
        levels). Usually performed via direct integration with Data Import
        service.
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: >-
                  #/components/schemas/ProductCatalog.Contracts.Common.HierarchyLevel
            examples:
              SampleHierarchy:
                value:
                  - depthId: 0
                    name: Root
                    externalDepth: -1
                  - depthId: 1
                    name: Level 1
                    externalDepth: 1
                  - depthId: 2
                    name: Level 2
                    externalDepth: 2
                  - depthId: 3
                    name: Level 3
                    externalDepth: 3
                  - depthId: 4
                    name: Level 4
                    externalDepth: 4
                  - depthId: 5
                    name: Level 5
                    externalDepth: 5
          text/json:
            schema:
              type: array
              items:
                $ref: >-
                  #/components/schemas/ProductCatalog.Contracts.Common.HierarchyLevel
            examples:
              SampleHierarchy:
                value:
                  - depthId: 0
                    name: Root
                    externalDepth: -1
                  - depthId: 1
                    name: Level 1
                    externalDepth: 1
                  - depthId: 2
                    name: Level 2
                    externalDepth: 2
                  - depthId: 3
                    name: Level 3
                    externalDepth: 3
                  - depthId: 4
                    name: Level 4
                    externalDepth: 4
                  - depthId: 5
                    name: Level 5
                    externalDepth: 5
          application/*+json:
            schema:
              type: array
              items:
                $ref: >-
                  #/components/schemas/ProductCatalog.Contracts.Common.HierarchyLevel
            examples:
              SampleHierarchy:
                value:
                  - depthId: 0
                    name: Root
                    externalDepth: -1
                  - depthId: 1
                    name: Level 1
                    externalDepth: 1
                  - depthId: 2
                    name: Level 2
                    externalDepth: 2
                  - depthId: 3
                    name: Level 3
                    externalDepth: 3
                  - depthId: 4
                    name: Level 4
                    externalDepth: 4
                  - depthId: 5
                    name: Level 5
                    externalDepth: 5
        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.HierarchyLevel:
      type: object
      properties:
        depthId:
          type: integer
          description: The depth level in the hierarchy.
          format: int32
        name:
          type: string
          description: The name of the hierarchy level.
        externalDepth:
          type: integer
          description: The depth level in the external hierarchy.
          format: int32
      additionalProperties: false
      description: Represents a level in a hierarchy.
    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

````