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

# The reports the pay run's Reports step shows

> Needs permission report:read, or any of pay-run:read. Built-in and saved reports, in the order shown, for everyone in the organisation. Until someone chooses, every built-in report (isDefault).



## OpenAPI

````yaml /api-reference/specs/report.json get /report-settings/pay-run
openapi: 3.0.4
info:
  title: Report Service
  description: >-
    Customisable reporting for FlowPayroll. Callers describe a report as a
    report-definition document, then run it, export it as a file or schedule it.
  contact:
    name: FlowPayroll
    email: support@flowpayroll.com
  version: v1
servers:
  - url: https://api.sandbox.flowpayroll.ai/v1/report
security: []
tags:
  - name: Datasets
    description: >-
      Discover what you can query: list the available datasets and inspect each
      field catalog — types, filterability, groupability, and supported
      aggregations.
  - name: Run reports
    description: >-
      Run a report synchronously — either an inline report definition or a saved
      one — and get columns and rows back in the response.
  - name: Report definitions
    description: >-
      Save a report definition under a name so it can be re-run, exported, and
      scheduled. Create, list, retrieve, replace, and delete definitions.
  - name: Exports
    description: >-
      Queue large result sets as asynchronous exports (CSV or JSONL, up to
      5,000,000 rows) and poll for a presigned download URL.
  - name: Schedules
    description: >-
      Run a saved definition on a cron schedule and deliver the export by
      webhook or email.
  - name: Run history
    description: Audit trail of every report run — synchronous, export, and scheduled.
paths:
  /report-settings/pay-run:
    get:
      tags:
        - report-settings
      summary: The reports the pay run's Reports step shows
      description: >-
        Needs permission report:read, or any of pay-run:read. Built-in and saved
        reports, in the order shown, for everyone in the organisation. Until
        someone chooses, every built-in report (isDefault).
      operationId: getPayRunReportSettings
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayRunReportSettings'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
components:
  schemas:
    PayRunReportSettings:
      required:
        - definitionIds
        - definitions
        - isDefault
      type: object
      properties:
        definitionIds:
          type: array
          items:
            type: string
          description: Built-in and saved report definitions, in the order shown.
        isDefault:
          type: boolean
          description: 'Nothing has been chosen: every built-in report, in their order.'
        definitions:
          type: array
          items:
            $ref: '#/components/schemas/DefinitionResponse'
          description: >-
            The reports shown, in the order shown: what the Reports step draws,
            so it needs no list of every report (which asks `report:read`). A
            report that no longer exists is left out.
      description: >-
        The reports the pay run's Reports step shows, in order, for everyone in
        the organisation.
    ServiceError:
      required:
        - error
        - message
      type: object
      properties:
        error:
          type: string
        message:
          type: string
    ApiErrorResponse:
      required:
        - message
      type: object
      properties:
        message:
          allOf:
            - $ref: '#/components/schemas/MessageWithTokenResponse'
        validationIssues:
          type: array
          items:
            $ref: '#/components/schemas/ValidationIssue'
          nullable: true
    DefinitionResponse:
      required:
        - createdAt
        - definition
        - definitionId
        - name
        - updatedAt
      type: object
      properties:
        definitionId:
          type: string
        name:
          type: string
        description:
          type: string
          nullable: true
        definition:
          allOf:
            - $ref: '#/components/schemas/ReportDefinition'
          description: >-
            The report-definition document: one contract drives sync runs,
            exports, saved definitions and schedules. select holds 1 to 50
            entries.
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        builtIn:
          type: boolean
          description: >-
            A report the platform provides: read-only; duplicate it to make your
            own.
          default: false
        version:
          type: integer
          description: A built-in report's version; null for the organisation's own.
          format: int32
          nullable: true
    MessageWithTokenResponse:
      required:
        - text
        - token
      type: object
      properties:
        text:
          type: string
        token:
          type: string
        tokenArguments:
          type: array
          items:
            $ref: '#/components/schemas/ValidationIssueArgument'
          nullable: true
    ValidationIssue:
      required:
        - field
        - reason
        - reasonToken
      type: object
      properties:
        field:
          type: string
        reason:
          type: string
        reasonToken:
          type: string
        reasonTokenArguments:
          type: array
          items:
            $ref: '#/components/schemas/ValidationIssueArgument'
          nullable: true
    ReportDefinition:
      required:
        - dataset
        - select
      type: object
      properties:
        dataset:
          type: string
          description: A dataset name from GET /datasets
        select:
          maxItems: 50
          minItems: 1
          type: array
          items:
            $ref: '#/components/schemas/SelectEntry'
        filters:
          allOf:
            - $ref: '#/components/schemas/FilterNode'
          description: >-
            Filter tree node: exactly one of and/or/not (branch, nesting depth
            at most 3) or field+op (leaf). value must match the field's type as
            GET /datasets/{name} lists it.
          nullable: true
        groupBy:
          type: array
          items:
            type: string
          description: >-
            Required iff any select entry aggregates; every plain select entry
            must appear here, referenced by field name or alias
          nullable: true
        orderBy:
          type: array
          items:
            $ref: '#/components/schemas/OrderBy'
          nullable: true
        limit:
          type: integer
          description: Clamped to 10,000 (sync) / 5,000,000 (export)
          format: int32
          nullable: true
        runsOn:
          enum:
            - payRun
            - paySchedule
          type: string
          description: >-
            payRun: the report runs on the pay run it is opened from, its keys
            never a filter; paySchedule: on that pay run's pay schedule over its
            tax year and the one before. Left out: whatever its filters say.
          nullable: true
      description: >-
        The report-definition document: one contract drives sync runs, exports,
        saved definitions and schedules. select holds 1 to 50 entries.
    ValidationIssueArgument:
      required:
        - name
      type: object
      properties:
        name:
          type: string
        value:
          nullable: true
    SelectEntry:
      type: object
      properties:
        field:
          type: string
          nullable: true
        aggregate:
          enum:
            - sum
            - avg
            - min
            - max
            - count
          type: string
          nullable: true
        as:
          type: string
          description: >-
            Output column alias (required for aggregations and tag-value
            extractions)
          nullable: true
        distinct:
          type: boolean
          default: false
        tagName:
          type: string
          description: >-
            Extract this tag's value from a tags field as a text column;
            groupable via its alias
          nullable: true
        tagGroup:
          type: string
          description: >-
            Restrict tagName extraction to one tag group; omitted matches any
            group
          nullable: true
        run:
          enum:
            - current
            - compared
            - difference
            - changePercent
          type: string
          description: >-
            In a report that runs on a pay run: current (this pay run), compared
            (the pay run it is compared with), difference (this minus compared)
            or changePercent (the difference as a percentage of compared; 100
            when compared is 0 and this is not). Left out: this pay run's value,
            or the compared one's when the row is only there.
          nullable: true
      description: >-
        One select entry: a plain field ({"field": ...}), an aggregation
        ({"aggregate": "sum", "field": ..., "as": ...}), or a tag-value
        extraction ({"field": <tags field>, "tagName": ..., "tagGroup": ...,
        "as": ...} — "as" is required, tagGroup omitted matches any group).
        count needs no field; count with a field supports "distinct": true.
    FilterNode:
      type: object
      properties:
        and:
          type: array
          items:
            $ref: '#/components/schemas/FilterNode'
          nullable: true
        or:
          type: array
          items:
            $ref: '#/components/schemas/FilterNode'
          nullable: true
        not:
          allOf:
            - $ref: '#/components/schemas/FilterNode'
          description: >-
            Filter tree node: exactly one of and/or/not (branch, nesting depth
            at most 3) or field+op (leaf). value must match the field's type as
            GET /datasets/{name} lists it.
          nullable: true
        field:
          type: string
          nullable: true
        op:
          enum:
            - eq
            - neq
            - in
            - gt
            - gte
            - lt
            - lte
            - between
            - contains
            - isNull
            - inPeriod
          type: string
          nullable: true
        value:
          description: >-
            Scalar, or array for in/between; omitted for isNull; a
            relative-period token (@currentWeek, @currentMonth, @currentTaxYear)
            for inPeriod on a date field
          nullable: true
      description: >-
        Filter tree node: exactly one of and/or/not (branch, nesting depth at
        most 3) or field+op (leaf). value must match the field's type as GET
        /datasets/{name} lists it.
    OrderBy:
      required:
        - field
      type: object
      properties:
        field:
          type: string
          description: A selected field or aggregation alias
        direction:
          enum:
            - asc
            - desc
          type: string
          default: asc

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.