> ## 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 Metadata Import Run

> Cancel an in-flight run. Files already imported by the run are kept. Cancelling an already-finished run is a no-op that returns the current state.



## OpenAPI

````yaml POST /collections/{collection_id}/imports/{import_id}/runs/{run_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.17
servers:
  - url: https://api.cloudglue.dev/v1
security:
  - bearerAuth: []
paths:
  /collections/{collection_id}/imports/{import_id}/runs/{run_id}/cancel:
    post:
      tags:
        - Metadata Imports
      summary: Cancel a metadata import run
      description: >-
        Cancel an in-flight run. Files already imported by the run are kept.
        Cancelling an already-finished run is a no-op that returns the current
        state.
      operationId: cancelMetadataImportRun
      parameters:
        - name: collection_id
          in: path
          required: true
          description: The ID of the metadata collection
          schema:
            type: string
            format: uuid
        - name: import_id
          in: path
          required: true
          description: The ID of the metadata import
          schema:
            type: string
            format: uuid
        - name: run_id
          in: path
          required: true
          description: The ID of the import run
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: The run in its post-cancel state
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MetadataImportRun'
        '404':
          description: Collection, import, or run not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: An unexpected error occurred on the server
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    MetadataImportRun:
      type: object
      description: One execution of a metadata import.
      properties:
        object:
          type: string
          enum:
            - metadata_import_run
        id:
          type: string
          format: uuid
        import_id:
          type: string
          format: uuid
        mode:
          type: string
          enum:
            - append
            - refresh
          description: >-
            append imports new files and retries previously-failed ones; refresh
            re-imports everything the filters match
        delete_missing:
          type: boolean
          description: >-
            Whether this run sweeps files this import previously brought in that
            the source no longer returns (refresh runs only)
        status:
          type: string
          enum:
            - pending
            - processing
            - completed
            - failed
            - cancelled
        progress:
          $ref: '#/components/schemas/MetadataImportRunProgress'
        error:
          type: string
          nullable: true
          description: User-facing failure reason when status is failed
        started_at:
          type: number
          nullable: true
          description: Unix timestamp in milliseconds
        completed_at:
          type: number
          nullable: true
          description: Unix timestamp in milliseconds
        created_at:
          type: number
          description: Unix timestamp in milliseconds
        max_files:
          type: integer
          nullable: true
          description: The cap this run executed with; null means unbounded
        include_thumbnails:
          type: boolean
          description: Whether this run copied poster thumbnails
    Error:
      required:
        - error
      type: object
      properties:
        error:
          type: string
    MetadataImportRunProgress:
      type: object
      description: >-
        Best-effort progress counters for display. Run completion is decided
        from the actual per-file indexing state, never from these counters, so
        they can drift slightly under retries without affecting correctness.
      properties:
        pages_listed:
          type: integer
          description: Connector list pages fetched
        files_listed:
          type: integer
          description: Source files seen across all filter sets
        files_created:
          type: integer
          description: New Cloudglue files created
        files_updated:
          type: integer
          description: Existing files re-imported (refresh mode)
        files_skipped:
          type: integer
          description: Already-imported files left untouched (append mode)
        files_failed:
          type: integer
          description: Files whose metadata indexing failed
        files_queued:
          type: integer
          description: >-
            Files handed to indexing — the denominator for progress (indexed +
            failed settle against it)
        files_indexed:
          type: integer
          description: Files whose metadata finished indexing
        files_removed:
          type: integer
          description: Files removed by the delete-missing sweep
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````