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

# Stop Scan

> Stop a running scan by cancelling the Celery task.

**Required Scope:** `write:scan`
**Security:** Scan ownership validation through repository

Args:
    scan_id: Scan ID to stop
    auth: Authentication context
    
Returns:
    Success message with scan status
    
Raises:
    401: Unauthorized (invalid token/API key)
    403: Forbidden (insufficient scope or scan not owned by user's org)
    404: Not found (scan not found)
    400: Bad request (scan not running)



## OpenAPI

````yaml api-reference/openapi.json post /api/scans/{scan_id}/stop
openapi: 3.1.0
info:
  title: Enforster AI API
  description: Enforster AI API for code analysis and security scanning.
  version: 1.8.0
servers: []
security:
  - ApiKeyAuth: []
  - BearerAuth: []
paths:
  /api/scans/{scan_id}/stop:
    post:
      summary: Stop Scan
      description: |-
        Stop a running scan by cancelling the Celery task.

        **Required Scope:** `write:scan`
        **Security:** Scan ownership validation through repository

        Args:
            scan_id: Scan ID to stop
            auth: Authentication context
            
        Returns:
            Success message with scan status
            
        Raises:
            401: Unauthorized (invalid token/API key)
            403: Forbidden (insufficient scope or scan not owned by user's org)
            404: Not found (scan not found)
            400: Bad request (scan not running)
      operationId: stop_scan_api_scans__scan_id__stop_post
      parameters:
        - name: scan_id
          in: path
          required: true
          schema:
            type: string
            title: Scan Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Stop Scan Api Scans  Scan Id  Stop Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - ApiKeyAuth: []
        - BearerAuth: []
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Use an API key in the X-API-Key header.
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Clerk JWT bearer token.

````