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

# Buscar the cost summary of a produto

> Returns a read-only snapshot of the product cost. For KIT products, the calculation is summed up recursively based on components. Note: This endpoint is highly cached. Changes to stock or components may take a few seconds to reflect (Eventual Consistency).

Returns a read-only snapshot of the produto cost. For KIT produtos, the calculation is summed up recursively based on components. Note: This endpoint is highly cached. Changes to stock or components may take a few seconds to reflect (Eventual Consistency).

## Parâmetros de Rota (Path)

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

## Resposta de Sucesso

<ResponseField name="hasEntries" type="boolean">Whether the produto has any estoque entries</ResponseField>

<ResponseField name="currentAverageCost" type="number">Current weighted Custo Médio based on estoque entries. Null if no entries exist.</ResponseField>

<ResponseField name="lastEntryCost" type="number">Unit cost from the most recent estoque entry. Null if no entries exist.</ResponseField>

<ResponseField name="lastEntryDate" type="string">Date of the most recent estoque entry. Null if no entries exist.</ResponseField>

<ResponseField name="costMethod" type="string">Método de Custo used in the last entry calculation (WEIGHTED\_AVERAGE or REPLACEMENT). Null if no entries.</ResponseField>

<ResponseField name="totalStock" type="number">Total stock quantity (sum of entries minus exits). Always >= 0.</ResponseField>

<ResponseField name="manualUnitCost" type="number">Manually set unit cost by the usuário. Null if not defined.</ResponseField>

<ResponseField name="effectiveUnitCost" type="number">Effective unit cost used for pricing and margin calculations. Priority: manualUnitCost ?? calculatedUnitCost. For KIT produtos, this is the sum of all component effective costs × quantities. **Note:** This value may be eventually consistent for KIT produtos (recalculation SLA: \~5s).</ResponseField>

<ResponseExample>
  ```json Exemplo de Retorno theme={null}
  {
    "hasEntries": true,
    "currentAverageCost": 45.75,
    "lastEntryCost": 42.3,
    "lastEntryDate": "2026-02-25T12:00:00.000Z",
    "costMethod": "WEIGHTED_AVERAGE",
    "totalStock": 150,
    "manualUnitCost": 50,
    "effectiveUnitCost": 50
  }
  ```
</ResponseExample>


## OpenAPI

````yaml get /products/{productId}/cost-summary
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}/cost-summary:
    get:
      tags:
        - Product Cost
      summary: Get the cost summary of a product
      description: >-
        Returns a read-only snapshot of the product cost. For KIT products, the
        calculation is summed up recursively based on components. Note: This
        endpoint is highly cached. Changes to stock or components may take a few
        seconds to reflect (Eventual Consistency).
      operationId: ProductCostController_getCostSummary
      parameters:
        - name: productId
          required: true
          in: path
          description: UUID of the product
          schema:
            type: string
      responses:
        '200':
          description: Cost summary data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProductCostSummaryDto'
        '404':
          description: Product not found
components:
  schemas:
    ProductCostSummaryDto:
      type: object
      properties:
        hasEntries:
          type: boolean
          description: Whether the product has any inventory entries
          example: true
        currentAverageCost:
          type: number
          description: >-
            Current weighted average cost based on inventory entries. Null if no
            entries exist.
          example: 45.75
          nullable: true
        lastEntryCost:
          type: number
          description: >-
            Unit cost from the most recent inventory entry. Null if no entries
            exist.
          example: 42.3
          nullable: true
        lastEntryDate:
          format: date-time
          type: string
          description: Date of the most recent inventory entry. Null if no entries exist.
          example: '2026-02-25T12:00:00.000Z'
          nullable: true
        costMethod:
          type: string
          description: >-
            Cost method used in the last entry calculation (WEIGHTED_AVERAGE or
            REPLACEMENT). Null if no entries.
          enum:
            - REPLACEMENT
            - WEIGHTED_AVERAGE
          example: WEIGHTED_AVERAGE
          nullable: true
        totalStock:
          type: number
          description: Total stock quantity (sum of entries minus exits). Always >= 0.
          example: 150
        manualUnitCost:
          type: number
          description: Manually set unit cost by the user. Null if not defined.
          example: 50
          nullable: true
        effectiveUnitCost:
          type: number
          description: >-
            Effective unit cost used for pricing and margin calculations.
            Priority: manualUnitCost ?? calculatedUnitCost. For KIT products,
            this is the sum of all component effective costs × quantities.
            **Note:** This value may be eventually consistent for KIT products
            (recalculation SLA: ~5s).
          example: 50
          nullable: true
      required:
        - hasEntries
        - totalStock
        - effectiveUnitCost

````