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

# Validate Query



## OpenAPI

````yaml https://api.truestate.io/openapi.json post /data/validate/
openapi: 3.1.0
info:
  title: TrueState Backend API
  summary: >-
    TrueState is an AI platform for business users to create high-impact AI
    solutions.
  description: >

    This **[TrueState](https://www.truestate.io/)** backend API allows our
    clients to automate and more powerfully retrieve and modify data from the
    TrueState platform.


    Example use cases include:


    - Accessing embeddings for a dataset.

    - Automating the process of dataset creation and model retraining as your
    data changes.

    - Much more.


    Our backend is built using the [FastAPI](https://fastapi.tiangolo.com/)
    framework in python

    using [Auth0](https://auth0.com/) and [Client API
    Keys](https://www.truestate.io/dawn/docs) for internal an external
    authentication, respectively.

    Our backend is designed to be secure, scalable, easy to use and well
    documented _(each router with its own linked docs page)_.

    Clients can only access data from their own organisation, as setup in Auth0
    our the Client API Keys. See how
    **[here](https://www.truestate.io/dawn/docs)**.


    **PS**: You can view this API documentation in either
    **[Swagger](swagger/docs)** or **[Redoc](redoc/)**, but only the swagger
    lets you test calls.
  contact:
    name: True State Support
    url: https://www.truestate.io/dawn/docs
    email: support@truestate.io
  license:
    name: Private
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  version: 0.13.95
servers: []
security: []
paths:
  /data/validate/:
    post:
      tags:
        - data
      summary: Validate Query
      operationId: validate_query_data_validate__post
      parameters:
        - name: Api-key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Api-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QueryRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/src__routers__data__ValidateQueryResponse'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    QueryRequest:
      properties:
        query:
          type: string
          title: Query
          description: The SELECT SQL query to fetch the data.
        with_stats:
          type: boolean
          title: With Stats
          description: >-
            When true, respond with a stats envelope {rows, row_count,
            truncated, execution_ms} instead of a bare row list. `truncated` is
            exact (one extra row is probed), so clients computing aggregates can
            tell a capped result from a complete one.
          default: false
        folder_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Folder Id
          description: >-
            Workspace folder context used as a preference when resolving
            unqualified table names across the workspace.
      type: object
      required:
        - query
      title: QueryRequest
      examples:
        - query: SELECT * FROM customers WHERE customer_id IN (1,2,3)
    src__routers__data__ValidateQueryResponse:
      properties:
        ok:
          type: boolean
          title: Ok
          default: true
        query:
          type: string
          title: Query
          description: >-
            SQL with table references rewritten to fully qualified BigQuery
            names.
        warnings:
          items:
            type: string
          type: array
          title: Warnings
        resolved_datasets:
          items:
            $ref: '#/components/schemas/ResolvedDatasetRead'
          type: array
          title: Resolved Datasets
      type: object
      required:
        - query
      title: ValidateQueryResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ResolvedDatasetRead:
      properties:
        written_ref:
          type: string
          title: Written Ref
        workspace_ref:
          type: string
          title: Workspace Ref
        dataset_id:
          type: string
          format: uuid
          title: Dataset Id
        dataset_name:
          type: string
          title: Dataset Name
        bigquery_table_ref:
          type: string
          title: Bigquery Table Ref
      type: object
      required:
        - written_ref
        - workspace_ref
        - dataset_id
        - dataset_name
        - bigquery_table_ref
      title: ResolvedDatasetRead
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````