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

# Run a report over one pay run

> Needs permission report:read, or any of pay-run:read. Runs a built-in or saved report over every payslip of the pay run (Preview, Final and Reopened), the run's keys added from the route, or over its pay schedule for a report that runs on one. A comparison report compares with compareYear/comparePeriod, else the previous pay run. A sensitive column the caller cannot read answers empty. Rows are capped at 10,000.



## OpenAPI

````yaml /api-reference/specs/report.json post /payroll-runs/{payrollConfigId}/{year}/{period}/{frequency}/reports/{definitionId}/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/{definitionId}/run:
    post:
      tags:
        - Run reports
      summary: Run a report over one pay run
      description: >-
        Needs permission report:read, or any of pay-run:read. Runs a built-in or
        saved report over every payslip of the pay run (Preview, Final and
        Reopened), the run's keys added from the route, or over its pay schedule
        for a report that runs on one. A comparison report compares with
        compareYear/comparePeriod, else the previous pay run. A sensitive column
        the caller cannot read answers empty. Rows are capped at 10,000.
      operationId: runPayRunReport
      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
        - name: definitionId
          in: path
          description: A built-in report (builtin.gross-to-net) or a saved one
          required: true
          schema:
            type: string
            description: A built-in report (builtin.gross-to-net) or a saved one
      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'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceError'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceError'
components:
  schemas:
    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
    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.