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

# 取消自我修复任务

> 使用 Bright Data Scraper Studio AI Flow API 按爬虫 ID 取消正在运行的自我修复任务。取消请求被接受时返回 200 OK。

<Warning>
  用于取消自我修复任务的 API 密钥必须属于启动该自我修复任务的同一用户。
</Warning>


## OpenAPI

````yaml api-reference/cn-web-scraper-ide-rest-api POST /dca/collectors/{collector_id}/cancel_automation
openapi: 3.1.0
info:
  title: Brightdata API
  description: 用于与数据集市场交互的 API
  version: 1.0.0
servers:
  - url: https://api.brightdata.com
security:
  - bearerAuth: []
paths:
  /dca/collectors/{collector_id}/cancel_automation:
    post:
      summary: 取消自我修复任务
      description: >-
        取消 Scraper Studio 爬虫上正在运行的自我修复任务。发送 `{"type": "refactor"}`
        即可取消自我修复任务。`Authorization` 请求头中的 API 密钥必须属于启动该自我修复任务的同一用户。
      operationId: cancelScraperStudioSelfHealingJob
      parameters:
        - name: collector_id
          in: path
          description: 存在正在运行的自我修复任务的爬虫 ID。
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelAutomationRequest'
      responses:
        '200':
          description: 已接受自我修复任务取消请求
components:
  schemas:
    CancelAutomationRequest:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          description: 要取消的自动化类型。使用 `refactor` 取消自我修复任务。
          example: refactor
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        在 Authorization 头中使用您的 Bright Data API Key 作为 Bearer token。


        **认证方法:**

        1. 从 Bright Data 账户设置获取您的 API Key:
        https://brightdata.com/cp/setting/users

        2. 在请求的 Authorization 头中包含 API Key

        3. 格式: `Authorization: Bearer YOUR_API_KEY`


        **示例:**

        ```

        Authorization: Bearer
        b5648e1096c6442f60a6c4bbbe73f8d2234d3d8324554bd6a7ec8f3f251f07df

        ```


        了解如何获取 Bright Data API Key:
        https://docs.brightdata.com/cn/api-reference/authentication#如何生成新的-api-key？
      bearerFormat: API Key

````