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

# How to write SQL for a report widget

> Read it before writing a widget's SQL: the SQL rules and the columns each widget type needs.



## OpenAPI

````yaml /api/statisfy-api.openapi.json get /v1/reports/guide
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/guide:
    get:
      tags:
        - reports
      summary: How to write SQL for a report widget
      description: >-
        Read it before writing a widget's SQL: the SQL rules and the columns
        each widget type needs.
      operationId: reports_guide
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReportsGuide'
          description: Successful Response
      security:
        - HTTPBearer: []
components:
  schemas:
    ReportsGuide:
      properties:
        guide:
          title: Guide
          type: string
      required:
        - guide
      title: ReportsGuide
      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.