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

# Execute invoice report

> Execute saved invoice report and return DataTable-compatible response.

:param request: HTTP request with query params
:param pk: Custom report ID
:return: Paginated, sparse-formatted response



## OpenAPI

````yaml https://api.meetcampfire.com/api/schema?format=json get /coa/api/v1/invoice/report/{id}/data
openapi: 3.0.3
info:
  title: Campfire Developer APIs
  version: 1.0.0
  description: >
    ## Introduction

    Campfire's developer APIs offer granular access to Campfire's core
    accounting,

    revenue recognition, and financial data features.


    These APIs are designed to be used by developers to build custom
    integrations,

    automate workflows, and perform any other programmatic operations.
servers:
  - url: https://api.meetcampfire.com
    description: Production server
security: []
tags:
  - name: Cash Management
    description: Operations related to accounts, transactions, and other bank-related data.
  - name: Core Accounting
    description: >-
      Operations related to core accounting data, such as the chart of accounts,
      entity management, and the general ledger.
  - name: Revenue Recognition
    description: >-
      Operations related to revenue recognition, contract management, and
      contract data aggregation.
  - name: Accounts Receivable
    description: Operations related to invoicing and the AR subledger
  - name: Accounts Payable
    description: Operations related to billing and the AP subledger.
  - name: Financial Statements
    description: Operations related to financial statement generation and data aggregation.
  - name: Settings
    description: Operations related to system and accounting settings configuration.
paths:
  /coa/api/v1/invoice/report/{id}/data:
    get:
      tags:
        - Accounts Receivable
      summary: Execute invoice report
      description: |-
        Execute saved invoice report and return DataTable-compatible response.

        :param request: HTTP request with query params
        :param pk: Custom report ID
        :return: Paginated, sparse-formatted response
      operationId: coa_api_v1_invoice_report_data_retrieve
      parameters:
        - in: query
          name: aggregation_fields
          schema:
            type: string
          description: 'Aggregates: sum:amount, sum:amount_paid, sum:amount_due, etc.'
        - in: query
          name: client_id
          schema:
            type: string
          description: Filter by client ID(s)
        - in: query
          name: contract_id
          schema:
            type: string
          description: Filter by contract ID(s)
        - in: query
          name: currency
          schema:
            type: string
          description: Filter by currency code
        - in: query
          name: department_id
          schema:
            type: string
          description: Filter by department ID(s)
        - in: query
          name: end_date
          schema:
            type: string
          description: End date (YYYY-MM-DD)
        - in: query
          name: entity_id
          schema:
            type: string
          description: Entity ID(s), comma-separated
        - in: query
          name: group_fields
          schema:
            type: string
          description: >-
            Row dimensions: client_id, invoice_id, invoice_date_month,
            product_id, etc.
        - in: query
          name: group_keys
          schema:
            type: string
          description: Drilldown parent keys
        - in: path
          name: id
          schema:
            type: integer
          required: true
        - in: query
          name: include_totals
          schema:
            type: boolean
          description: Include grand totals row
        - in: query
          name: limit
          schema:
            type: integer
          description: Page size (max 10000)
        - in: query
          name: mode
          schema:
            type: string
          description: paginated | full | csv
        - in: query
          name: offset
          schema:
            type: integer
          description: Pagination offset
        - in: query
          name: payment_status
          schema:
            type: string
          description: 'Filter by status: draft,open,sent,partial,paid,uncollectible'
        - in: query
          name: pivot_fields
          schema:
            type: string
          description: 'Column dimensions: product_id, client_id, etc.'
        - in: query
          name: product_id
          schema:
            type: string
          description: Filter by product ID(s)
        - in: query
          name: shouldPivot
          schema:
            type: boolean
          description: Enable pivot columns
        - in: query
          name: start_date
          schema:
            type: string
          description: Start date (YYYY-MM-DD)
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceReportResponse'
              examples:
                GroupedByClientWithProductPivot:
                  value:
                    count: 5
                    results:
                      - client_id: 42
                        client_name: Acme Corp
                        amount: 50000
                        amount_paid: 30000
                        Widget A::::amount: 25000
                        Widget B::::amount: 25000
                        filter_params:
                          invoice__client_id: 42
                        group_id: 123456
                        id: 123456
                    engine_used: postgres
                    pivot_result_fields:
                      - Widget A::::amount
                      - Widget B::::amount
                    pivot_value_mappings:
                      product_id:
                        Widget A: 1
                        Widget B: 2
                  summary: grouped_by_client_with_product_pivot
          description: ''
      security:
        - knoxApiToken: []
components:
  schemas:
    InvoiceReportResponse:
      type: object
      description: Output schema for invoice report responses.
      properties:
        count:
          type: integer
          description: Total rows before pagination
        next:
          type: string
          nullable: true
          description: Next page URL (null for datatable pagination)
        previous:
          type: string
          nullable: true
          description: Previous page URL
        results:
          type: array
          items:
            $ref: '#/components/schemas/InvoiceReportResultRow'
          description: Paginated result rows
        engine_used:
          allOf:
            - $ref: '#/components/schemas/EngineUsedEnum'
          description: |-
            Execution engine: 'postgres'

            * `postgres` - postgres
        pivot_result_fields:
          type: array
          items:
            type: string
          description: Sorted list of pivot column names
        totals_row:
          type: object
          additionalProperties: {}
          description: Grand totals across all rows
        pivot_value_mappings:
          type: object
          additionalProperties: {}
          description: 'Mapping of pivot field -> {display_name: id} for drilldown'
      required:
        - count
        - engine_used
        - next
        - previous
        - results
    InvoiceReportResultRow:
      type: object
      description: Schema for a single result row (dimensions + aggregates + drilldown).
      properties:
        filter_params:
          type: object
          additionalProperties: {}
          description: Filter parameters for drilldown navigation
        group_id:
          type: integer
          description: Row identifier for AG Grid merging
        id:
          type: integer
          description: Row identifier for AG Grid getRowId
      required:
        - filter_params
        - group_id
        - id
    EngineUsedEnum:
      enum:
        - postgres
      type: string
      description: '* `postgres` - postgres'
  securitySchemes:
    knoxApiToken:
      type: apiKey
      in: header
      name: Authorization
      description: Token-based authentication with required prefix "Token"

````