> ## 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.

# Enable Auto Self-Healing

> Use the Bright Data Scraper Studio AI Flow API to enable Auto Self-Healing on a scraper and set its success rate, frequency, cooldown and daily job limits.

Call this endpoint once per scraper. It returns the ID of the saved settings, such as `ash_lz3k9qw1`, not the settings themselves.

<Warning>
  Auto Self-Healing settings are created once and cannot be changed through the AI Flow API. A second call for the same scraper returns HTTP 409, and there is no endpoint to read, update, delete or disable them. Edit or turn off Auto Self-Healing in the **Auto Self-Healing** tab of Bright Data Scraper Studio. See [Scraper Studio Auto Self-Healing](/products/scraper-studio/auto-self-healing).
</Warning>

Four rules decide whether a request is accepted:

* Send `collector`, `enabled`, `sr_threshold` and `trigger_frequency` on every request. Add `min_inputs_threshold` when `trigger_frequency` is `per_job`.
* Send whole numbers. Decimals are rejected.
* The scraper must be active. An inactive one returns HTTP 400 with `Collector must be active`.
* Every address in `notification_emails` must belong to a user on the scraper's account.

Set `notification_emails` when `auto_save` is `false`. The healing job runs but does not save its code, and the notification email is the only way a person sees the suggested fix.


## OpenAPI

````yaml api-reference/web-scraper-ide-rest-api POST /dca/auto_self_healing/create
openapi: 3.1.0
info:
  title: Brightdata API
  description: API for interaction with datasets marketplace
  version: 1.0.0
servers:
  - url: https://api.brightdata.com
security:
  - bearerAuth: []
paths:
  /dca/auto_self_healing/create:
    post:
      summary: Enable Auto Self-Healing
      description: >-
        Turn on [Auto Self-Healing](/products/scraper-studio/auto-self-healing)
        for a Scraper Studio scraper and set the trigger rules that decide when
        a healing job starts. Auto Self-Healing starts only for the
        `crawl_error`, `parse_error`, `bad_cmd_arg`, `dead_page`, `bad_input`
        and `bad_navigate` error codes. Auto Self-Healing jobs do not cost
        credits.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AutoSelfHealingCreateRequest'
            examples:
              required_only:
                summary: Required fields only
                value:
                  collector: c_abc123
                  enabled: true
                  sr_threshold: 50
                  trigger_frequency: per_day
              per_day:
                summary: Check once per day
                value:
                  collector: c_abc123
                  enabled: true
                  sr_threshold: 50
                  trigger_frequency: per_day
                  auto_save: false
                  cooldown_period: 5
                  max_jobs_per_day: 3
                  notification_emails:
                    - data-team@example.com
              per_job:
                summary: Check on every job
                value:
                  collector: c_abc123
                  enabled: true
                  sr_threshold: 50
                  trigger_frequency: per_job
                  min_inputs_threshold: 100
                  auto_save: true
                  cooldown_period: 5
                  max_jobs_per_day: 3
      responses:
        '200':
          description: Auto Self-Healing settings saved
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: ID of the saved Auto Self-Healing settings.
                    example: ash_lz3k9qw1
        '400':
          description: >-
            A required field is missing, a value is invalid, or the collector is
            not active
          content:
            application/json:
              schema:
                type: object
                properties:
                  validation_errors:
                    type: array
                    items:
                      type: string
                example:
                  validation_errors:
                    - Collector must be active
        '403':
          description: >-
            The collector is a managed collector that does not support Auto
            Self-Healing
        '404':
          description: No collector with that ID exists on this account
          content:
            application/json:
              schema:
                type: string
                example: collector_not_found
        '409':
          description: Auto Self-Healing settings already exist for this collector
components:
  schemas:
    AutoSelfHealingCreateRequest:
      type: object
      required:
        - collector
        - enabled
        - sr_threshold
        - trigger_frequency
      properties:
        collector:
          type: string
          description: >-
            ID of the Scraper Studio scraper to configure, in the `c_` format.
            Required.
          example: c_abc123
        enabled:
          type: boolean
          description: >-
            `true` turns Auto Self-Healing on for the scraper, `false` saves the
            settings with Auto Self-Healing off. Required. Send `false` here to
            keep it off, because this endpoint cannot be called a second time to
            disable it later.
          example: true
        sr_threshold:
          type: integer
          minimum: 1
          maximum: 70
          description: >-
            Success rate percentage below which Auto Self-Healing triggers, from
            `1` to `70`. At `50`, a healing job can start once the scraper's
            success rate falls below 50 percent. Required, with no default.
            Decimals are rejected.
          example: 50
        trigger_frequency:
          type: string
          enum:
            - per_day
            - per_job
          description: >-
            How often Scraper Studio checks the trigger rules. `per_day` checks
            once per day. `per_job` checks on every job run. Required. Any other
            value returns HTTP 400.
          example: per_day
        min_inputs_threshold:
          type:
            - integer
            - 'null'
          minimum: 10
          default: 10
          description: >-
            Minimum number of job inputs required before Auto Self-Healing
            triggers, `10` or higher. A job with fewer inputs does not start a
            healing job. Required with `trigger_frequency: per_job`. Optional
            with `per_day`, which does not use it: the server stores `10` when
            the field is omitted, and `null` is accepted.
          example: 100
        auto_save:
          type: boolean
          default: false
          description: >-
            When `true`, any successful healing job saves the newly extracted
            code to production and updates the scraper's template version, with
            no human review. When `false`, the healing job runs but the
            generated code is not saved. Defaults to `false`.
          example: true
        cooldown_period:
          type:
            - integer
            - 'null'
          minimum: 1
          default: 3
          description: >-
            Minimum hours to wait between consecutive Auto Self-Healing triggers
            for the scraper, `1` or higher. Send `null` for no cooldown.
            Defaults to `3`.
          example: 5
        max_jobs_per_day:
          type:
            - integer
            - 'null'
          minimum: 1
          maximum: 24
          default: 8
          description: >-
            Maximum number of Auto Self-Healing jobs allowed for the scraper in
            one day, from `1` to `24`. Send `null` for no daily limit. Defaults
            to `8`. A failed healing job still counts toward this limit and
            still starts the cooldown period.
          example: 3
        notification_emails:
          type: array
          items:
            type: string
          default: []
          description: >-
            Email addresses that receive the Auto Self-Healing notifications for
            this scraper. Each address must belong to a user on the collector's
            account. Defaults to an empty array, which leaves nobody to review a
            fix when `auto_save` is `false`.
          example:
            - data-team@example.com
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Use your Bright Data API Key as a Bearer token in the Authorization
        header.


        **How to authenticate:**

        1. Obtain your API Key from the Bright Data account settings at
        https://brightdata.com/cp/setting/users

        2. Include the API Key in the Authorization header of your requests

        3. Format: `Authorization: Bearer YOUR_API_KEY`


        **Example:**

        ```

        Authorization: Bearer
        b5648e1096c6442f60a6c4bbbe73f8d2234d3d8324554bd6a7ec8f3f251f07df

        ```


        Learn how to get your Bright Data API key:
        https://docs.brightdata.com/api-reference/authentication
      bearerFormat: API Key

````