> ## Documentation Index
> Fetch the complete documentation index at: https://domoinc-bradley-turek-pfilter-operators-reference.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Query with SQL

> Executes an SQL query on the specified dataset and returns results



## OpenAPI

````yaml /openapi/product/data-sets.yaml post /api/query/v1/execute/{datasetId}
openapi: 3.0.0
info:
  title: Datasets API
  version: v1
  description: >
    The Domo Datasets API provides a set of endpoints for managing, creating,
    and updating datasets within Domo. The API allows developers to execute SQL
    queries on datasets,

    manage access permissions, retrieve metadata, append rows, share datasets,
    and perform various dataset operations.
servers:
  - url: https://{instance}.domo.com
    description: Domo Instance
    variables:
      instance:
        default: example
        description: Your Domo instance name
security:
  - developerToken: []
paths:
  /api/query/v1/execute/{datasetId}:
    post:
      tags:
        - Datasets API
      summary: Query with SQL
      description: Executes an SQL query on the specified dataset and returns results
      parameters:
        - name: datasetId
          in: path
          required: true
          description: The ID of the dataset to query
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QueryRequest'
            example:
              sql: SELECT * FROM your_table WHERE column = 'value'
      responses:
        '200':
          description: Query results
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueryResponse'
              example:
                - column1: value 1
                  column2: value 2
                  column3: value 3
                - column1: value 1
                  column2: value 2
                  column3: value 3
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      x-codeSamples:
        - lang: HTTP
          source: |
            POST /api/query/v1/execute/{datasetId} HTTP/1.1
            Host: {instance}.domo.com
            X-DOMO-Developer-Token: {token}
            Content-Type: application/json

            {
              "sql": "SELECT * FROM your_table WHERE column = 'value'"
            }
components:
  schemas:
    QueryRequest:
      type: object
      required:
        - sql
      properties:
        sql:
          type: string
          description: The SQL statement to execute
          example: SELECT * FROM your_table WHERE column = 'value'
    QueryResponse:
      type: array
      items:
        type: object
        additionalProperties: true
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: A human-readable error message
  securitySchemes:
    developerToken:
      type: apiKey
      in: header
      name: X-DOMO-Developer-Token
      description: Developer token obtained from Domo

````