Lightdash Query API

These routes allow users to execute and manage queries against their data warehouse. This includes metric queries, SQL queries, and retrieving query results.

Operations 13

GET /api/v2/projects/{projectUuid}/query/{queryUuid} Get results #
POST /api/v2/projects/{projectUuid}/query/{queryUuid}/cancel Cancel query #
POST /api/v2/projects/{projectUuid}/query/{queryUuid}/calculate-total Calculate totals #
POST /api/v2/projects/{projectUuid}/query/metric-query Execute metric query #
POST /api/v2/projects/{projectUuid}/query/field-values Search field values #
POST /api/v2/projects/{projectUuid}/query/chart Execute saved chart #
POST /api/v2/projects/{projectUuid}/query/dashboard-chart Execute dashboard chart #
POST /api/v2/projects/{projectUuid}/query/underlying-data Execute underlying data #
POST /api/v2/projects/{projectUuid}/query/sql Execute SQL query #
POST /api/v2/projects/{projectUuid}/query/sql-chart Execute SQL chart #
POST /api/v2/projects/{projectUuid}/query/dashboard-sql-chart Execute dashboard SQL chart #
POST /api/v2/projects/{projectUuid}/query/{queryUuid}/download Download results #
POST /api/v2/projects/{projectUuid}/query/{queryUuid}/schedule-download Download results #

Documentation

Specifications

Schemas & Data

Other Resources

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/lightdash-query-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

lightdash-query-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Lightdash AiAgents Query API
  version: 0.3156.1
  description: 'Open API documentation for all public Lightdash API endpoints. # Authentication Before you get started, you might need to create a Personal Access Token to authenticate via the API. You can create a token by following this guide: https://docs.lightdash.com/references/personal_tokens

    '
  license:
    name: MIT
  contact:
    name: Lightdash Support
    email: support@lightdash.com
    url: https://docs.lightdash.com/help-and-contact/contact/contact_info/
servers:
- url: /
tags:
- name: Query
  description: These routes allow users to execute and manage queries against their data warehouse. This includes metric queries, SQL queries, and retrieving query results.
paths:
  /api/v2/projects/{projectUuid}/query/{queryUuid}:
    get:
      operationId: getAsyncQueryResults
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiGetAsyncQueryResultsResponse'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      description: Retrieves paginated results from a previously executed async query using its UUID
      summary: Get results
      tags:
      - Query
      security: []
      parameters:
      - in: path
        name: projectUuid
        required: true
        schema:
          type: string
      - description: The UUID of the async query to retrieve results for
        in: path
        name: queryUuid
        required: true
        schema:
          type: string
      - description: Page number for pagination (starts at 1)
        in: query
        name: page
        required: false
        schema:
          format: double
          type: number
      - description: 'Number of results per page (default: 500, max: 5000)'
        in: query
        name: pageSize
        required: false
        schema:
          format: double
          type: number
  /api/v2/projects/{projectUuid}/query/{queryUuid}/cancel:
    post:
      operationId: cancelAsyncQuery
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiSuccessEmpty'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      description: Cancels a running async query and discards any partial results
      summary: Cancel query
      tags:
      - Query
      security: []
      parameters:
      - in: path
        name: projectUuid
        required: true
        schema:
          type: string
      - description: The UUID of the async query to cancel
        in: path
        name: queryUuid
        required: true
        schema:
          type: string
  /api/v2/projects/{projectUuid}/query/{queryUuid}/calculate-total:
    post:
      operationId: executeAsyncCalculateTotal
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiSuccess_ApiExecuteAsyncMetricQueryResults_'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      description: Calculates totals for a previously-executed query, referenced by its queryUuid. Re-runs the source query's MetricQuery against the warehouse so totals are correct for every metric type (count distinct, average, ratio, etc.) — unlike client-side cell summation, which only works for sum/count. The requested `kind` selects which totals to compute.
      summary: Calculate totals
      tags:
      - Query
      security: []
      parameters:
      - in: path
        name: projectUuid
        required: true
        schema:
          type: string
      - description: The UUID of the previously-executed query to compute totals from
        in: path
        name: queryUuid
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExecuteAsyncCalculateTotalRequestParams'
  /api/v2/projects/{projectUuid}/query/metric-query:
    post:
      operationId: executeAsyncMetricQuery
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiSuccess_ApiExecuteAsyncMetricQueryResults_'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      description: Executes a metric query asynchronously against your data warehouse using dimensions, metrics, filters, and sorts
      summary: Execute metric query
      tags:
      - Query
      security: []
      parameters:
      - in: path
        name: projectUuid
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExecuteAsyncMetricQueryRequestParams'
  /api/v2/projects/{projectUuid}/query/field-values:
    post:
      operationId: executeAsyncFieldValueSearch
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiSuccess_ApiExecuteAsyncFieldValueSearchResults_'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      description: Searches for unique field values asynchronously, returning a query UUID to poll for results
      summary: Search field values
      tags:
      - Query
      security: []
      parameters:
      - in: path
        name: projectUuid
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExecuteAsyncFieldValueSearchRequestParams'
  /api/v2/projects/{projectUuid}/query/chart:
    post:
      operationId: executeAsyncSavedChartQuery
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiSuccess_ApiExecuteAsyncMetricQueryResults_'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      description: Executes a saved chart query asynchronously with optional parameter overrides
      summary: Execute saved chart
      tags:
      - Query
      security: []
      parameters:
      - in: path
        name: projectUuid
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExecuteAsyncSavedChartRequestParams'
  /api/v2/projects/{projectUuid}/query/dashboard-chart:
    post:
      operationId: executeAsyncDashboardChartQuery
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiSuccess_ApiExecuteAsyncDashboardChartQueryResults_'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      description: Executes a chart within a dashboard context asynchronously with inherited dashboard filters
      summary: Execute dashboard chart
      tags:
      - Query
      security: []
      parameters:
      - in: path
        name: projectUuid
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExecuteAsyncDashboardChartRequestParams'
  /api/v2/projects/{projectUuid}/query/underlying-data:
    post:
      operationId: executeAsyncUnderlyingDataQuery
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiSuccess_ApiExecuteAsyncMetricQueryResults_'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      description: Executes a query to retrieve underlying raw data for drilling down into aggregated values
      summary: Execute underlying data
      tags:
      - Query
      security: []
      parameters:
      - in: path
        name: projectUuid
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExecuteAsyncUnderlyingDataRequestParams'
  /api/v2/projects/{projectUuid}/query/sql:
    post:
      operationId: executeAsyncSqlQuery
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiSuccess_ApiExecuteAsyncSqlQueryResults_'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      description: Executes a raw SQL query asynchronously against your data warehouse for custom queries
      summary: Execute SQL query
      tags:
      - Query
      security: []
      parameters:
      - in: path
        name: projectUuid
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExecuteAsyncSqlQueryRequestParams'
  /api/v2/projects/{projectUuid}/query/sql-chart:
    post:
      operationId: executeAsyncSqlChartQuery
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiSuccess_ApiExecuteAsyncSqlQueryResults_'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      description: Executes a saved SQL chart query asynchronously with optional chart configurations
      summary: Execute SQL chart
      tags:
      - Query
      security: []
      parameters:
      - in: path
        name: projectUuid
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExecuteAsyncSqlChartRequestParams'
  /api/v2/projects/{projectUuid}/query/dashboard-sql-chart:
    post:
      operationId: executeAsyncDashboardSqlChartQuery
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiSuccess_ApiExecuteAsyncDashboardSqlChartQueryResults_'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      description: Executes a SQL chart within a dashboard context asynchronously with inherited filters
      summary: Execute dashboard SQL chart
      tags:
      - Query
      security: []
      parameters:
      - in: path
        name: projectUuid
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExecuteAsyncDashboardSqlChartRequestParams'
  /api/v2/projects/{projectUuid}/query/{queryUuid}/download:
    post:
      operationId: downloadResults
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiSuccess_ApiDownloadAsyncQueryResults-or-ApiDownloadAsyncQueryResultsAsCsv-or-ApiDownloadAsyncQueryResultsAsXlsx_'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      description: Downloads query results in various formats with custom formatting options
      summary: Download results
      tags:
      - Query
      deprecated: true
      security: []
      parameters:
      - in: path
        name: projectUuid
        required: true
        schema:
          type: string
      - description: The UUID of the completed async query to download
        in: path
        name: queryUuid
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Omit_DownloadAsyncQueryResultsRequestParams.queryUuid_'
  /api/v2/projects/{projectUuid}/query/{queryUuid}/schedule-download:
    post:
      operationId: scheduleDownloadResults
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiJobScheduledResponse'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      description: Downloads query results in various formats with custom formatting options
      summary: Download results
      tags:
      - Query
      security: []
      parameters:
      - in: path
        name: projectUuid
        required: true
        schema:
          type: string
      - description: The UUID of the completed async query to download
        in: path
        name: queryUuid
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Omit_DownloadAsyncQueryResultsRequestParams.queryUuid_'
components:
  schemas:
    PreAggregateMissReason.GRANULARITY_TOO_FINE:
      enum:
      - granularity_too_fine
      type: string
    PreAggregateMissReason.FILTER_DIMENSION_NOT_IN_PRE_AGGREGATE:
      enum:
      - filter_dimension_not_in_pre_aggregate
      type: string
    SortField:
      properties:
        pivotValues:
          items:
            $ref: '#/components/schemas/PivotSortAnchor'
          type: array
          description: Pins the row-sort anchor to a specific pivot column. Ignored for non-pivoted results.
        nullsFirst:
          type: boolean
          description: Sort null values first
        descending:
          type: boolean
          description: Sort in descending order
        fieldId:
          type: string
          description: Field ID to sort by
      required:
      - descending
      - fieldId
      type: object
    FilterRule:
      properties:
        values:
          items:
            $ref: '#/components/schemas/AnyType'
          type: array
          description: Values to filter by
        operator:
          $ref: '#/components/schemas/FilterOperator'
          description: Filter operator
        id:
          type: string
          description: Unique identifier for the filter
        target:
          $ref: '#/components/schemas/FieldTarget'
          description: Target field for the filter
        settings:
          $ref: '#/components/schemas/AnyType'
          description: Additional settings for date/time filters
        disabled:
          type: boolean
          description: Whether this filter is disabled
        required:
          type: boolean
          description: Whether this filter is required
        caseSensitive:
          type: boolean
          description: 'Overrides the field/explore case-sensitivity for this rule only.

            Used by internal features like autocomplete search that must always

            match case-insensitively regardless of the field''s configured setting.'
      required:
      - operator
      - id
      - target
      type: object
      additionalProperties: true
    BinType.CUSTOM_GROUP:
      enum:
      - custom_group
      type: string
    TableCalculationTemplateType.RANK_IN_COLUMN:
      enum:
      - rank_in_column
      type: string
    ApiSuccess_ApiExecuteAsyncDashboardSqlChartQueryResults_:
      properties:
        results:
          $ref: '#/components/schemas/ApiExecuteAsyncDashboardSqlChartQueryResults'
        status:
          type: string
          enum:
          - ok
      required:
      - results
      - status
      type: object
    MetricOverrides:
      properties: {}
      additionalProperties:
        $ref: '#/components/schemas/Pick_Metric.formatOptions_'
      type: object
    QueryHistoryStatus.QUEUED:
      enum:
      - queued
      type: string
    QueryWarning:
      properties:
        tables:
          items:
            type: string
          type: array
        fields:
          items:
            type: string
          type: array
        message:
          type: string
      required:
      - message
      type: object
    PreAggregateMissReason.NO_PRE_AGGREGATES_DEFINED:
      enum:
      - no_pre_aggregates_defined
      type: string
    Pick_MetricQueryRequest.Exclude_keyofMetricQueryRequest.csvLimit__:
      properties:
        dateZoom:
          $ref: '#/components/schemas/DateZoom'
        limit:
          type: number
          format: double
        timezone:
          type: string
        filters:
          properties:
            tableCalculations: {}
            metrics: {}
            dimensions: {}
          type: object
        exploreName:
          type: string
        dimensions:
          items:
            type: string
          type: array
        metrics:
          items:
            type: string
          type: array
        sorts:
          items:
            $ref: '#/components/schemas/SortField'
          type: array
        tableCalculations:
          items:
            $ref: '#/components/schemas/TableCalculation'
          type: array
        additionalMetrics:
          items:
            $ref: '#/components/schemas/AdditionalMetric'
          type: array
        customDimensions:
          items:
            $ref: '#/components/schemas/CustomDimension'
          type: array
        metricOverrides:
          $ref: '#/components/schemas/MetricOverrides'
        dimensionOverrides:
          $ref: '#/components/schemas/DimensionOverrides'
        pivotDimensions:
          items:
            type: string
          type: array
        metadata:
          properties:
            hasADateDimension:
              $ref: '#/components/schemas/Pick_CompiledDimension.name-or-label-or-table_'
          required:
          - hasADateDimension
          type: object
      required:
      - limit
      - filters
      - exploreName
      - dimensions
      - metrics
      - sorts
      - tableCalculations
      type: object
      description: From T, pick a set of properties whose keys are in the union K
    CustomSqlDimension:
      properties:
        id:
          type: string
          description: Unique identifier for the custom dimension
        name:
          type: string
          description: Display name for the custom dimension
        table:
          type: string
          description: Table this custom dimension belongs to
        type:
          $ref: '#/components/schemas/CustomDimensionType.SQL'
          description: Type of custom dimension (bin or sql)
        sql:
          type: string
          description: SQL expression for the custom dimension
        dimensionType:
          $ref: '#/components/schemas/DimensionType'
          description: Data type of the dimension result
      required:
      - id
      - name
      - table
      - type
      - sql
      - dimensionType
      type: object
      additionalProperties: true
    GroupValueRule:
      properties:
        value:
          type: string
        matchType:
          $ref: '#/components/schemas/GroupValueMatchType'
      required:
      - value
      - matchType
      type: object
    PreAggregateMissReason.CUSTOM_DIMENSION_PRESENT:
      enum:
      - custom_dimension_present
      type: string
    TableCalculation:
      anyOf:
      - $ref: '#/components/schemas/SqlTableCalculation'
      - $ref: '#/components/schemas/TemplateTableCalculation'
      - $ref: '#/components/schemas/FormulaTableCalculation'
    PreAggregateMatchMiss:
      anyOf:
      - properties:
          reason:
            $ref: '#/components/schemas/PreAggregateMissReason.NO_PRE_AGGREGATES_DEFINED'
        required:
        - reason
        type: object
      - properties:
          fieldId:
            $ref: '#/components/schemas/FieldId'
          reason:
            $ref: '#/components/schemas/PreAggregateMissReason.DIMENSION_NOT_IN_PRE_AGGREGATE'
        required:
        - fieldId
        - reason
        type: object
      - properties:
          fieldId:
            $ref: '#/components/schemas/FieldId'
          reason:
            $ref: '#/components/schemas/PreAggregateMissReason.METRIC_NOT_IN_PRE_AGGREGATE'
        required:
        - fieldId
        - reason
        type: object
      - properties:
          fieldId:
            $ref: '#/components/schemas/FieldId'
          reason:
            $ref: '#/components/schemas/PreAggregateMissReason.NON_ADDITIVE_METRIC'
        required:
        - fieldId
        - reason
        type: object
      - properties:
          fieldId:
            $ref: '#/components/schemas/FieldId'
          reason:
            $ref: '#/components/schemas/PreAggregateMissReason.CUSTOM_SQL_METRIC'
        required:
        - fieldId
        - reason
        type: object
      - properties:
          fieldId:
            $ref: '#/components/schemas/FieldId'
          reason:
            $ref: '#/components/schemas/PreAggregateMissReason.FILTER_DIMENSION_NOT_IN_PRE_AGGREGATE'
        required:
        - fieldId
        - reason
        type: object
      - properties:
          fieldId:
            $ref: '#/components/schemas/FieldId'
          reason:
            $ref: '#/components/schemas/PreAggregateMissReason.PRE_AGGREGATE_FILTER_NOT_SATISFIED'
        required:
        - fieldId
        - reason
        type: object
      - properties:
          preAggregateTimeDimension:
            type: string
          preAggregateGranularity:
            $ref: '#/components/schemas/TimeFrames'
          queryGranularity:
            $ref: '#/components/schemas/TimeFrames'
          fieldId:
            $ref: '#/components/schemas/FieldId'
          reason:
            $ref: '#/components/schemas/PreAggregateMissReason.GRANULARITY_TOO_FINE'
        required:
        - preAggregateTimeDimension
        - preAggregateGranularity
        - queryGranularity
        - fieldId
        - reason
        type: object
      - properties:
          reason:
            $ref: '#/components/schemas/PreAggregateMissReason.CUSTOM_DIMENSION_PRESENT'
        required:
        - reason
        type: object
      - properties:
          fieldId:
            $ref: '#/components/schemas/FieldId'
          reason:
            $ref: '#/components/schemas/PreAggregateMissReason.CUSTOM_METRIC_PRESENT'
        required:
        - fieldId
        - reason
        type: object
      - properties:
          fieldId:
            $ref: '#/components/schemas/FieldId'
          reason:
            $ref: '#/components/schemas/PreAggregateMissReason.TABLE_CALCULATION_PRESENT'
        required:
        - fieldId
        - reason
        type: object
      - properties:
          preAggregateName:
            type: string
          reason:
            $ref: '#/components/schemas/PreAggregateMissReason.USER_BYPASS'
        required:
        - preAggregateName
        - reason
        type: object
      - properties:
          reason:
            $ref: '#/components/schemas/PreAggregateMissReason.EXPLORE_RESOLUTION_ERROR'
        required:
        - reason
        type: object
      - properties:
          reason:
            $ref: '#/components/schemas/PreAggregateMissReason.NO_ACTIVE_MATERIALIZATION'
        required:
        - reason
        type: object
    TableCalculationTemplateType.PERCENT_CHANGE_FROM_PREVIOUS:
      enum:
      - percent_change_from_previous
      type: string
    PreAggregateMissReason.DIMENSION_NOT_IN_PRE_AGGREGATE:
      enum:
      - dimension_not_in_pre_aggregate
      type: string
    CommonExecuteQueryRequestParams:
      properties:
        parameters:
          $ref: '#/components/schemas/ParametersValuesMap'
        usePreAggregateCache:
          type: boolean
        invalidateCache:
          type: boolean
        context:
          $ref: '#/components/schemas/QueryExecutionContext'
      type: object
    Pick_Metric.formatOptions_:
      properties:
        formatOptions:
          $ref: '#/components/schemas/CustomFormat'
      type: object
      description: From T, pick a set of properties whose keys are in the union K
    TimeFrames:
      enum:
      - RAW
      - YEAR
      - QUARTER
      - MONTH
      - WEEK
      - DAY
      - HOUR
      - MINUTE
      - SECOND
      - MILLISECOND
      - DAY_OF_WEEK_INDEX
      - DAY_OF_MONTH_NUM
      - DAY_OF_YEAR_NUM
      - WEEK_NUM
      - MONTH_NUM
      - QUARTER_NUM
      - YEAR_NUM
      - DAY_OF_WEEK_NAME
      - MONTH_NAME
      - QUARTER_NAME
      - HOUR_OF_DAY_NUM
      - MINUTE_OF_HOUR_NUM
      type: string
    ExecuteAsyncSqlQueryRequestParams:
      allOf:
      - $ref: '#/components/schemas/CommonExecuteQueryRequestParams'
      - properties:
          pivotConfiguration:
            $ref: '#/components/schemas/PivotConfiguration'
          limit:
            type: number
            format: double
          sql:
            type: string
        required:
        - sql
        type: object
    TableCalculationTemplateType.PERCENT_OF_COLUMN_TOTAL:
      enum:
      - percent_of_column_total
      type: string
    SortByDirection:
      enum:
      - ASC
      - DESC
      type: string
    ExecuteAsyncDashboardSqlChartRequestParams:
      anyOf:
      - $ref: '#/components/schemas/ExecuteAsyncDashboardSqlChartByUuidRequestParams'
      - $ref: '#/components/schemas/ExecuteAsyncDashboardSqlChartBySlugRequestParams'
    CompactOrAlias:
      anyOf:
      - $ref: '#/components/schemas/Compact'
      - type: string
        enum:
        - K
        - thousand
        - M
        - million
        - B
        - billion
        - T
        - trillion
        - KB
        - kilobyte
        - MB
        - megabyte
        - GB
        - gigabyte
        - TB
        - terabyte
        - PB
        - petabyte
        - KiB
        - kibibyte
        - MiB
        - mebibyte
        - GiB
        - gibibyte
        - TiB
        - tebibyte
        - PiB
        - pebibyte
    ApiGetAsyncQueryResultsResponse:
      properties:
        results:
          $ref: '#/components/schemas/ApiGetAsyncQueryResults'
        status:
          type: string
          enum:
          - ok
      required:
      - results
      - status
      type: object
    MetricFilterRule:
      description: Filter rule for metrics, targeting fields by reference
      properties:
        values:
          items:
            $ref: '#/components/schemas/AnyType'
          type: array
          description: Values to filter by
        operator:
          $ref: '#/components/schemas/FilterOperator'
          description: Filter operator
        id:
          type: string
          description: Unique identifier for the filter
        target:
          properties:
            fieldRef:
              type: string
              description: Field reference to filter on (e.g., 'table_name.field_name')
          required:
          - fieldRef
          type: object
          description: Target field for the filter
        settings:
          $ref: '#/components/schemas/AnyType'
          description: Additional settings for date/time filters
        disabled:
          type: boolean
          description: Whether this filter is disabled
        required:
          type: boolean
          description: Whether this filter is required
        caseSensitive:
          type: boolean
          description: 'Overrides the field/explore case-sensitivity for this rule only.

            Used by internal features like autocomplete search that must always

            match case-insensitively regardless of the field''s configured setting.'
      required:
      - operator
      - id
      - target
      type: object
      additionalProperties: true
    OrFilterGroup:
      properties:
        or:
          items:
            $ref: '#/components/schemas/FilterGroupItem'
          type: array
          description: Array of filters or nested groups combined with OR logic
        id:
          type: string
          description: Unique identifier for the filter group
      required:
      - or
      - id
      type: object
    ApiDownloadAsyncQueryResultsAsCsv:
      properties:
        truncated:
          type: boolean
        fileUrl:
          type: string
      required:
      - truncated
      - fileUrl
      type: object
    PreAggregateMissReason.EXPLORE_RESOLUTION_ERROR:
      enum:
      - explore_resolution_error
      type: string
    Field:
      properties:
        fieldType:
          $ref: '#/components/schemas/FieldType'
        type:
          type: string
        name:
          type: string
        label:
          type: string
        table:
          type: string
        tableLabel:
          type: string
        sql:
          type: string
        description:
          type: string
        source:
          $ref: '#/components/schemas/Source'
        hidden:
          type: boolean
        compact:
          $ref: '#/components/schemas/CompactOrAlias'
        round:
          type: number
          format: double
        format:
          anyOf:
          - $ref: '#/components/schemas/Format'
          - type: string
        separator:
          $ref: '#/components/schemas/NumberSeparator'
          description: 'Number separator style for grouping/decimal characters. Composes with

            `format` (including ECMA-376 expressions) and `formatOptions` — it only

            controls the separator characters, not the format shape.'
        groupLabel:
          type: string
          deprecated: true
        groups:
          items:
            type: string
          type: array
        urls:
          items:
            $ref: '#/components/schemas/FieldUrl'
          type: array
        index:
          type: number
          format: double
        tags:
          items:
            type: string
          type: array
        parameterReferences:
          items:
            type: string
          type: array
      required:
      - fieldType
      - type
      - name
      - label
      - table
      - tableLabel
      - sql
      - hidden
      type: object
      additionalProperties: true
    TableCalculationTemplateType.PERCENT_OF_PREVIOUS_VALUE:
      enum:
      - percent_of_previous_value
      type: string
    CustomBinDimension:
      anyOf:
      - $ref: '#/components/schemas/FixedNumberBinDimension'
      - $ref: '#/components/schemas/FixedWidthBinDimension'
      - $ref: '#/components/schemas/CustomRangeBinDimension'
      - $ref: '#/components/schemas/CustomGroupBinDimension'
    ApiSuccess_ApiExecuteAsyncSqlQueryResults_:
      properties:
        results:
          $ref: '#/components/schemas/ApiExecuteAsyncSqlQueryResults'
  

# --- truncated at 32 KB (93 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/lightdash/refs/heads/main/openapi/lightdash-query-api-openapi.yml