Skip to main content
POST
每个爬虫只需调用该端点一次。它返回已保存设置的 ID,例如 ash_lz3k9qw1,而不是设置内容本身。
自动自我修复的设置只能创建一次,无法通过 AI Flow API 修改。对同一个爬虫再次调用会返回 HTTP 409,并且没有用于读取、更新、删除或关闭这些设置的端点。请在 Bright Data Scraper Studio 的 Auto Self-Healing 标签页中修改或关闭自动自我修复。参见 Scraper Studio 自动自我修复
请求能否被接受,取决于以下四条规则:
  • 每个请求都必须发送 collectorenabledsr_thresholdtrigger_frequency。当 trigger_frequencyper_job 时,还需发送 min_inputs_threshold
  • 只能发送整数,小数会被拒绝。
  • 爬虫必须处于活跃状态。非活跃的爬虫会返回 HTTP 400 和 Collector must be active
  • notification_emails 中的每个地址都必须属于该爬虫所在账户下的用户。
auto_savefalse 时,请设置 notification_emails。此时修复作业会运行但不会保存代码,通知邮件是相关人员看到建议修复方案的唯一途径。

授权

Authorization
string
header
必填

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:

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

请求体

application/json
collector
string
必填

ID of the Scraper Studio scraper to configure, in the c_ format. Required.

示例:

"c_abc123"

enabled
boolean
必填

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.

示例:

true

sr_threshold
integer
必填

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.

必填范围: 1 <= x <= 70
示例:

50

trigger_frequency
enum<string>
必填

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.

可用选项:
per_day,
per_job
示例:

"per_day"

min_inputs_threshold
integer | null
默认值:10

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.

必填范围: x >= 10
示例:

100

auto_save
boolean
默认值:false

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.

示例:

true

cooldown_period
integer | null
默认值:3

Minimum hours to wait between consecutive Auto Self-Healing triggers for the scraper, 1 or higher. Send null for no cooldown. Defaults to 3.

必填范围: x >= 1
示例:

5

max_jobs_per_day
integer | null
默认值:8

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.

必填范围: 1 <= x <= 24
示例:

3

notification_emails
string[]

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.

示例:

响应

Auto Self-Healing settings saved

id
string

ID of the saved Auto Self-Healing settings.

示例:

"ash_lz3k9qw1"