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

# Get Product Sales Grouped

> Get product sales breakdown with grouping support.

Returns all groups with summaries and per-group pagination. Summary statistics
are calculated from ALL rows (not just the paginated subset).

Group options:
- "none": No grouping (single group with all items)
- "location": Group by location
- "provider": Group by provider
- "item_category": Group by item category
- "payment_medium": Group by payment medium (items may appear in multiple groups)
- "created_date": Group by charge date



## OpenAPI

````yaml get /analytics/dashboards/product-sales-breakdown/revenue-breakdown-grouped
openapi: 3.1.0
info:
  title: Decoda API
  description: External API documentation for the Decoda Health platform.
  version: '1.0'
servers: []
security: []
paths:
  /analytics/dashboards/product-sales-breakdown/revenue-breakdown-grouped:
    get:
      tags:
        - provider
        - analytics
        - analytics
      summary: Get Product Sales Grouped
      description: >-
        Get product sales breakdown with grouping support.


        Returns all groups with summaries and per-group pagination. Summary
        statistics

        are calculated from ALL rows (not just the paginated subset).


        Group options:

        - "none": No grouping (single group with all items)

        - "location": Group by location

        - "provider": Group by provider

        - "item_category": Group by item category

        - "payment_medium": Group by payment medium (items may appear in
        multiple groups)

        - "created_date": Group by charge date
      operationId: >-
        get_product_sales_grouped_analytics_dashboards_product_sales_breakdown_revenue_breakdown_grouped_get
      parameters:
        - name: TENANT
          in: header
          required: true
          schema:
            type: string
            title: Tenant
          description: The tenant you are making this request on behalf of
        - name: API-KEY
          in: header
          required: true
          schema:
            type: string
            title: Api-Key
          description: Your api key
        - name: group_by
          in: query
          required: false
          schema:
            enum:
              - none
              - location
              - provider
              - item_category
              - payment_medium
              - created_date
            type: string
            default: none
            title: Group By
        - name: timezone
          in: query
          required: true
          schema:
            type: string
            description: Timezone for date grouping (e.g., 'America/New_York', 'UTC')
            title: Timezone
          description: Timezone for date grouping (e.g., 'America/New_York', 'UTC')
        - name: page
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
              - type: 'null'
            description: Per-group pagination page number
            title: Page
          description: Per-group pagination page number
        - name: per_page
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
              - type: 'null'
            description: Per-group pagination page size
            title: Per Page
          description: Per-group pagination page size
        - name: sort_by
          in: query
          required: false
          schema:
            type: string
            default: created_date
            title: Sort By
        - name: sort_direction
          in: query
          required: false
          schema:
            enum:
              - asc
              - desc
            type: string
            default: desc
            title: Sort Direction
        - name: start_date
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Start Date
        - name: end_date
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: End Date
        - name: location_ids
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Location Ids
        - name: location_names
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Location Names
        - name: provider_ids
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Provider Ids
        - name: provider_names
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Provider Names
        - name: patient_ids
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Patient Ids
        - name: patient_names
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Patient Names
        - name: item_categories
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Item Categories
        - name: item_types
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Item Types
        - name: item_names
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Item Names
        - name: payment_mediums
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Payment Mediums
        - name: charge_statuses
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Charge Statuses
        - name: min_net_amount
          in: query
          required: false
          schema:
            anyOf:
              - type: number
              - type: 'null'
            title: Min Net Amount
        - name: max_net_amount
          in: query
          required: false
          schema:
            anyOf:
              - type: number
              - type: 'null'
            title: Max Net Amount
        - name: comment
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Comment
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProductSalesGroupedResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ProductSalesGroupedResponse:
      properties:
        groups:
          items:
            $ref: '#/components/schemas/ProductSalesGroup'
          type: array
          title: Groups
        grandTotals:
          $ref: '#/components/schemas/ProductSalesSummary'
        totalCount:
          type: integer
          title: Totalcount
      type: object
      required:
        - groups
        - grandTotals
        - totalCount
      title: ProductSalesGroupedResponse
      description: >-
        Complete response from the product sales grouped endpoint.


        This response structure:

        1. Returns all groups with their summaries calculated from ALL rows

        2. Supports per-group pagination (rows are paginated, but summary uses
        all data)

        3. Includes grand totals across all groups
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ProductSalesGroup:
      properties:
        key:
          type: string
          title: Key
        label:
          type: string
          title: Label
        count:
          type: integer
          title: Count
        summary:
          $ref: '#/components/schemas/ProductSalesSummary'
        rows:
          items:
            $ref: '#/components/schemas/ProductSalesRow'
          type: array
          title: Rows
      type: object
      required:
        - key
        - label
        - count
        - summary
        - rows
      title: ProductSalesGroup
      description: |-
        A single group in the product sales grouped response.

        Attributes:
            key: Unique identifier for the group
            label: Human-readable label for the group
            count: Total number of rows in this group (before pagination)
            summary: Aggregated summary from ALL rows (not just paginated subset)
            rows: Paginated rows for this group
    ProductSalesSummary:
      properties:
        totalItems:
          type: integer
          title: Totalitems
          default: 0
        totalQuantity:
          type: integer
          title: Totalquantity
          default: 0
        totalGrossAmount:
          type: integer
          title: Totalgrossamount
          default: 0
        totalItemDiscountAmount:
          type: integer
          title: Totalitemdiscountamount
          default: 0
        totalChargeDiscountAmount:
          type: integer
          title: Totalchargediscountamount
          default: 0
        totalTaxAmount:
          type: integer
          title: Totaltaxamount
          default: 0
        totalNetAmount:
          type: integer
          title: Totalnetamount
          default: 0
        totalCost:
          type: integer
          title: Totalcost
          default: 0
        totalNetProfit:
          type: integer
          title: Totalnetprofit
          default: 0
        uniquePatients:
          type: integer
          title: Uniquepatients
          default: 0
        uniqueProviders:
          type: integer
          title: Uniqueproviders
          default: 0
        uniqueLocations:
          type: integer
          title: Uniquelocations
          default: 0
      type: object
      title: ProductSalesSummary
      description: Summary statistics for product sales (per-group or grand totals).
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ProductSalesRow:
      properties:
        createdDate:
          type: string
          format: date-time
          title: Createddate
        locationId:
          anyOf:
            - type: string
            - type: 'null'
          title: Locationid
        providerId:
          anyOf:
            - type: string
            - type: 'null'
          title: Providerid
        patient:
          $ref: '#/components/schemas/PatientTiny'
        itemId:
          anyOf:
            - type: string
            - type: 'null'
          title: Itemid
        itemName:
          type: string
          title: Itemname
        itemType:
          type: string
          title: Itemtype
        itemCategory:
          type: string
          title: Itemcategory
        itemBrand:
          anyOf:
            - type: string
            - type: 'null'
          title: Itembrand
        quantity:
          type: number
          title: Quantity
        price:
          type: integer
          title: Price
        grossAmount:
          type: integer
          title: Grossamount
        itemDiscountAmount:
          type: integer
          title: Itemdiscountamount
        chargeDiscountAmount:
          type: integer
          title: Chargediscountamount
        taxAmount:
          type: integer
          title: Taxamount
        netAmount:
          type: integer
          title: Netamount
        cost:
          type: integer
          title: Cost
        paymentMediums:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Paymentmediums
        chargeId:
          type: string
          title: Chargeid
        chargeStatus:
          type: string
          title: Chargestatus
        comment:
          anyOf:
            - type: string
            - type: 'null'
          title: Comment
      type: object
      required:
        - createdDate
        - locationId
        - providerId
        - patient
        - itemId
        - itemName
        - itemType
        - itemCategory
        - itemBrand
        - quantity
        - price
        - grossAmount
        - itemDiscountAmount
        - chargeDiscountAmount
        - taxAmount
        - netAmount
        - cost
        - paymentMediums
        - chargeId
        - chargeStatus
        - comment
      title: ProductSalesRow
      description: Individual product sales row.
    PatientTiny:
      properties:
        id:
          type: string
          title: Id
          description: The unique identifier for the user.
        firstName:
          anyOf:
            - type: string
            - type: 'null'
          title: Firstname
          description: The user's first name.
        lastName:
          anyOf:
            - type: string
            - type: 'null'
          title: Lastname
          description: The user's last name.
        phoneNumber:
          anyOf:
            - type: string
            - type: 'null'
          title: Phonenumber
          description: The user's phone number.
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
          description: The user's email address.
        type:
          $ref: '#/components/schemas/UserType'
          description: The type of user.
          default: PATIENT
        locationId:
          anyOf:
            - type: string
            - type: 'null'
          title: Locationid
          description: The location of the user.
        dateOfBirth:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Dateofbirth
          description: The date of birth of the patient.
        onSchedulingBlacklist:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Onschedulingblacklist
          description: Whether the patient is on the scheduling blacklist.
      type: object
      required:
        - id
      title: PatientTiny
    UserType:
      type: string
      enum:
        - PROVIDER
        - PATIENT
        - ASSISTANT
      title: UserType

````