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

# Create or update product with EPC IDs

> Creates a new product or updates an existing product and assigns multiple EPC IDs to it. All provided EPC IDs must be new (not already assigned to any product). If a product with the given product_id already exists, it will be updated with the new data.



## OpenAPI

````yaml https://app.buylo.ai/api/documentation/swagger/openapi.yaml post /api/products/create-with-epc
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/create-with-epc:
    post:
      tags:
        - Products
      summary: Create or update product with EPC IDs
      description: >-
        Creates a new product or updates an existing product and assigns
        multiple EPC IDs to it. All provided EPC IDs must be new (not already
        assigned to any product). If a product with the given product_id already
        exists, it will be updated with the new data.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - epc_id
                - product
              properties:
                epc_id:
                  type: array
                  items:
                    type: string
                  minItems: 1
                  description: >-
                    Array of EPC identifiers to assign to the product (must all
                    be new)
                  example:
                    - aaa1234
                    - bbb1234
                    - ccc1234
                location_id:
                  type: integer
                  nullable: true
                  description: >-
                    Optional location ID to immediately assign all created EPCs
                    to (sets latest_location_id). If omitted or null, EPCs are
                    created without a location.
                  example: 1
                product:
                  $ref: '#/components/schemas/Product'
      responses:
        '200':
          description: Product created/updated and EPCs assigned successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  product_epc_hashes:
                    type: array
                    items:
                      type: string
                    description: List of unique EPC hashes for newly created EPCs
                    example:
                      - 8aaedfc3559d0ce545ca55bcea31aad2
                      - 2b1c7f8c2aab4e33a5e09a2d77f3b611
                      - a7d9c4e8b3f2a1c5e7b9d4f8a2c6e9b1
                required:
                  - product_epc_hashes
        '400':
          description: Validation error - invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidResponse'
        '403':
          description: Invalid token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidResponse'
        '409':
          description: One or more EPCs are already assigned (to any product)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    Product:
      type: object
      properties:
        product_id:
          type: string
          description: Your Unique product identifier
          example: ABC123
        name:
          type: object
          nullable: true
          description: Product name with translations
          additionalProperties:
            type: string
          example:
            en: Brazil Santos Coffee
            cs: Brazilská káva Santos
        category:
          type: string
          nullable: true
          maxLength: 255
          description: Product category
          example: Coffee
        description:
          type: object
          nullable: true
          description: Product description with translations
          additionalProperties:
            type: string
          example:
            en: Roasted Arabica coffee beans from Brazil
            cs: Pražená arabica z Brazílie
        ean:
          type: string
          maxLength: 255
          nullable: true
          description: European Article Number
          example: '8591234567890'
        brand:
          type: string
          maxLength: 255
          nullable: true
          description: Brand name of the product
          example: CoffeeCo
        prices:
          type: array
          nullable: true
          description: Array of prices in different currencies
          items:
            type: object
            required:
              - currency
              - price
            properties:
              currency:
                type: string
                description: Currency code (CZK, EUR, USD, etc.)
                example: EUR
              price:
                type: number
                format: float
                minimum: 0
                description: Price amount
                example: 199.99
          example:
            - currency: EUR
              price: 199.99
            - currency: CZK
              price: 4999
        vat_rate:
          type: number
          format: float
          minimum: 0
          nullable: true
          description: VAT rate percentage
          example: 21
        unit:
          type: string
          maxLength: 50
          nullable: true
          description: Unit of measurement
          example: kg
        product_data:
          type: object
          nullable: true
          description: Free additional product data
          additionalProperties: true
          example:
            color: red
            size: L
      required:
        - product_id
    InvalidResponse:
      type: object
      properties:
        message:
          type: string
          description: Error message describing the issue
      required:
        - message
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````