> ## 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 Custom Report

> Execute custom 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 /ca/api/custom-reports/{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.


    ## Rate limits

    API users can make up to **5 requests per second**. This limit is shared
    across

    all endpoints for the same API user. Requests that exceed the limit receive
    a

    `429 Too Many Requests` response. Wait for the number of seconds specified
    in

    the `Retry-After` response header before retrying.
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:
  /ca/api/custom-reports/{id}/data:
    get:
      tags:
        - Financial Statements
      summary: Execute Custom Report
      description: |-
        Execute custom report and return DataTable-compatible response.

        :param request: HTTP request with query params
        :param pk: Custom report ID
        :return: Paginated, sparse-formatted response
      operationId: ca_api_custom_reports_data_retrieve
      parameters:
        - in: query
          name: account
          schema:
            type: string
          description: Account ID(s), comma-separated
        - in: query
          name: account_subtype
          schema:
            type: string
          description: Account subtype(s)
        - in: query
          name: account_type
          schema:
            type: string
          description: Account type(s), comma-separated (e.g. REVENUE,EXPENSE)
        - in: query
          name: aggregation_fields
          schema:
            type: string
          description: >-
            Override saved aggregates: comma-separated fn:field pairs (e.g.
            sum:net_debit,sum:net_credit)
        - in: query
          name: bank
          schema:
            type: string
          description: Bank account ID(s), comma-separated
        - in: query
          name: currency
          schema:
            type: string
          description: Currency code(s), comma-separated
        - in: query
          name: department
          schema:
            type: string
          description: Department ID(s), comma-separated
        - in: query
          name: end_date
          schema:
            type: string
          description: End date (YYYY-MM-DD)
        - in: query
          name: entity
          schema:
            type: string
          description: Entity ID(s), comma-separated
        - in: query
          name: group_fields
          schema:
            type: string
          description: >-
            Override saved row dimensions, comma-separated (e.g.
            vendor_id,account_id)
        - 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: journal_type
          schema:
            type: string
          description: Journal type(s), comma-separated
        - in: query
          name: limit
          schema:
            type: integer
          description: Page size (max 10000)
        - in: query
          name: mode
          schema:
            type: string
          description: >-
            paginated | full | csv. full returns unpaginated JSON for grouped
            reports; reports without groupings/aggregations stay paginated in
            JSON — use csv, which streams the complete report as a CSV
            attachment, for a full flat export.
        - in: query
          name: no_department
          schema:
            type: boolean
          description: Only rows without a department
        - in: query
          name: no_tag
          schema:
            type: boolean
          description: Only rows without tags
        - in: query
          name: no_vendor
          schema:
            type: boolean
          description: Only rows without a vendor
        - in: query
          name: offset
          schema:
            type: integer
          description: Pagination offset
        - in: query
          name: pivot_fields
          schema:
            type: string
          description: Override saved column dimensions, comma-separated (e.g. date_month)
        - in: query
          name: shouldPivot
          schema:
            type: boolean
          description: Enable pivot columns
        - in: query
          name: show_empty_lines
          schema:
            type: boolean
          description: Include zero-balance rows (defaults to the saved report's setting)
        - in: query
          name: sort
          schema:
            type: string
          description: Sort by column id; prefix with '-' for descending
        - in: query
          name: start_date
          schema:
            type: string
          description: Start date (YYYY-MM-DD)
        - in: query
          name: tag
          schema:
            type: string
          description: Tag ID(s), comma-separated
        - in: query
          name: tag_groups
          schema:
            type: string
          description: Tag group ID(s), comma-separated
        - in: query
          name: vendor
          schema:
            type: string
          description: Vendor ID(s), comma-separated
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomReportDataTableResponse'
            text/csv:
              schema:
                type: string
          description: ''
      security:
        - knoxApiToken: []
components:
  schemas:
    CustomReportDataTableResponse:
      type: object
      description: Output schema for custom report data 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:
            type: object
            additionalProperties: {}
          description: >-
            Result rows: group field values plus one key per aggregate/pivot
            column (sparse — zero pivot values omitted)
        engine_used:
          allOf:
            - $ref: '#/components/schemas/CustomReportDataTableResponseEngineUsedEnum'
          description: >-
            Execution engine used (absent on flat responses from reports without
            groupings/aggregations)


            * `postgres` - postgres

            * `pandas_pivot` - pandas_pivot
        totals_row:
          type: object
          additionalProperties: {}
          description: Grand totals across all rows (include_totals=true)
        pivot_result_fields:
          type: array
          items:
            type: string
          description: Sorted list of pivot column names
        pivot_value_mappings:
          type: object
          additionalProperties: {}
          description: 'Mapping of pivot field -> {display_name: id} for drilldown'
      required:
        - count
        - next
        - previous
        - results
    CustomReportDataTableResponseEngineUsedEnum:
      enum:
        - postgres
        - pandas_pivot
      type: string
      description: |-
        * `postgres` - postgres
        * `pandas_pivot` - pandas_pivot
  securitySchemes:
    knoxApiToken:
      type: apiKey
      in: header
      name: Authorization
      description: Token-based authentication with required prefix "Token"

````