> ## Documentation Index
> Fetch the complete documentation index at: https://lightdash-mintlify-cccf65ca.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Get results

> Retrieves paginated results from a previously executed async query using its UUID



## OpenAPI

````yaml https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectUuid}/query/{queryUuid}
openapi: 3.0.0
info:
  title: Lightdash API
  version: 0.3233.0
  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: /
security: []
tags:
  - name: My Account
    description: These routes allow users to manage their own user account.
  - name: Organizations
    description: >-
      Each user is a member of a single organization. These routes allow users
      to manage their organization. Most actions are only available to admin
      users.
  - name: Projects
    description: >-
      Projects belong to a single organization. These routes allow users to
      manage their projects, browse content, and execute queries. Users inside
      an organization might have access to a project from an organization-level
      role or they might be granted access to a project directly.
  - name: Spaces
    description: >-
      Spaces allow you to organize charts and dashboards within a project. They
      also allow granular access to content by allowing you to create private
      spaces, which are only accessible to the creator and admins.
  - name: Roles & Permissions
    description: >-
      These routes allow users to manage roles and permissions for their
      organization.
    externalDocs:
      url: https://docs.lightdash.com/references/roles
  - 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:
      tags:
        - v2
        - Query
      summary: Get results
      description: >-
        Retrieves paginated results from a previously executed async query using
        its UUID
      operationId: getAsyncQueryResults
      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:
            type: number
            format: double
        - description: 'Number of results per page (default: 500, max: 5000)'
          in: query
          name: pageSize
          required: false
          schema:
            type: number
            format: double
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiGetAsyncQueryResultsResponse'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      security: []
components:
  schemas:
    ApiGetAsyncQueryResultsResponse:
      properties:
        results:
          $ref: '#/components/schemas/ApiGetAsyncQueryResults'
        status:
          type: string
          enum:
            - ok
          nullable: false
      required:
        - results
        - status
      type: object
    ApiErrorPayload:
      properties:
        error:
          properties:
            data:
              $ref: '#/components/schemas/AnyType'
              description: Optional data containing details of the error
            message:
              type: string
              description: A friendly message summarising the error
            name:
              type: string
              description: Unique name for the type of error
            statusCode:
              type: number
              format: integer
              description: HTTP status code
          required:
            - name
            - statusCode
          type: object
        status:
          type: string
          enum:
            - error
          nullable: false
      required:
        - error
        - status
      type: object
      description: |-
        The Error object is returned from the api any time there is an error.
        The message contains
    ApiGetAsyncQueryResults:
      anyOf:
        - $ref: '#/components/schemas/ReadyQueryResultsPage'
        - properties:
            queryUuid:
              type: string
            status:
              anyOf:
                - $ref: '#/components/schemas/QueryHistoryStatus.PENDING'
                - $ref: '#/components/schemas/QueryHistoryStatus.QUEUED'
                - $ref: '#/components/schemas/QueryHistoryStatus.EXECUTING'
                - $ref: '#/components/schemas/QueryHistoryStatus.CANCELLED'
          required:
            - queryUuid
            - status
          type: object
        - properties:
            erroredAt:
              type: string
              format: date-time
              nullable: true
            error:
              type: string
              nullable: true
            queryUuid:
              type: string
            status:
              anyOf:
                - $ref: '#/components/schemas/QueryHistoryStatus.ERROR'
                - $ref: '#/components/schemas/QueryHistoryStatus.EXPIRED'
          required:
            - error
            - queryUuid
            - status
          type: object
    AnyType:
      description: |-
        This AnyType is an alias for any
        The goal is to make it easier to identify any type in the codebase
        without having to eslint-disable all the time
        These are only used on legacy `any` types, don't use it for new types.
        This is added on a separate file to avoid circular dependencies.
    ReadyQueryResultsPage:
      allOf:
        - $ref: '#/components/schemas/ResultsPaginationMetadata_ResultRow_'
        - properties:
            pivotDetails:
              properties:
                passthroughDimensions:
                  items:
                    $ref: '#/components/schemas/GroupByColumn'
                  type: array
                originalColumns:
                  $ref: '#/components/schemas/ResultColumns'
                sortBy:
                  $ref: '#/components/schemas/SortBy'
                groupByColumns:
                  items:
                    $ref: '#/components/schemas/GroupByColumn'
                  type: array
                valuesColumns:
                  items:
                    $ref: '#/components/schemas/PivotValuesColumn'
                  type: array
                indexColumn:
                  anyOf:
                    - $ref: '#/components/schemas/PivotIndexColum'
                    - items:
                        $ref: '#/components/schemas/PivotIndexColum'
                      type: array
                totalColumnCount:
                  type: number
                  format: double
                  nullable: true
              required:
                - originalColumns
                - valuesColumns
                - totalColumnCount
              type: object
              nullable: true
            status:
              $ref: '#/components/schemas/QueryHistoryStatus.READY'
            metadata:
              $ref: '#/components/schemas/QueryResultsMetadata'
            rows:
              items:
                $ref: '#/components/schemas/ResultRow'
              type: array
            columns:
              $ref: '#/components/schemas/ResultColumns'
            queryUuid:
              type: string
          required:
            - pivotDetails
            - status
            - metadata
            - rows
            - columns
            - queryUuid
          type: object
    QueryHistoryStatus.PENDING:
      enum:
        - pending
      type: string
    QueryHistoryStatus.QUEUED:
      enum:
        - queued
      type: string
    QueryHistoryStatus.EXECUTING:
      enum:
        - executing
      type: string
    QueryHistoryStatus.CANCELLED:
      enum:
        - cancelled
      type: string
    QueryHistoryStatus.ERROR:
      enum:
        - error
      type: string
    QueryHistoryStatus.EXPIRED:
      enum:
        - expired
      type: string
    ResultsPaginationMetadata_ResultRow_:
      allOf:
        - allOf:
            - $ref: '#/components/schemas/KnexPaginateArgs'
            - properties:
                totalResults:
                  type: number
                  format: double
                totalPageCount:
                  type: number
                  format: double
              required:
                - totalResults
                - totalPageCount
              type: object
        - properties:
            previousPage:
              type: number
              format: double
            nextPage:
              type: number
              format: double
          type: object
    GroupByColumn:
      properties:
        reference:
          type: string
      required:
        - reference
      type: object
    ResultColumns:
      $ref: '#/components/schemas/Record_string.ResultColumn_'
    SortBy:
      items:
        $ref: '#/components/schemas/VizSortBy'
      type: array
    PivotValuesColumn:
      properties:
        columnIndex:
          type: number
          format: double
        pivotValues:
          items:
            properties:
              formatted:
                type: string
              value: {}
              referenceField:
                type: string
            required:
              - value
              - referenceField
            type: object
          type: array
        aggregation:
          $ref: '#/components/schemas/VizAggregationOptions'
        pivotColumnName:
          type: string
        referenceField:
          type: string
      required:
        - pivotValues
        - aggregation
        - pivotColumnName
        - referenceField
      type: object
    PivotIndexColum:
      properties:
        type:
          $ref: '#/components/schemas/VizIndexType'
        reference:
          type: string
      required:
        - type
        - reference
      type: object
    QueryHistoryStatus.READY:
      enum:
        - ready
      type: string
    QueryResultsMetadata:
      properties:
        performance:
          $ref: '#/components/schemas/QueryResultsPerformance'
      required:
        - performance
      type: object
    ResultRow:
      $ref: '#/components/schemas/Record_string._value-ResultValue__'
    KnexPaginateArgs:
      properties:
        page:
          type: number
          format: double
        pageSize:
          type: number
          format: double
      required:
        - page
        - pageSize
      type: object
    Record_string.ResultColumn_:
      properties: {}
      additionalProperties:
        $ref: '#/components/schemas/ResultColumn'
      type: object
      description: Construct a type with a set of properties K of type T
    VizSortBy:
      properties:
        pivotValues:
          items:
            $ref: '#/components/schemas/PivotSortAnchor'
          type: array
          description: Pins the row-sort anchor to a specific pivot column.
        nullsFirst:
          type: boolean
        direction:
          $ref: '#/components/schemas/SortByDirection'
        reference:
          type: string
      required:
        - direction
        - reference
      type: object
    VizAggregationOptions:
      enum:
        - sum
        - count
        - avg
        - min
        - max
        - any
      type: string
    VizIndexType:
      enum:
        - time
        - category
      type: string
    QueryResultsPerformance:
      properties:
        queueTimeMs:
          type: number
          format: double
          nullable: true
        resultsPageExecutionMs:
          type: number
          format: double
        initialQueryExecutionMs:
          type: number
          format: double
          nullable: true
      required:
        - queueTimeMs
        - resultsPageExecutionMs
        - initialQueryExecutionMs
      type: object
    Record_string._value-ResultValue__:
      properties: {}
      additionalProperties:
        properties:
          value:
            $ref: '#/components/schemas/ResultValue'
        required:
          - value
        type: object
      type: object
      description: Construct a type with a set of properties K of type T
    ResultColumn:
      properties:
        type:
          $ref: '#/components/schemas/DimensionType'
        reference:
          type: string
      required:
        - type
        - reference
      type: object
    PivotSortAnchor:
      properties:
        value:
          anyOf:
            - type: string
            - type: number
              format: double
            - type: boolean
          nullable: true
        reference:
          type: string
      required:
        - value
        - reference
      type: object
      description: |-
        Coordinates of a single pivot column, used to anchor a row sort to that
        specific column when results are pivoted.
    SortByDirection:
      enum:
        - ASC
        - DESC
      type: string
    ResultValue:
      properties:
        formatted:
          type: string
        raw: {}
      required:
        - formatted
        - raw
      type: object
    DimensionType:
      enum:
        - string
        - number
        - timestamp
        - date
        - boolean
      type: string

````