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

# Create a sales by product report

> Create a "sales by product" report. The generated report CSV contains the columns defined in the `SalesByProductReportColumns` schema. For Amazon Vendor channels, 'totalSales' is replaced by 'poValue' and 'unitsSold' by 'unitsOrdered'. Use the /reports/status/{reportId} endpoint to check report status and obtain the download URL.



## OpenAPI

````yaml /api-reference/openapi.json post /reports/create/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/create/salesByProduct:
    post:
      tags:
        - report
      summary: Create a sales by product report
      description: >-
        Create a "sales by product" report. The generated report CSV contains
        the columns defined in the `SalesByProductReportColumns` schema. For
        Amazon Vendor channels, 'totalSales' is replaced by 'poValue' and
        'unitsSold' by 'unitsOrdered'. Use the /reports/status/{reportId}
        endpoint to check report status and obtain the download URL.
      operationId: createSalesByProductReport
      requestBody:
        description: Report criteria
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSalesByProductReportRequest'
        required: true
      responses:
        '200':
          description: Successful operation
          headers:
            Access-Control-Allow-Origin:
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateReportResponse'
            text/csv:
              schema:
                $ref: '#/components/schemas/SalesByProductReportColumns'
        '400':
          description: Invalid input
          content: {}
      security:
        - api_key: []
components:
  schemas:
    CreateSalesByProductReportRequest:
      type: object
      properties:
        channelId:
          type: string
        merchantId:
          type: string
        reportOptions:
          $ref: '#/components/schemas/CreateSalesByProductReportOptions'
    CreateReportResponse:
      type: object
      properties:
        reportId:
          type: string
        reportType:
          type: string
        status:
          type: string
    SalesByProductReportColumns:
      type: object
      description: >-
        Columns present in the downloadable Sales By Product report CSV. For
        Amazon Vendor channels, 'totalSales' is replaced by 'poValue' and
        'unitsSold' is replaced by 'unitsOrdered'.
      properties:
        title:
          type: string
          description: Product title
        brand:
          type: string
          description: Brand name
        sku:
          type: string
          description: Seller SKU identifier
        productSku:
          type: string
          description: Product SKU (e.g. ASIN for Amazon)
        id:
          type: string
          description: Product identifier from the source system
        asin:
          type: string
          description: Amazon Standard Identification Number
        imageUrl:
          type: string
          description: URL of the product image
        linkUrl:
          type: string
          description: URL to the product listing
        quantity:
          type: number
          description: Current inventory quantity
        price:
          type: number
          description: Current listing price
        totalSales:
          type: number
          description: Total sales revenue in the period (non-vendor channels)
        unitsSold:
          type: number
          description: Total units sold in the period (non-vendor channels)
        poValue:
          type: number
          description: Purchase order value (Amazon Vendor channels only)
        unitsOrdered:
          type: number
          description: Units ordered (Amazon Vendor channels only)
        avPrice:
          type: number
          description: Average selling price
        lastSold:
          type: string
          description: Date of last sale
        noQuantitySinceTime:
          type: string
          description: Date since which the product has had zero quantity
        daysCover:
          type: number
          description: Estimated days of inventory cover remaining
        salesRank:
          type: number
          description: Product sales rank in its category
        shippingPrice:
          type: number
          description: Shipping price
        categoryLabel:
          type: string
          description: Product category
        parentCategoryLabel:
          type: string
          description: Parent product category
        adSpend:
          type: number
          description: Advertising spend in the period
        adSales:
          type: number
          description: Sales attributed to advertising
        acos:
          type: number
          description: Advertising Cost of Sale (percentage)
        tacos:
          type: number
          description: Total Advertising Cost of Sale (percentage)
        fulfillmentChannel:
          type: string
          description: Fulfillment method (e.g. FBA, FBM)
        status:
          type: string
          description: Product listing status
        storeId:
          type: string
          description: Store identifier
        productId:
          type: string
          description: Internal product identifier
        _id:
          type: string
          description: Document identifier
    CreateSalesByProductReportOptions:
      allOf:
        - $ref: '#/components/schemas/CommonReportOptions'
        - type: object
          properties:
            includeNoSales:
              type: boolean
              description: Whether products with no sales should be included in the report
            includeNoInventory:
              type: boolean
              description: >-
                Whether products with zero inventory should be included in the
                report
            includeTax:
              type: boolean
              description: Whether tax should be included in sales figures
    CommonReportOptions:
      type: object
      properties:
        fromDate:
          type: number
          description: >-
            Unix epoch time (seconds) representing the start of the reporting
            period
        toDate:
          type: number
          description: >-
            Unix epoch time (seconds) representing the end of the reporting
            period
        priorFromDate:
          type: number
          description: >-
            Unix epoch time (seconds) representing the start of the comparison
            period
        priorToDate:
          type: number
          description: >-
            Unix epoch time (seconds) representing the end of the comparison
            period
        timezone:
          type: string
          description: >-
            The timezone string you wish to see the report in (e.g.
            'America/Los_Angeles') see
            https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  securitySchemes:
    api_key:
      type: apiKey
      name: x-api-key
      in: header

````