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

# Cancel Scan

> Cancel a pending or running scan.

Sets the scan status to 'cancelled' immediately. The Celery worker checks
this flag at each repository boundary and stops gracefully.

Stays member-permitted as an operational action (mirrors ``trigger_scan``'s
note); only read-only viewers are excluded (repricing B3).



## OpenAPI

````yaml /openapi.json post /api/v1/scans/{scan_id}/cancel
openapi: 3.1.0
info:
  description: Change Impact Engine for multi-repo systems
  title: Riftmap
  version: 1.12.3
servers: []
security: []
paths:
  /api/v1/scans/{scan_id}/cancel:
    post:
      tags:
        - scans
      summary: Cancel Scan
      description: >-
        Cancel a pending or running scan.


        Sets the scan status to 'cancelled' immediately. The Celery worker
        checks

        this flag at each repository boundary and stops gracefully.


        Stays member-permitted as an operational action (mirrors
        ``trigger_scan``'s

        note); only read-only viewers are excluded (repricing B3).
      operationId: cancel_scan_api_v1_scans__scan_id__cancel_post
      parameters:
        - in: path
          name: scan_id
          required: true
          schema:
            format: uuid
            title: Scan Id
            type: string
        - in: header
          name: X-Workspace-Id
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Workspace-Id
        - in: cookie
          name: riftmap_access
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Riftmap Access
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScanResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - APIKeyHeader: []
        - HTTPBearer: []
components:
  schemas:
    ScanResponse:
      description: Full scan record.
      properties:
        completed_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Completed At
        connected_org_id:
          format: uuid
          title: Connected Org Id
          type: string
        created_at:
          format: date-time
          title: Created At
          type: string
        errors:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Errors
        id:
          format: uuid
          title: Id
          type: string
        scan_type:
          title: Scan Type
          type: string
        scanned_repos:
          title: Scanned Repos
          type: integer
        skipped_repos:
          title: Skipped Repos
          type: integer
        started_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Started At
        status:
          title: Status
          type: string
        total_repos:
          title: Total Repos
          type: integer
        updated_at:
          format: date-time
          title: Updated At
          type: string
      required:
        - id
        - connected_org_id
        - status
        - scan_type
        - total_repos
        - scanned_repos
        - skipped_repos
        - errors
        - started_at
        - completed_at
        - created_at
        - updated_at
      title: ScanResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    APIKeyHeader:
      in: header
      name: X-API-Key
      type: apiKey
    HTTPBearer:
      description: API key as Bearer token (rfm_live_... prefix)
      scheme: bearer
      type: http

````