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

# Cancel Query Export

> Cancel an in-progress background export. The run is marked cancelled synchronously, the export stream is aborted mid-flight (the partial upload is discarded), and the reserved credits are refunded. A run that has already completed or failed is returned unchanged.



## OpenAPI

````yaml POST /query/{id}/cancel
openapi: 3.0.0
info:
  title: Cloudglue API
  description: API for Cloudglue
  license:
    name: Apache License 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  version: 0.7.15
servers:
  - url: https://api.cloudglue.dev/v1
security:
  - bearerAuth: []
paths:
  /query/{id}/cancel:
    post:
      tags:
        - Query
      summary: Cancel a background export
      description: >-
        Cancel an in-progress background export. The run is marked cancelled
        synchronously, the export stream is aborted mid-flight (the partial
        upload is discarded), and the reserved credits are refunded. A run that
        has already completed or failed is returned unchanged.
      operationId: cancelQueryExport
      parameters:
        - name: id
          in: path
          required: true
          description: The ID of the query export to cancel
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: >-
            The query result, with status 'cancelled' when the cancel took
            effect (or the run's real status if it had already finished)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueryResult'
        '404':
          description: Query result not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    QueryResult:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Query result ID
        object:
          type: string
          enum:
            - query_result
          description: Object type identifier
        status:
          type: string
          enum:
            - completed
            - failed
            - in_progress
            - cancelled
          description: >-
            Current status of the query. Synchronous queries return 'completed'
            or 'failed'.
        created_at:
          type: number
          description: Unix timestamp of when the query was created
        collections:
          type: array
          items:
            type: string
            format: uuid
          description: Collection IDs the query ran over
        sql:
          type: string
          nullable: true
          description: The effective SQL that was executed (echoes the request's sql)
        columns:
          type: array
          nullable: true
          items:
            type: object
            properties:
              name:
                type: string
                description: Column name
              type:
                type: string
                description: SQL type of the column
          description: Result columns in select order
        rows:
          type: array
          nullable: true
          items:
            type: object
            additionalProperties: true
          description: Result rows as objects keyed by column name
        row_count:
          type: integer
          description: Number of rows returned
        truncated:
          type: boolean
          description: >-
            Whether the result was truncated by max_rows or the stored-result
            size cap
        dry_run:
          type: boolean
          description: >-
            True when the query was only validated/compiled (dry_run request):
            columns holds the output schema and rows is null.
        usage:
          $ref: '#/components/schemas/QueryUsage'
          nullable: true
          description: Dataset and timing usage for the run
        error:
          type: object
          nullable: true
          properties:
            code:
              type: string
            message:
              type: string
          description: Error details if the query failed
        format:
          type: string
          nullable: true
          enum:
            - json
            - csv
            - jsonl
          description: The result format ('csv'/'jsonl' for background exports)
        download_url:
          type: string
          nullable: true
          description: >-
            Signed URL to download a completed background export. Valid for 24
            hours and not refreshed on read (re-run the export if it expires);
            null for synchronous runs and until a background export completes
        download_expires_at:
          type: number
          nullable: true
          description: Unix timestamp (ms) when download_url expires
        output_bytes:
          type: integer
          nullable: true
          description: Compressed size of a completed background export, in bytes
    Error:
      required:
        - error
      type: object
      properties:
        error:
          type: string
    QueryUsage:
      type: object
      properties:
        files_scanned:
          type: integer
          description: Number of files loaded into the files virtual table
        entity_rows:
          type: integer
          description: Number of rows loaded into the entities virtual table
        segment_entity_rows:
          type: integer
          description: Number of rows loaded into the segment_entities virtual table
        engine_ms:
          type: number
          description: SQL execution time in milliseconds
        total_ms:
          type: number
          description: Total processing time in milliseconds, including dataset preparation
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````