> ## 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 products

> Imports products (upserts existing products and adds new products). Usually performed via direct integration with Data Import service.



## OpenAPI

````yaml openapi/product-catalog-v1.json POST /v1/Products/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/Products/import:
    post:
      tags:
        - Products
      summary: Upsert products
      description: >-
        Imports products (upserts existing products and adds new products).
        Usually performed via direct integration with Data Import service.
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: >-
                  #/components/schemas/ProductCatalog.Contracts.Requests.ImportProductRequest
            examples:
              Single Product:
                value:
                  - name: White Sandwich Bread 500 g
                    externalId: EXT-1001
                    hierarchyId: '1001'
                    imageLink: https://example.com/images/bread_white_500.jpg
                    eans:
                      - '4820001000006'
                    brand:
                      id: Daily Loaf
                      name: BR-001
                    suppliers:
                      - id: Fresh Market
                        name: SUP-001
                      - id: Local Bakery Co.
                        name: SUP-002
                    saleUnit: piece
                    weightUnit: kg
                    unitOfMeasure: piece
                    unitsPerPiece: 1
                    isWeightable: false
                    restrictions: []
                    metadata: null
              Multiple Products:
                value:
                  - name: Lay's Classic Potato Chips 250g
                    externalId: EXT-1002
                    hierarchyId: '2002'
                    imageLink: https://example.com/images/lays-classic-150g.jpg
                    eans:
                      - '8714100771234'
                    brand:
                      id: Lay's
                      name: BR-LAYS
                    suppliers:
                      - id: Snack Distributors
                        name: SUP-301
                      - id: Metro Cash & Carry
                        name: SUP-201
                    saleUnit: pack
                    weightUnit: '2'
                    unitOfMeasure: kg
                    unitsPerPiece: 0.125
                    isWeightable: false
                    restrictions: []
                    metadata: null
                  - name: Heineken Beer 0.5L Can
                    externalId: EXT-1003
                    hierarchyId: '2003'
                    imageLink: https://example.com/images/heineken-0-5l.jpg
                    eans:
                      - '8712000054321'
                    brand:
                      id: Heineken
                      name: BR-HEIN
                    suppliers:
                      - id: Beer Wholesale
                        name: SUP-401
                      - id: Retail Partners
                        name: SUP-202
                    saleUnit: bottle
                    weightUnit: '1'
                    unitOfMeasure: units
                    unitsPerPiece: 1
                    isWeightable: false
                    restrictions:
                      - Age18
                      - AlcoholOnElections
                    metadata: null
                  - name: Whole Grain Bread 500 g
                    externalId: EXT-1004
                    hierarchyId: '1001'
                    imageLink: https://example.com/images/bread_wholegrain_500.jpg
                    eans:
                      - '4820001000015'
                    brand:
                      id: GrainHouse
                      name: BR-102
                    suppliers:
                      - id: Fresh Market
                        name: SUP-201
                      - id: Metro Supply
                        name: SUP-203
                    saleUnit: piece
                    weightUnit: kg
                    unitOfMeasure: piece
                    unitsPerPiece: 1
                    isWeightable: false
                    restrictions: []
                    metadata: null
                  - name: Rye Bread 700 g
                    externalId: EXT-1005
                    hierarchyId: '1003'
                    imageLink: https://example.com/images/bread_rye_700.jpg
                    eans:
                      - '4820001000020'
                    brand:
                      id: BlackCrust
                      name: BR-103
                    suppliers:
                      - id: Local Bakery Co.
                        name: SUP-202
                      - id: Wholesale Foods
                        name: SUP-204
                    saleUnit: piece
                    weightUnit: kg
                    unitOfMeasure: piece
                    unitsPerPiece: 1
                    isWeightable: false
                    restrictions: []
                    metadata: null
          text/json:
            schema:
              type: array
              items:
                $ref: >-
                  #/components/schemas/ProductCatalog.Contracts.Requests.ImportProductRequest
            examples:
              Single Product:
                value:
                  - name: White Sandwich Bread 500 g
                    externalId: EXT-1001
                    hierarchyId: '1001'
                    imageLink: https://example.com/images/bread_white_500.jpg
                    eans:
                      - '4820001000006'
                    brand:
                      id: Daily Loaf
                      name: BR-001
                    suppliers:
                      - id: Fresh Market
                        name: SUP-001
                      - id: Local Bakery Co.
                        name: SUP-002
                    saleUnit: piece
                    weightUnit: kg
                    unitOfMeasure: piece
                    unitsPerPiece: 1
                    isWeightable: false
                    restrictions: []
                    metadata: null
              Multiple Products:
                value:
                  - name: Lay's Classic Potato Chips 250g
                    externalId: EXT-1002
                    hierarchyId: '2002'
                    imageLink: https://example.com/images/lays-classic-150g.jpg
                    eans:
                      - '8714100771234'
                    brand:
                      id: Lay's
                      name: BR-LAYS
                    suppliers:
                      - id: Snack Distributors
                        name: SUP-301
                      - id: Metro Cash & Carry
                        name: SUP-201
                    saleUnit: pack
                    weightUnit: '2'
                    unitOfMeasure: kg
                    unitsPerPiece: 0.125
                    isWeightable: false
                    restrictions: []
                    metadata: null
                  - name: Heineken Beer 0.5L Can
                    externalId: EXT-1003
                    hierarchyId: '2003'
                    imageLink: https://example.com/images/heineken-0-5l.jpg
                    eans:
                      - '8712000054321'
                    brand:
                      id: Heineken
                      name: BR-HEIN
                    suppliers:
                      - id: Beer Wholesale
                        name: SUP-401
                      - id: Retail Partners
                        name: SUP-202
                    saleUnit: bottle
                    weightUnit: '1'
                    unitOfMeasure: units
                    unitsPerPiece: 1
                    isWeightable: false
                    restrictions:
                      - Age18
                      - AlcoholOnElections
                    metadata: null
                  - name: Whole Grain Bread 500 g
                    externalId: EXT-1004
                    hierarchyId: '1001'
                    imageLink: https://example.com/images/bread_wholegrain_500.jpg
                    eans:
                      - '4820001000015'
                    brand:
                      id: GrainHouse
                      name: BR-102
                    suppliers:
                      - id: Fresh Market
                        name: SUP-201
                      - id: Metro Supply
                        name: SUP-203
                    saleUnit: piece
                    weightUnit: kg
                    unitOfMeasure: piece
                    unitsPerPiece: 1
                    isWeightable: false
                    restrictions: []
                    metadata: null
                  - name: Rye Bread 700 g
                    externalId: EXT-1005
                    hierarchyId: '1003'
                    imageLink: https://example.com/images/bread_rye_700.jpg
                    eans:
                      - '4820001000020'
                    brand:
                      id: BlackCrust
                      name: BR-103
                    suppliers:
                      - id: Local Bakery Co.
                        name: SUP-202
                      - id: Wholesale Foods
                        name: SUP-204
                    saleUnit: piece
                    weightUnit: kg
                    unitOfMeasure: piece
                    unitsPerPiece: 1
                    isWeightable: false
                    restrictions: []
                    metadata: null
          application/*+json:
            schema:
              type: array
              items:
                $ref: >-
                  #/components/schemas/ProductCatalog.Contracts.Requests.ImportProductRequest
            examples:
              Single Product:
                value:
                  - name: White Sandwich Bread 500 g
                    externalId: EXT-1001
                    hierarchyId: '1001'
                    imageLink: https://example.com/images/bread_white_500.jpg
                    eans:
                      - '4820001000006'
                    brand:
                      id: Daily Loaf
                      name: BR-001
                    suppliers:
                      - id: Fresh Market
                        name: SUP-001
                      - id: Local Bakery Co.
                        name: SUP-002
                    saleUnit: piece
                    weightUnit: kg
                    unitOfMeasure: piece
                    unitsPerPiece: 1
                    isWeightable: false
                    restrictions: []
                    metadata: null
              Multiple Products:
                value:
                  - name: Lay's Classic Potato Chips 250g
                    externalId: EXT-1002
                    hierarchyId: '2002'
                    imageLink: https://example.com/images/lays-classic-150g.jpg
                    eans:
                      - '8714100771234'
                    brand:
                      id: Lay's
                      name: BR-LAYS
                    suppliers:
                      - id: Snack Distributors
                        name: SUP-301
                      - id: Metro Cash & Carry
                        name: SUP-201
                    saleUnit: pack
                    weightUnit: '2'
                    unitOfMeasure: kg
                    unitsPerPiece: 0.125
                    isWeightable: false
                    restrictions: []
                    metadata: null
                  - name: Heineken Beer 0.5L Can
                    externalId: EXT-1003
                    hierarchyId: '2003'
                    imageLink: https://example.com/images/heineken-0-5l.jpg
                    eans:
                      - '8712000054321'
                    brand:
                      id: Heineken
                      name: BR-HEIN
                    suppliers:
                      - id: Beer Wholesale
                        name: SUP-401
                      - id: Retail Partners
                        name: SUP-202
                    saleUnit: bottle
                    weightUnit: '1'
                    unitOfMeasure: units
                    unitsPerPiece: 1
                    isWeightable: false
                    restrictions:
                      - Age18
                      - AlcoholOnElections
                    metadata: null
                  - name: Whole Grain Bread 500 g
                    externalId: EXT-1004
                    hierarchyId: '1001'
                    imageLink: https://example.com/images/bread_wholegrain_500.jpg
                    eans:
                      - '4820001000015'
                    brand:
                      id: GrainHouse
                      name: BR-102
                    suppliers:
                      - id: Fresh Market
                        name: SUP-201
                      - id: Metro Supply
                        name: SUP-203
                    saleUnit: piece
                    weightUnit: kg
                    unitOfMeasure: piece
                    unitsPerPiece: 1
                    isWeightable: false
                    restrictions: []
                    metadata: null
                  - name: Rye Bread 700 g
                    externalId: EXT-1005
                    hierarchyId: '1003'
                    imageLink: https://example.com/images/bread_rye_700.jpg
                    eans:
                      - '4820001000020'
                    brand:
                      id: BlackCrust
                      name: BR-103
                    suppliers:
                      - id: Local Bakery Co.
                        name: SUP-202
                      - id: Wholesale Foods
                        name: SUP-204
                    saleUnit: piece
                    weightUnit: kg
                    unitOfMeasure: piece
                    unitsPerPiece: 1
                    isWeightable: false
                    restrictions: []
                    metadata: null
        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.Requests.ImportProductRequest:
      type: object
      properties:
        name:
          type: string
          description: Name of the product.
        externalId:
          type: string
          description: Identifier of the product in external system.
        hierarchyId:
          type: string
          description: Identifier of the hierarchy node the product belongs to.
        imageLink:
          type: string
          description: URL of the image associated with the entity.
          nullable: true
        eans:
          type: array
          items:
            type: string
          description: List of EANs associated with the product.
        brand:
          $ref: '#/components/schemas/ProductCatalog.Contracts.Common.ProductBrand'
        suppliers:
          type: array
          items:
            $ref: '#/components/schemas/ProductCatalog.Contracts.Common.Supplier'
          description: List of suppliers associated with the product.
          nullable: true
        saleUnit:
          type: string
          description: The unit in which the product is sold (e.g., piece, pack, box).
          nullable: true
        weightUnit:
          type: string
          description: The unit of weight measurement for the product (e.g., kg, g, lb).
          nullable: true
        unitOfMeasure:
          type: string
          description: >-
            The measurement unit used to quantify the product (e.g., liter,
            meter, piece).
          nullable: true
        unitsPerPiece:
          type: number
          description: The number of units contained in a single piece of the product.
          format: double
          nullable: true
        isWeightable:
          type: boolean
          description: Indicates if the product is sold by weight.
          nullable: true
        restrictions:
          type: array
          items:
            $ref: >-
              #/components/schemas/ProductCatalog.Contracts.Common.ProductRestrictionType
          description: >-
            List of restrictions (e.g., Age16, Age18, etc.) associated with the
            product.
          nullable: true
        metadata:
          type: object
          additionalProperties: {}
          description: Additional metadata associated with the product.
          nullable: true
      additionalProperties: false
      description: Represents a product with associated details.
    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.
    ProductCatalog.Contracts.Common.ProductBrand:
      type: object
      properties:
        id:
          type: string
          description: Identifier of the brand
        name:
          type: string
          description: Name of the brand
      additionalProperties: false
      description: Represents product's brand.
    ProductCatalog.Contracts.Common.Supplier:
      type: object
      properties:
        id:
          type: string
          description: Identifier of the supplier
        name:
          type: string
          description: Name of the supplier
      additionalProperties: false
      description: Represents product's supplier.
    ProductCatalog.Contracts.Common.ProductRestrictionType:
      enum:
        - Age16
        - Age18
        - Age20
        - AlcoholOnElections
      type: string
      description: The restriction type applied to a product.
    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

````