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

# Generate Commission Report

> Generate commission payouts for one or more structures based on charges in the date range



## OpenAPI

````yaml post /inventory/commission-structures/generate-report
openapi: 3.1.0
info:
  title: Decoda API
  description: External API documentation for the Decoda Health platform.
  version: '1.0'
servers: []
security: []
paths:
  /inventory/commission-structures/generate-report:
    post:
      tags:
        - provider
        - inventory
      summary: Generate Commission Report
      description: >-
        Generate commission payouts for one or more structures based on charges
        in the date range
      operationId: >-
        generate_commission_report_inventory_commission_structures_generate_report_post
      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
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CommissionReportRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/CommissionReportDetail-Output'
                type: array
                title: >-
                  Response Generate Commission Report Inventory Commission
                  Structures Generate Report Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CommissionReportRequest:
      properties:
        structure_ids:
          items:
            type: string
          type: array
          title: Structure Ids
        start_date:
          type: string
          format: date
          title: Start Date
        end_date:
          type: string
          format: date
          title: End Date
      type: object
      required:
        - structure_ids
        - start_date
        - end_date
      title: CommissionReportRequest
    CommissionReportDetail-Output:
      properties:
        commissionStructure:
          $ref: '#/components/schemas/CommissionStructureDetail-Output'
          description: Commission structure this report belongs to
        startDate:
          type: string
          format: date
          title: Startdate
          description: Start date of the report
        endDate:
          type: string
          format: date
          title: Enddate
          description: End date of the report
        payouts:
          items:
            $ref: '#/components/schemas/CommissionPayoutDetail-Output'
          type: array
          title: Payouts
          description: Payouts for this commission structure
        totalPayout:
          type: integer
          title: Totalpayout
          description: Total payout for this commission structure
        commissionStructureId:
          type: string
          title: Commissionstructureid
          description: Commission structure this report belongs to
        creatorId:
          type: string
          title: Creatorid
          description: Creator of the report
        id:
          type: string
          title: Id
          description: Unique identifier for the commission report
        createdDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Createddate
          description: When the report was created
        updatedDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updateddate
          description: When the report was last updated
        isArchived:
          type: boolean
          title: Isarchived
          description: Whether the report is archived
          default: false
      type: object
      required:
        - commissionStructure
        - startDate
        - endDate
        - payouts
        - totalPayout
        - commissionStructureId
        - creatorId
        - id
      title: CommissionReportDetail
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    CommissionStructureDetail-Output:
      properties:
        id:
          type: string
          title: Id
          description: Unique identifier for the commission group
        name:
          type: string
          title: Name
          description: Name of the commission group
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Optional description of the commission group
        commissions:
          anyOf:
            - items:
                $ref: '#/components/schemas/CommissionDetail-Output'
              type: array
            - type: 'null'
          title: Commissions
          description: Commissions in this group
        providers:
          anyOf:
            - items:
                $ref: '#/components/schemas/ProviderTiny'
              type: array
            - type: 'null'
          title: Providers
          description: Providers in this group
      type: object
      required:
        - name
      title: CommissionStructureDetail
    CommissionPayoutDetail-Output:
      properties:
        id:
          type: string
          title: Id
          description: Unique identifier for the commission payout
        commissionReportId:
          type: string
          title: Commissionreportid
          description: Commission report this payout belongs to
        commissionId:
          type: string
          title: Commissionid
          description: Commission this payout belongs to
        providerId:
          type: string
          title: Providerid
          description: Provider this payout belongs to
        amount:
          type: integer
          title: Amount
          description: Amount of the payout
        createdDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Createddate
          description: When the payout was created
        provider:
          $ref: '#/components/schemas/ProviderTiny'
          description: Provider this payout belongs to
        commission:
          $ref: '#/components/schemas/CommissionDetail-Output'
          description: Commission rule that generated this payout
        chargeItems:
          items:
            $ref: '#/components/schemas/ChargeItemDetail-Output'
          type: array
          title: Chargeitems
          description: Charges this payout is from
        events:
          items:
            $ref: '#/components/schemas/EventTiny-Output'
          type: array
          title: Events
          description: Events this payout is from
        soldPackages:
          items:
            $ref: '#/components/schemas/SoldPackage-Output'
          type: array
          title: Soldpackages
          description: Sold packages this payout is from
      type: object
      required:
        - commissionReportId
        - commissionId
        - providerId
        - amount
        - provider
        - commission
        - chargeItems
        - events
        - soldPackages
      title: CommissionPayoutDetail
    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
    CommissionDetail-Output:
      properties:
        id:
          type: string
          title: Id
          description: Unique identifier for the commission
        itemId:
          anyOf:
            - type: string
            - type: 'null'
          title: Itemid
          description: >-
            Optional item this commission applies to (includes services and
            packages)
        itemCategory:
          anyOf:
            - type: string
            - type: 'null'
          title: Itemcategory
          description: >-
            Optional category name this commission applies to (references
            category.name)
        itemIsPhysical:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Itemisphysical
          description: Optional filter by whether item is physical
        totalSalesAmount:
          anyOf:
            - type: integer
            - type: 'null'
          title: Totalsalesamount
          description: Optional minimum total sales amount threshold in cents
        commissionStructureId:
          type: string
          title: Commissionstructureid
          description: Commission structure this commission belongs to
        percentage:
          anyOf:
            - type: number
            - type: 'null'
          title: Percentage
          description: Commission percentage (0.0 to 1.0)
        amount:
          anyOf:
            - type: integer
            - type: 'null'
          title: Amount
          description: Fixed commission amount in cents
        deductCost:
          type: boolean
          title: Deductcost
          description: >-
            Whether to deduct item cost before calculating commission (services
            only)
          default: false
        isArchived:
          type: boolean
          title: Isarchived
          description: Whether the commission is archived
          default: false
        updatedDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updateddate
          description: When the commission was last updated
        createdDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Createddate
          description: When the commission was created
        item:
          anyOf:
            - $ref: '#/components/schemas/ItemTiny'
            - type: 'null'
          description: Associated item (includes services and packages)
      type: object
      required:
        - commissionStructureId
      title: CommissionDetail
    ProviderTiny:
      properties:
        id:
          type: string
          title: Id
        firstName:
          type: string
          title: Firstname
        lastName:
          anyOf:
            - type: string
            - type: 'null'
          title: Lastname
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
        createdDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Createddate
      type: object
      required:
        - id
        - firstName
      title: ProviderTiny
    ChargeItemDetail-Output:
      properties:
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
          description: Unique identifier for the charge item
        itemId:
          anyOf:
            - type: string
            - type: 'null'
          title: Itemid
          description: Optional unique identifier for the item
        chargeId:
          type: string
          title: Chargeid
          description: Identifier of the charge this item is associated with
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          description: Name of the item (None for items with associated inventory item)
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Description of the item
        quantity:
          type: integer
          title: Quantity
          description: Quantity of the item being charged
        discountAmount:
          anyOf:
            - type: integer
            - type: 'null'
          title: Discountamount
          description: Discount amount for the item
        discountPercentage:
          anyOf:
            - type: number
            - type: 'null'
          title: Discountpercentage
          description: Discount percentage for the item
        discountReason:
          anyOf:
            - type: string
            - type: 'null'
          title: Discountreason
          description: Reason for discount
        price:
          type: integer
          title: Price
          description: Price of the item in cents
        soldPackageId:
          anyOf:
            - type: string
            - type: 'null'
          title: Soldpackageid
          description: Unique identifier for the sold package usage
        bankedQuantity:
          anyOf:
            - type: integer
            - type: 'null'
          title: Bankedquantity
          description: Quantity to bank for later use
        bankedItemId:
          anyOf:
            - type: string
            - type: 'null'
          title: Bankeditemid
          description: ID of banked item being used (for tracking usage)
        issuedDiscountId:
          anyOf:
            - type: string
            - type: 'null'
          title: Issueddiscountid
          description: Unique identifier for the specific issued discount instance used
        soldByProviderId:
          anyOf:
            - type: string
            - type: 'null'
          title: Soldbyproviderid
          description: Unique identifier for the provider who sold the item
        taxAmount:
          anyOf:
            - type: integer
            - type: 'null'
          title: Taxamount
          description: Tax amount for the item in cents
        pricingId:
          anyOf:
            - type: string
            - type: 'null'
          title: Pricingid
          description: Unique identifier for the pricing for the item
        shipmentIds:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Shipmentids
          description: Optional list of shipment IDs to reduce the stock quantity of
        item:
          anyOf:
            - $ref: '#/components/schemas/ItemTiny'
            - type: 'null'
          description: Details of the item (None for custom charge items)
        locationId:
          anyOf:
            - type: string
            - type: 'null'
          title: Locationid
          description: Location ID where the sale occurred
        locationName:
          anyOf:
            - type: string
            - type: 'null'
          title: Locationname
          description: Location name where the sale occurred
        saleDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Saledate
          description: Date when the sale occurred
      type: object
      required:
        - chargeId
        - quantity
        - price
      title: ChargeItemDetail
    EventTiny-Output:
      properties:
        id:
          type: string
          title: Id
        title:
          type: string
          title: Title
        start:
          type: string
          format: date-time
          title: Start
        end:
          type: string
          format: date-time
          title: End
        type:
          $ref: '#/components/schemas/EventType'
        location:
          anyOf:
            - $ref: '#/components/schemas/LocationTiny'
            - type: 'null'
        attendees:
          items:
            $ref: '#/components/schemas/AttendeeDetail-Output'
          type: array
          title: Attendees
          default: []
        status:
          $ref: '#/components/schemas/EventStatus'
        recurringEventId:
          anyOf:
            - type: string
            - type: 'null'
          title: Recurringeventid
        recurringEvent:
          anyOf:
            - $ref: '#/components/schemas/RecurringEventDetail'
            - type: 'null'
        eventServices:
          items:
            $ref: '#/components/schemas/EventServiceTiny'
          type: array
          title: Eventservices
          default: []
        icons:
          items:
            $ref: '#/components/schemas/EventIcon'
          type: array
          title: Icons
          default: []
        capacity:
          anyOf:
            - type: integer
            - type: 'null'
          title: Capacity
      type: object
      required:
        - id
        - title
        - start
        - end
        - type
        - status
      title: EventTiny
    SoldPackage-Output:
      properties:
        id:
          type: string
          title: Id
          description: Unique identifier for the sold package
        packageId:
          type: string
          title: Packageid
          description: Package ID that was sold
        patientId:
          type: string
          title: Patientid
          description: Patient ID who purchased the package
        chargeItemId:
          type: string
          title: Chargeitemid
          description: Charge item ID associated with the package purchase
        status:
          $ref: '#/components/schemas/PackageStatus'
          description: Status of the sold package
        package:
          anyOf:
            - $ref: '#/components/schemas/Package-Output'
            - type: 'null'
          description: Details of the package
        createdDate:
          type: string
          format: date-time
          title: Createddate
          description: Date the package was created
        updatedDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updateddate
          description: Date the package was updated
      type: object
      required:
        - packageId
        - patientId
        - chargeItemId
        - status
        - createdDate
      title: SoldPackage
    ItemTiny:
      properties:
        id:
          type: string
          title: Id
          description: Unique identifier for the item
        name:
          type: string
          title: Name
          description: Name of the item
        brandName:
          anyOf:
            - type: string
            - type: 'null'
          title: Brandname
          description: Optional brand name of the item
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Optional description of the item
        price:
          type: integer
          title: Price
          description: Price of the item in cents
        category:
          anyOf:
            - type: string
            - type: 'null'
          title: Category
          description: Category name (references category.name)
        unit:
          anyOf:
            - $ref: '#/components/schemas/Unit'
            - type: 'null'
          description: Unit of measurement for the item
        isPhysical:
          type: boolean
          title: Isphysical
          description: Whether the item is physical
          default: true
        isArchived:
          type: boolean
          title: Isarchived
          description: Whether the item is archived
          default: false
        internalNotes:
          anyOf:
            - type: string
            - type: 'null'
          title: Internalnotes
          description: Optional internal notes for the item
        taxable:
          type: boolean
          title: Taxable
          description: Whether the item is subject to taxes
          default: false
        sortOrder:
          anyOf:
            - type: integer
            - type: 'null'
          title: Sortorder
          description: Optional sort order for the item
        allowCustomPricing:
          type: boolean
          title: Allowcustompricing
          description: Whether custom pricing is allowed for this item
          default: false
        type:
          $ref: '#/components/schemas/ItemType'
          description: Type of item (PRODUCT, MEDICATION, etc.)
          default: PRODUCT
      type: object
      required:
        - name
        - price
      title: ItemTiny
    EventType:
      type: string
      enum:
        - APPOINTMENT
        - SHIFT
        - BLOCK
      title: EventType
    LocationTiny:
      properties:
        id:
          type: string
          title: Id
        isVirtual:
          type: boolean
          title: Isvirtual
      type: object
      required:
        - id
        - isVirtual
      title: LocationTiny
    AttendeeDetail-Output:
      properties:
        user:
          $ref: '#/components/schemas/UserTiny'
        inviteStatus:
          $ref: '#/components/schemas/InviteStatus'
      type: object
      required:
        - user
        - inviteStatus
      title: AttendeeDetail
    EventStatus:
      type: string
      enum:
        - PENDING
        - RESERVED
        - CONFIRMED
        - CANCELLED
        - COMPLETED
        - OVERRIDABLE
        - NO_SHOW
      title: EventStatus
    RecurringEventDetail:
      properties:
        id:
          type: string
          title: Id
        rrule:
          type: string
          title: Rrule
        startDate:
          type: string
          format: date-time
          title: Startdate
        durationMinutes:
          type: integer
          title: Durationminutes
        timezone:
          type: string
          title: Timezone
        serviceIds:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Serviceids
        capacity:
          anyOf:
            - type: integer
            - type: 'null'
          title: Capacity
        type:
          $ref: '#/components/schemas/EventType'
        title:
          type: string
          title: Title
        attendeeIds:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Attendeeids
        locationId:
          anyOf:
            - type: string
            - type: 'null'
          title: Locationid
        organizerId:
          type: string
          title: Organizerid
      type: object
      required:
        - id
        - rrule
        - startDate
        - durationMinutes
        - timezone
        - type
        - title
        - organizerId
      title: RecurringEventDetail
    EventServiceTiny:
      properties:
        service:
          $ref: '#/components/schemas/ServiceTiny'
        providerId:
          anyOf:
            - type: string
            - type: 'null'
          title: Providerid
        bookables:
          anyOf:
            - items:
                $ref: '#/components/schemas/EventServiceBookable'
              type: array
            - type: 'null'
          title: Bookables
        start:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Start
        end:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: End
        externalId:
          anyOf:
            - type: string
            - type: 'null'
          title: Externalid
        isArchived:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Isarchived
      type: object
      required:
        - service
      title: EventServiceTiny
    EventIcon:
      type: string
      enum:
        - BOOKING_FEE_PAID
        - NEW_PATIENT
        - SCHEDULED_BY_AI
        - FORM_COMPLETED
        - CHECKED_IN
      title: EventIcon
    PackageStatus:
      type: string
      enum:
        - USED
        - ACTIVE
        - CANCELLED
      title: PackageStatus
    Package-Output:
      properties:
        id:
          type: string
          title: Id
          description: Unique identifier for the package
        name:
          type: string
          title: Name
          description: Name of the package
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Optional description of the package
        isArchived:
          type: boolean
          title: Isarchived
          description: Whether the package is archived
          default: false
        price:
          type: integer
          title: Price
          description: Price of the package in cents
        internalNotes:
          anyOf:
            - type: string
            - type: 'null'
          title: Internalnotes
          description: Optional internal notes for the package
        items:
          anyOf:
            - items:
                $ref: '#/components/schemas/PackageItem-Output'
              type: array
            - type: 'null'
          title: Items
          description: Items included in the package
        category:
          anyOf:
            - type: string
            - type: 'null'
          title: Category
          description: Category name (references category.name)
      type: object
      required:
        - name
        - price
      title: Package
    Unit:
      type: string
      enum:
        - AMPOULES
        - APPLICATORS
        - BOTTLES
        - BOXES
        - CAPSULES
        - CUPS
        - DOSES
        - G_PER_ML
        - GRAMS
        - IU
        - IU_PER_ML
        - OUNCES
        - FLUID_OUNCES
        - KG
        - KITS
        - LITERS
        - MCG
        - MG
        - MG_PER_ML
        - ML
        - MMOL
        - MICROGRAM_PER_ML
        - PACKS
        - PAIRS
        - PATCHES
        - PERCENTAGE
        - PIECES
        - POUCHES
        - ROLLS
        - SACHETS
        - SHEETS
        - SPRAYS
        - STRIPS
        - SYRINGES
        - TABLETS
        - TABLETS_PER_DAY
        - TESTS
        - TUBES
        - UNITS
        - VIALS
        - TREATMENTS
        - SESSIONS
        - PULSES
        - JOULES
        - CENTIMETERS
        - THREAD_COUNT
        - INJECTIONS
        - WRINKLE_UNITS
        - POUNDS
        - FEET
        - INCHES
      title: Unit
    ItemType:
      type: string
      enum:
        - ITEM
        - PRODUCT
        - MEDICATION
        - SERVICE
        - PACKAGE
        - MEMBERSHIP
      title: ItemType
    UserTiny:
      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.
        locationId:
          anyOf:
            - type: string
            - type: 'null'
          title: Locationid
          description: The location of the user.
      type: object
      required:
        - id
        - type
      title: UserTiny
    InviteStatus:
      type: string
      enum:
        - PENDING
        - ACCEPTED
        - REJECTED
      title: InviteStatus
    ServiceTiny:
      properties:
        id:
          type: string
          title: Id
        duration:
          type: integer
          title: Duration
        name:
          type: string
          title: Name
        locationIds:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Locationids
        color:
          type: string
          title: Color
      type: object
      required:
        - id
        - duration
        - name
        - color
      title: ServiceTiny
    EventServiceBookable:
      properties:
        eventId:
          type: string
          title: Eventid
        serviceId:
          type: string
          title: Serviceid
        bookableId:
          type: string
          title: Bookableid
        start:
          type: string
          format: date-time
          title: Start
        end:
          type: string
          format: date-time
          title: End
      type: object
      required:
        - eventId
        - serviceId
        - bookableId
        - start
        - end
      title: EventServiceBookable
    PackageItem-Output:
      properties:
        id:
          type: string
          title: Id
          description: Unique identifier for the package item
        packageId:
          type: string
          title: Packageid
          description: Package ID this item belongs to
        itemId:
          type: string
          title: Itemid
          description: Item ID for this package item
        quantity:
          anyOf:
            - type: integer
            - type: 'null'
          title: Quantity
          description: Quantity of the item in the package
        price:
          type: integer
          title: Price
          description: Price of the item in the package in cents
        item:
          anyOf:
            - $ref: '#/components/schemas/ItemTiny'
            - type: 'null'
          description: Details of the item
      type: object
      required:
        - packageId
        - itemId
        - price
      title: PackageItem
    UserType:
      type: string
      enum:
        - PROVIDER
        - PATIENT
        - ASSISTANT
      title: UserType

````