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

# Run a widget

> Runs a widget as the reports page shows it, and returns its rows: a SQL widget's SQL, or the query of one made with the visual query builder, with the report's filters (`filters` on GET /v1/reports/{report_id}) applied. Send `filters` to set them, as the page's filter bar does; one left out keeps the value the page opens with, and null clears it. A key whose person sees only their own accounts reads the page's My Book, in every report view that belongs to an account: on a builder widget, the accounts their People record is related to; on a SQL widget, the accounts account_owners_view gives their email. A person's key runs only the reports the page shows them: another person's private report is a 404. A text widget, or a widget whose stored query can't run (for a My Book reader, one that can't be limited to their accounts), is a 422; so is a filter the report doesn't have, or a value its filter or its column can't take (under `filters.<id>`). Like the page, it reads at most the widget's first 10,000 rows, a page at a time (`limit` at most 1000, `next_offset`). It stops after about 15 seconds (a 504) and shares POST /v1/reports/query's per-workspace limit (a 429 with Retry-After). Safe to retry: it only reads.



## OpenAPI

````yaml /api/statisfy-api.openapi.json post /v1/reports/{report_id}/widgets/{widget_id}/run
openapi: 3.1.0
info:
  description: >-
    The agent-first Statisfy API. Authenticate with an API key (`Authorization:
    Bearer stfy_live_…`), then call `GET /v1/meta/capabilities` to discover
    every operation and its schemas.
  title: Statisfy API
  version: 1.0.0
servers:
  - url: https://api.statisfy.com
    description: Production
security: []
paths:
  /v1/reports/{report_id}/widgets/{widget_id}/run:
    post:
      tags:
        - reports
      summary: Run a widget
      description: >-
        Runs a widget as the reports page shows it, and returns its rows: a SQL
        widget's SQL, or the query of one made with the visual query builder,
        with the report's filters (`filters` on GET /v1/reports/{report_id})
        applied. Send `filters` to set them, as the page's filter bar does; one
        left out keeps the value the page opens with, and null clears it. A key
        whose person sees only their own accounts reads the page's My Book, in
        every report view that belongs to an account: on a builder widget, the
        accounts their People record is related to; on a SQL widget, the
        accounts account_owners_view gives their email. A person's key runs only
        the reports the page shows them: another person's private report is a
        404. A text widget, or a widget whose stored query can't run (for a My
        Book reader, one that can't be limited to their accounts), is a 422; so
        is a filter the report doesn't have, or a value its filter or its column
        can't take (under `filters.<id>`). Like the page, it reads at most the
        widget's first 10,000 rows, a page at a time (`limit` at most 1000,
        `next_offset`). It stops after about 15 seconds (a 504) and shares POST
        /v1/reports/query's per-workspace limit (a 429 with Retry-After). Safe
        to retry: it only reads.
      operationId: reports_run_widget
      parameters:
        - description: The report's id, from GET /v1/reports
          in: path
          name: report_id
          required: true
          schema:
            type: string
        - description: The widget's id, from the report
          in: path
          name: widget_id
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: false
              properties:
                filters:
                  description: >-
                    Values for the report's filters, each at most once. A filter
                    left out runs with the value the reports page opens with
                    (its default, or its date preset)
                  examples:
                    - - filter_id: f_region
                        value:
                          - EMEA
                          - APAC
                      - filter_id: f_close
                        value: this_quarter
                  items:
                    $ref: '#/components/schemas/ReportFilterValue'
                  maxItems: 100
                  title: Filters
                  type: array
                limit:
                  default: 100
                  description: The most rows to return
                  maximum: 1000
                  minimum: 1
                  title: Limit
                  type: integer
                offset:
                  default: 0
                  description: >-
                    Rows to skip first: the `next_offset` of the page before. A
                    widget shows at most its first 10,000 rows
                  exclusiveMaximum: 10000
                  minimum: 0
                  title: Offset
                  type: integer
              type: object
        required: false
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReportWidgetResult'
          description: Successful Response
      security:
        - HTTPBearer: []
components:
  schemas:
    ReportFilterValue:
      additionalProperties: false
      properties:
        filter_id:
          description: The filter's `id`, from the report's `filters`
          maxLength: 200
          minLength: 1
          title: Filter Id
          type: string
        value:
          description: >-
            The filter's value, as the reports page's filter bar sets it.
            select: one text, number or true/false value. multi_select: a list
            of them. text: text, matched anywhere in the column, ignoring case.
            number_range: {"min": <number or null>, "max": <number or null>}.
            date_range: a preset (today, yesterday, last_7_days, last_30_days,
            this_week, last_week, this_month, last_month, this_quarter,
            last_quarter, this_year, last_year, all_time; quarters and years on
            your fiscal calendar), {"preset": <preset>}, or {"start":
            "YYYY-MM-DD", "end": "YYYY-MM-DD"}. null clears the filter
          title: Value
      required:
        - filter_id
        - value
      title: ReportFilterValue
      type: object
    ReportWidgetResult:
      properties:
        columns:
          items:
            $ref: '#/components/schemas/ReportQueryColumn'
          title: Columns
          type: array
        next_offset:
          anyOf:
            - type: integer
            - type: 'null'
          description: >-
            When `truncated`: the `offset` that returns the next page. Null at
            the 10,000th row, the last a widget shows
          title: Next Offset
        rows:
          description: Each row's values, in the columns' order
          items:
            items: {}
            type: array
          title: Rows
          type: array
        truncated:
          description: >-
            Whether the widget had more rows than these: more than `limit`, or
            (over MCP) more than fit in one answer of about 50 KB
          title: Truncated
          type: boolean
      required:
        - columns
        - rows
        - truncated
      title: ReportWidgetResult
      type: object
    ReportQueryColumn:
      properties:
        name:
          title: Name
          type: string
        type:
          description: >-
            How its values come. number: a JSON number (numeric as floating
            point; NaN, Infinity and numbers beyond a float's range as null).
            date, time, timestamp: ISO 8601 (a timestamp with a time zone in
            UTC, +00:00; one without, as stored). interval: seconds (a month
            counts as 30 days, a year as 365). json: JSON. uuid: text. array: a
            JSON array. text, boolean as such; other: text
          enum:
            - number
            - text
            - boolean
            - date
            - timestamp
            - time
            - interval
            - json
            - uuid
            - array
            - other
          title: Type
          type: string
      required:
        - name
        - type
      title: ReportQueryColumn
      type: object
  securitySchemes:
    HTTPBearer:
      scheme: bearer
      type: http
      description: >-
        An API key, sent as `Authorization: Bearer stfy_live_…`. See
        [Authentication](/rest-api/authentication) for how to get one and which
        scopes it needs.

````

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