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

# Bulk-pack multiple identical units under a single group

> Look up a product by EAN in the central registry and create a hierarchy:
one **group** product plus `quantity` **child** products. The group's translated
name is `"Skupina <ean-name> (<quantity>)"`. Each child has `parent_product_id`
set to the group's `product_id`. The provided EPC IDs are attached to the
**group** product (not to the children).

Fails with 404 if the EAN is not present in the registry, and 409 if any of
the provided EPC IDs already exist in this tenant.




## OpenAPI

````yaml https://app.buylo.ai/api/documentation/swagger/openapi.yaml post /api/products/bulk-pack
openapi: 3.1.1
info:
  title: Buylo - company external API
  version: 1.0.0
  description: >-
    API endpoints for managing products and EPCs in the Buylo system. Use
    company token for authentication.
servers:
  - url: https://app.buylo.ai/
security:
  - bearerAuth: []
paths:
  /api/products/bulk-pack:
    post:
      tags:
        - Products
      summary: Bulk-pack multiple identical units under a single group
      description: >
        Look up a product by EAN in the central registry and create a hierarchy:

        one **group** product plus `quantity` **child** products. The group's
        translated

        name is `"Skupina <ean-name> (<quantity>)"`. Each child has
        `parent_product_id`

        set to the group's `product_id`. The provided EPC IDs are attached to
        the

        **group** product (not to the children).


        Fails with 404 if the EAN is not present in the registry, and 409 if any
        of

        the provided EPC IDs already exist in this tenant.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkPackRequest'
      responses:
        '201':
          description: Group product and children created, EPCs attached to the group.
          content:
            application/json:
              schema:
                type: object
                properties:
                  group:
                    $ref: '#/components/schemas/ProductResponse'
                  children:
                    type: array
                    items:
                      $ref: '#/components/schemas/ProductResponse'
                  epc_hashes:
                    type: array
                    items:
                      type: string
                    description: Hashes of the EPCs attached to the group product.
                required:
                  - group
                  - children
                  - epc_hashes
        '403':
          description: Invalid token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidResponse'
        '404':
          description: EAN not found in the central registry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidResponse'
        '409':
          description: One or more provided EPC IDs already exist in this tenant.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidResponse'
        '422':
          description: Validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    BulkPackRequest:
      type: object
      properties:
        ean:
          type: string
          description: European Article Number looked up in the central EAN registry.
          example: '8594001524129'
        quantity:
          type: integer
          minimum: 1
          maximum: 10000
          description: Number of child product records to create under the group.
          example: 5
        epc_ids:
          type: array
          minItems: 1
          items:
            type: string
          description: EPC IDs to be attached to the group product.
          example:
            - E2004001020304
            - E2004001020305
        location_id:
          type: integer
          nullable: true
          description: >
            Optional location ID. When provided, every created EPC is assigned
            this

            location (`latest_location_id`). Must reference an existing row in

            `locations`. Omit or set to null to leave EPCs without a location.
          example: 1
      required:
        - ean
        - quantity
        - epc_ids
    ProductResponse:
      type: object
      properties:
        id:
          type: integer
          description: Internal product ID
          example: 123
        product_id:
          type: string
          description: Your Unique product identifier
          example: ABC123
        name:
          type: string
          nullable: true
          maxLength: 255
          description: Name of the product
          example: Brazil Santos Coffee
        category:
          type: string
          nullable: true
          maxLength: 255
          description: Product category
          example: Coffee
        description:
          type: string
          nullable: true
          description: Detailed description of the product
          example: Roasted Arabica coffee beans from Brazil
        ean:
          type: string
          nullable: true
          description: European Article Number (13 digits)
          example: '8594001524129'
        ean_registry_id:
          type: integer
          nullable: true
          description: >
            ID of the central `ean_registry` row this product was created from.

            Populated only for products created via

            `POST /api/products/create-from-ean-registry` (or endpoints that

            internally use the same flow, e.g. `/bulk-pack`). `null` for
            products

            created manually or by other flows.
          example: 42
        brand:
          type: string
          nullable: true
          description: Brand name of the product
          example: CoffeeCo
        sale_price:
          type: number
          format: float
          nullable: true
          description: Sale price of the product
          example: 199.99
        sale_price_currency:
          type: object
          nullable: true
          description: Currency information
        vat_rate:
          type: number
          format: float
          nullable: true
          description: VAT rate percentage
          example: 21
        unit:
          type: string
          nullable: true
          description: Unit of measurement
          example: kg
        product_data:
          type: object
          nullable: true
          description: Free additional product data
        epc_hashes:
          type: array
          items:
            type: string
          description: List of EPC hashes assigned to this product
          example: []
        warehouse_nodes:
          type: array
          items:
            type: object
          description: List of warehouse nodes where this product is located
          example: []
        created_at:
          type: string
          format: date-time
          nullable: true
          example: '2025-08-06T12:00:00Z'
        updated_at:
          type: string
          format: date-time
          nullable: true
          example: '2025-08-06T12:30:00Z'
    InvalidResponse:
      type: object
      properties:
        message:
          type: string
          description: Error message describing the issue
      required:
        - message
    ValidationErrorResponse:
      type: object
      properties:
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````