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

# Try a report on one pay run

> Needs permission report:read. Runs an unsaved report definition over one pay run exactly as the pay run's Reports step would, for the report builder to show it before it is saved. Rows are capped at 10,000.



## OpenAPI

````yaml /api-reference/specs/report.json post /payroll-runs/{payrollConfigId}/{year}/{period}/{frequency}/reports/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:
  /payroll-runs/{payrollConfigId}/{year}/{period}/{frequency}/reports/run:
    post:
      tags:
        - Run reports
      summary: Try a report on one pay run
      description: >-
        Needs permission report:read. Runs an unsaved report definition over one
        pay run exactly as the pay run's Reports step would, for the report
        builder to show it before it is saved. Rows are capped at 10,000.
      operationId: tryPayRunReport
      parameters:
        - name: payrollConfigId
          in: path
          required: true
          schema:
            type: string
        - name: year
          in: path
          required: true
          schema:
            type: integer
            format: int32
        - name: period
          in: path
          required: true
          schema:
            type: integer
            format: int32
        - name: frequency
          in: path
          required: true
          schema:
            type: string
        - name: compareYear
          in: query
          description: >-
            A comparison report compares with this year's pay run of the same
            pay schedule; with comparePeriod. Left out: the pay schedule's
            previous pay run.
          schema:
            type: integer
            description: >-
              A comparison report compares with this year's pay run of the same
              pay schedule; with comparePeriod. Left out: the pay schedule's
              previous pay run.
            format: int32
        - name: comparePeriod
          in: query
          description: The period of the pay run to compare with; with compareYear.
          schema:
            type: integer
            description: The period of the pay run to compare with; with compareYear.
            format: int32
      requestBody:
        content:
          application/json:
            schema:
              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.
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunReportResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceError'
components:
  schemas:
    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.
    RunReportResponse:
      required:
        - columns
        - executionMs
        - rowCount
        - rows
        - runId
        - statusScope
        - truncated
      type: object
      properties:
        runId:
          type: string
        columns:
          type: array
          items:
            $ref: '#/components/schemas/Column'
        rows:
          type: array
          items:
            type: array
            items: {}
        rowCount:
          type: integer
          format: int32
        truncated:
          type: boolean
          description: true → the sync row cap was hit; use an export
        statusScope:
          type: string
          description: >-
            Which payslip statuses applied: FINAL (implicit default) | PREVIEW |
            REOPENED | ALL
        executionMs:
          type: integer
          format: int64
        comparedWith:
          allOf:
            - $ref: '#/components/schemas/ComparedPayRun'
          description: >-
            For a comparison report run on a pay run, the pay run it compared
            with
          nullable: true
    ValidationErrorResponse:
      required:
        - error
        - errors
      type: object
      properties:
        error:
          type: string
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ValidationErrorDetail'
    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
    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
    Column:
      required:
        - name
        - type
      type: object
      properties:
        name:
          type: string
        type:
          type: string
    ComparedPayRun:
      required:
        - period
        - year
      type: object
      properties:
        year:
          type: integer
          format: int32
        period:
          type: integer
          format: int32
      description: >-
        The pay run of the same pay schedule a comparison report compared with
        (evolution 0056).
    ValidationErrorDetail:
      required:
        - message
        - path
      type: object
      properties:
        path:
          type: string
          description: JSON pointer into the offending request
        message:
          type: string
    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
    ValidationIssueArgument:
      required:
        - name
      type: object
      properties:
        name:
          type: string
        value:
          nullable: true

````

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