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

# View sales by product report

> View sales by product report as JSON



## OpenAPI

````yaml /api-reference/openapi.json post /reports/view/salesByProduct
openapi: 3.0.1
info:
  title: MerchantSpring Public API
  version: 1.0.0
servers:
  - url: https://mm-api.merchantspring.io
    description: Production
  - url: https://mm-api-staging.merchantspring.io
    description: Staging
security: []
tags:
  - name: channel
    x-group: Channel
  - name: content-change
    x-group: Content Change
  - name: custom-group
    x-group: Custom Group
  - name: order
    x-group: Order
  - name: report
    x-group: Report
  - name: tag
    x-group: Tag
  - name: profitability
    x-group: Profitability
paths:
  /reports/view/salesByProduct:
    post:
      tags:
        - report
      summary: View sales by product report
      description: View sales by product report as JSON
      operationId: viewSalesByProductReport
      requestBody:
        description: Sales by product report criteria
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ViewSalesByProductRequest'
        required: true
      responses:
        '200':
          description: Successful operation
          headers:
            Access-Control-Allow-Origin:
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ViewSalesByProductResponse'
        '400':
          description: Invalid input
          content: {}
      security:
        - api_key: []
components:
  schemas:
    ViewSalesByProductRequest:
      type: object
      required:
        - channelId
        - merchantId
        - fromDate
        - toDate
        - priorFromDate
        - priorToDate
      properties:
        channelId:
          type: string
        merchantId:
          type: string
        fromDate:
          type: integer
          description: >-
            Unix epoch time (seconds) representing the start of the reporting
            period
        toDate:
          type: integer
          description: >-
            Unix epoch time (seconds) representing the end of the reporting
            period
        priorFromDate:
          type: integer
          description: >-
            Unix epoch time (seconds) representing the start of the prior
            comparison period
        priorToDate:
          type: integer
          description: >-
            Unix epoch time (seconds) representing the end of the prior
            comparison period
        timezone:
          type: string
        pageSize:
          type: integer
        pageIndex:
          type: integer
        sortKey:
          type: string
          default: totalSales
        sortOrder:
          type: string
          enum:
            - asc
            - desc
          default: desc
        searchText:
          type: string
          default: ''
        includeNoSales:
          type: boolean
          default: false
          description: Whether products with no sales should be included
        includeNoInventory:
          type: boolean
          default: false
          description: Whether products with zero inventory should be included
        includeTax:
          type: boolean
          default: false
          description: Whether tax should be included in sales figures
    ViewSalesByProductResponse:
      type: object
      description: JSON response for the sales by product view endpoint
      properties:
        rows:
          type: array
          description: Array of product rows with current and prior period metrics
          items:
            $ref: '#/components/schemas/SalesByProductRow'
        count:
          type: integer
          description: Total number of rows matching the query
    SalesByProductRow:
      type: object
      description: A single product row containing current and prior period metrics.
      properties:
        current:
          $ref: '#/components/schemas/SalesByProductMetrics'
        prior:
          $ref: '#/components/schemas/SalesByProductMetrics'
    SalesByProductMetrics:
      type: object
      description: Product performance metrics for a single period.
      properties:
        productId:
          type: string
          description: Internal product identifier
        title:
          type: string
          description: Product title
        sku:
          type: string
          description: Seller SKU
        productSku:
          type: string
          description: Marketplace product SKU (e.g. ASIN)
        linkUrl:
          type: string
          description: Product listing URL
        imageUrl:
          type: string
          description: Product image URL
        price:
          type: number
          description: Listing price for the period
        totalSales:
          type: number
          description: Total sales revenue for the period
        unitsSold:
          type: number
          description: Units sold for the period
        avPrice:
          type: number
          description: Average selling price
        lastSold:
          type: string
          description: Timestamp of the last sale
        noQuantitySinceTime:
          type: string
          description: Timestamp since product had zero inventory
        acos:
          type: number
          description: Advertising cost of sales percentage
        tacos:
          type: number
          description: Total advertising cost of sales percentage
        directFulfillmentPOValue:
          type: number
          description: Direct fulfillment purchase order value (vendor only)
        directFulfillmentUnits:
          type: number
          description: Direct fulfillment units (vendor only)
        directFulfillmentPOValuePercent:
          type: number
          description: Direct fulfillment PO value as percentage of sales (vendor only)
        directFulfillmentUnitsPercent:
          type: number
          description: Direct fulfillment units as percentage of sold units (vendor only)
      required:
        - productId
        - totalSales
        - unitsSold
  securitySchemes:
    api_key:
      type: apiKey
      name: x-api-key
      in: header

````