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

# Cancel a running assessment

> Ask a running assessment to stop. The runner notices within about five seconds, tears its stream down the way a wall-clock timeout does, and finalises the run as `cancelled` -- keeping the findings and probes it had already produced, so a cancelled run is still worth reading. 202 means the request was recorded, not that the run has stopped: poll `GET /api/v1/run/{run_id}` until its status leaves `running`. Requires the same `test:run` scope as triggering, because stopping a run is the same authority over the same resource.

**A cancelled run is not a passing run.** `GET /api/v1/run/{run_id}` still computes a `min_severity` verdict once the status is terminal, and on a cancelled run that verdict covers only the categories in `categories_completed` -- a run stopped at minute two of twenty reads `pass` because it never got far enough to find anything. A pipeline that gates on the verdict alone must compare `categories_completed` against `categories_planned`, or treat `cancelled` as its own outcome.



## OpenAPI

````yaml /openapi.json post /api/v1/run/{run_id}/cancel
openapi: 3.1.0
info:
  title: Enoki External API
  description: >-
    Programmatic API for CI/CD integration. Authenticate with `Authorization:
    Bearer egk_...`.
  version: 0.1.0
servers:
  - url: https://api.enokilabs.ai
    description: Enoki API
security: []
paths:
  /api/v1/run/{run_id}/cancel:
    post:
      tags:
        - assessment
      summary: Cancel a running assessment
      description: >-
        Ask a running assessment to stop. The runner notices within about five
        seconds, tears its stream down the way a wall-clock timeout does, and
        finalises the run as `cancelled` -- keeping the findings and probes it
        had already produced, so a cancelled run is still worth reading. 202
        means the request was recorded, not that the run has stopped: poll `GET
        /api/v1/run/{run_id}` until its status leaves `running`. Requires the
        same `test:run` scope as triggering, because stopping a run is the same
        authority over the same resource.


        **A cancelled run is not a passing run.** `GET /api/v1/run/{run_id}`
        still computes a `min_severity` verdict once the status is terminal, and
        on a cancelled run that verdict covers only the categories in
        `categories_completed` -- a run stopped at minute two of twenty reads
        `pass` because it never got far enough to find anything. A pipeline that
        gates on the verdict alone must compare `categories_completed` against
        `categories_planned`, or treat `cancelled` as its own outcome.
      operationId: api_cancel_run_api_v1_run__run_id__cancel_post
      parameters:
        - name: run_id
          in: path
          required: true
          schema:
            type: string
            title: Run Id
        - name: Authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Bearer token with API key
            title: Authorization
          description: Bearer token with API key
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '404':
          description: Run not found
        '409':
          description: Run is not running, so there is nothing to cancel
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
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
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````