> ## 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 Provider Earnings Grouped

> Get provider earnings data with optional grouping.

This endpoint returns all data in a single response, including:
- Groups with their summaries and individual rows
- Grand totals across all data

Group options:
- "none": No grouping (flat list of all providers)
- "location": Group by location
- "date": Group by charge date

Example response:
{
    "groups": [
        {
            "key": "loc_123",
            "label": "Main Office",
            "count": 5,
            "summary": { "total_sold": 10000, ... },
            "rows": [
                { "provider_id": "...", "total_sold": 5000, ... },
                ...
            ]
        }
    ],
    "grand_totals": { "total_sold": 10000, ... },
    "total_count": 5
}



## OpenAPI

````yaml get /analytics/dashboards/provider-earnings/provider-earnings-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/provider-earnings/provider-earnings-grouped:
    get:
      tags:
        - provider
        - analytics
        - analytics
      summary: Get Provider Earnings Grouped
      description: |-
        Get provider earnings data with optional grouping.

        This endpoint returns all data in a single response, including:
        - Groups with their summaries and individual rows
        - Grand totals across all data

        Group options:
        - "none": No grouping (flat list of all providers)
        - "location": Group by location
        - "date": Group by charge date

        Example response:
        {
            "groups": [
                {
                    "key": "loc_123",
                    "label": "Main Office",
                    "count": 5,
                    "summary": { "total_sold": 10000, ... },
                    "rows": [
                        { "provider_id": "...", "total_sold": 5000, ... },
                        ...
                    ]
                }
            ],
            "grand_totals": { "total_sold": 10000, ... },
            "total_count": 5
        }
      operationId: >-
        get_provider_earnings_grouped_analytics_dashboards_provider_earnings_provider_earnings_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: timezone
          in: query
          required: true
          schema:
            type: string
            title: Timezone
        - name: group_by
          in: query
          required: false
          schema:
            enum:
              - location
              - date
              - none
            type: string
            default: none
            title: Group By
        - name: start_date
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date
              - type: 'null'
            title: Start Date
        - name: end_date
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date
              - 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: 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: min_earnings
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
              - type: 'null'
            title: Min Earnings
        - name: max_earnings
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
              - type: 'null'
            title: Max Earnings
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProviderEarningsGroupedResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ProviderEarningsGroupedResponse:
      properties:
        groups:
          items:
            $ref: '#/components/schemas/ProviderEarningsGroup'
          type: array
          title: Groups
        grandTotals:
          $ref: '#/components/schemas/ProviderEarningsSummary'
        totalCount:
          type: integer
          title: Totalcount
      type: object
      required:
        - groups
        - grandTotals
        - totalCount
      title: ProviderEarningsGroupedResponse
      description: Complete response from the provider earnings grouped endpoint.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ProviderEarningsGroup:
      properties:
        key:
          type: string
          title: Key
        label:
          type: string
          title: Label
        count:
          type: integer
          title: Count
        summary:
          $ref: '#/components/schemas/ProviderEarningsSummary'
        rows:
          items:
            $ref: '#/components/schemas/ProviderEarningsRow'
          type: array
          title: Rows
      type: object
      required:
        - key
        - label
        - count
        - summary
        - rows
      title: ProviderEarningsGroup
      description: A single group in the provider earnings response.
    ProviderEarningsSummary:
      properties:
        totalSold:
          type: integer
          title: Totalsold
          default: 0
        totalDiscounts:
          type: integer
          title: Totaldiscounts
          default: 0
        totalTips:
          type: integer
          title: Totaltips
          default: 0
        totalVoidAdjustments:
          type: integer
          title: Totalvoidadjustments
          default: 0
        totalTaxes:
          type: integer
          title: Totaltaxes
          default: 0
        totalOutstandingBalances:
          type: integer
          title: Totaloutstandingbalances
          default: 0
        totalRefunds:
          type: integer
          title: Totalrefunds
          default: 0
        totalEarnings:
          type: integer
          title: Totalearnings
          default: 0
        totalUniquePatients:
          type: integer
          title: Totaluniquepatients
          default: 0
        totalUniqueLocations:
          type: integer
          title: Totaluniquelocations
          default: 0
        providerCount:
          type: integer
          title: Providercount
          default: 0
      type: object
      title: ProviderEarningsSummary
      description: Aggregated summary for a 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
    ProviderEarningsRow:
      properties:
        providerId:
          anyOf:
            - type: string
            - type: 'null'
          title: Providerid
        providerFirstName:
          anyOf:
            - type: string
            - type: 'null'
          title: Providerfirstname
        providerLastName:
          anyOf:
            - type: string
            - type: 'null'
          title: Providerlastname
        providerEmail:
          anyOf:
            - type: string
            - type: 'null'
          title: Provideremail
        totalSold:
          type: integer
          title: Totalsold
        discounts:
          type: integer
          title: Discounts
        tips:
          type: integer
          title: Tips
        voidAdjustments:
          type: integer
          title: Voidadjustments
        taxes:
          type: integer
          title: Taxes
        outstandingBalances:
          type: integer
          title: Outstandingbalances
        refunds:
          type: integer
          title: Refunds
        totalEarnings:
          type: integer
          title: Totalearnings
        uniquePatients:
          type: integer
          title: Uniquepatients
        uniqueLocations:
          type: integer
          title: Uniquelocations
      type: object
      required:
        - providerId
        - providerFirstName
        - providerLastName
        - providerEmail
        - totalSold
        - discounts
        - tips
        - voidAdjustments
        - taxes
        - outstandingBalances
        - refunds
        - totalEarnings
        - uniquePatients
        - uniqueLocations
      title: ProviderEarningsRow
      description: A single provider's earnings data.

````