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

# Stop Execution

> Request cancellation of a running execution.

**Required Role:** OPERATOR, ADMIN, or OWNER

This sets the execution status to CANCELLED. The worker will detect
this change (polls every 10 seconds) and gracefully stop the RClone
process using SIGTERM.

**Note:** Cancellation is not instant. The worker needs to:
1. Detect the status change (up to 10 seconds)
2. Send SIGTERM to RClone process
3. Wait for graceful shutdown (up to 30 seconds)
4. Upload partial logs to object storage
5. Update final execution status

Can only cancel executions in PENDING or RUNNING status.



## OpenAPI

````yaml POST /v1/teams/{team_id}/tasks/{task_id}/executions/{execution_id}/stop
openapi: 3.1.0
info:
  title: Data Raven API
  description: Cloud-to-cloud data transfer platform powered by RClone
  version: 0.5.0
servers: []
security: []
paths:
  /v1/teams/{team_id}/tasks/{task_id}/executions/{execution_id}/stop:
    post:
      tags:
        - Executions
      summary: Cancel Execution
      description: |-
        Request cancellation of a running execution.

        **Required Role:** OPERATOR, ADMIN, or OWNER

        This sets the execution status to CANCELLED. The worker will detect
        this change (polls every 10 seconds) and gracefully stop the RClone
        process using SIGTERM.

        **Note:** Cancellation is not instant. The worker needs to:
        1. Detect the status change (up to 10 seconds)
        2. Send SIGTERM to RClone process
        3. Wait for graceful shutdown (up to 30 seconds)
        4. Upload partial logs to object storage
        5. Update final execution status

        Can only cancel executions in PENDING or RUNNING status.
      operationId: >-
        cancel_execution_v1_teams__team_id__tasks__task_id__executions__execution_id__stop_post
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Task Id
        - name: execution_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Execution Id
        - name: team_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Team Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExecutionResponse'
        '400':
          description: Execution cannot be cancelled (already completed)
        '404':
          description: Execution not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    ExecutionResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        task_id:
          type: string
          format: uuid
          title: Task Id
        execution_number:
          type: integer
          title: Execution Number
        trigger:
          $ref: '#/components/schemas/ExecutionTrigger'
        status:
          $ref: '#/components/schemas/ExecutionStatus'
        is_dry_run:
          type: boolean
          title: Is Dry Run
        queued_at:
          type: string
          format: date-time
          title: Queued At
        started_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Started At
        completed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Completed At
        duration_seconds:
          anyOf:
            - type: integer
            - type: 'null'
          title: Duration Seconds
        stats:
          additionalProperties: true
          type: object
          title: Stats
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Message
        rclone_exit_code:
          anyOf:
            - type: integer
            - type: 'null'
          title: Rclone Exit Code
        log_file_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Log File Url
      type: object
      required:
        - id
        - task_id
        - execution_number
        - trigger
        - status
        - is_dry_run
        - queued_at
      title: ExecutionResponse
      description: Base response schema for task execution.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ExecutionTrigger:
      type: string
      enum:
        - manual
        - scheduled
        - api
      title: ExecutionTrigger
      description: Execution trigger types.
    ExecutionStatus:
      type: string
      enum:
        - pending
        - running
        - completed
        - failed
        - cancelled
        - dry_run_completed
      title: ExecutionStatus
      description: Runtime execution status.
    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
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````