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

# Atualizar component of a produto (kit)

> Updates quantity, loss percentage, or flags of an existing component.

Updates quantity, loss percentage, or flags of an existing component.

## Parâmetros de Rota (Path)

<ParamField path="productId" type="string" required={true}>UUID of the parent produto (kit)</ParamField>

<ParamField path="componentId" type="string" required={true}>UUID of the component record to Atualizar</ParamField>

## Parâmetros da Requisição (Body)

<ParamField body="quantity" type="number">Updated quantity of this component per kit unit</ParamField>

<ParamField body="lossPercentage" type="number">Updated loss percentage during manufacturing/assembly (0-100)</ParamField>

<ParamField body="isMainItem" type="boolean">Flag indicating this is the main/primary item of the kit</ParamField>

<ParamField body="displayInDescription" type="boolean">Whether to include this component in marketplace listing descriptions</ParamField>

<ParamField body="affectsPrice" type="boolean">Whether this component cost is factored into the final kit Preço de Venda</ParamField>

## Resposta de Sucesso

<ResponseField name="id" type="string" />

<ResponseField name="componentId" type="string" />

<ResponseField name="quantity" type="number" />

<ResponseField name="lossPercentage" type="number" />

<ResponseField name="isMainItem" type="boolean" />

<ResponseField name="displayInDescription" type="boolean" />

<ResponseField name="affectsPrice" type="boolean" />

<ResponseField name="unitCostSnapshot" type="number" />

<ResponseField name="representationPercentage" type="number" />

<ResponseField name="component" type="object" />

<ResponseExample>
  ```json Exemplo de Retorno theme={null}
  {
    "id": "exemplo_string",
    "componentId": "exemplo_string",
    "quantity": 123,
    "lossPercentage": 123,
    "isMainItem": true,
    "displayInDescription": true,
    "affectsPrice": true,
    "unitCostSnapshot": 123,
    "representationPercentage": 123,
    "component": {}
  }
  ```
</ResponseExample>


## OpenAPI

````yaml put /products/{productId}/components/{componentId}
openapi: 3.0.0
info:
  title: Hub Marketplace API
  description: API for managing marketplace listings and keys
  version: '1.0'
  contact: {}
servers: []
security: []
tags:
  - name: listings
    description: ''
paths:
  /products/{productId}/components/{componentId}:
    put:
      tags:
        - Product Components
      summary: Update a component of a product (kit)
      description: Updates quantity, loss percentage, or flags of an existing component.
      operationId: ProductComponentsController_update
      parameters:
        - name: productId
          required: true
          in: path
          description: UUID of the parent product (kit)
          schema:
            type: string
        - name: componentId
          required: true
          in: path
          description: UUID of the component record to update
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateProductComponentDto'
      responses:
        '200':
          description: Component successfully updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProductComponentResponseDto'
        '404':
          description: Component not found
components:
  schemas:
    UpdateProductComponentDto:
      type: object
      properties:
        quantity:
          type: number
          description: Updated quantity of this component per kit unit
          example: 3
          minimum: 1
        lossPercentage:
          type: number
          description: Updated loss percentage during manufacturing/assembly (0-100)
          example: 2
          minimum: 0
          maximum: 100
        isMainItem:
          type: boolean
          description: Flag indicating this is the main/primary item of the kit
        displayInDescription:
          type: boolean
          description: >-
            Whether to include this component in marketplace listing
            descriptions
        affectsPrice:
          type: boolean
          description: Whether this component cost is factored into the final kit price
    ProductComponentResponseDto:
      type: object
      properties:
        id:
          type: string
        componentId:
          type: string
        quantity:
          type: number
        lossPercentage:
          type: number
        isMainItem:
          type: boolean
        displayInDescription:
          type: boolean
        affectsPrice:
          type: boolean
        unitCostSnapshot:
          type: number
        representationPercentage:
          type: number
        component:
          $ref: '#/components/schemas/ComponentProductDetailsDto'
      required:
        - id
        - componentId
        - quantity
        - lossPercentage
        - isMainItem
        - displayInDescription
        - affectsPrice
        - unitCostSnapshot
        - representationPercentage
        - component
    ComponentProductDetailsDto:
      type: object
      properties:
        id:
          type: string
        commercialName:
          type: string
        sku:
          type: string
        price:
          type: number
        costCalculated:
          type: number
        components:
          type: array
          items:
            $ref: '#/components/schemas/ProductComponentResponseDto'
      required:
        - id
        - commercialName
        - sku
        - price
        - costCalculated
        - components

````