curl --request PUT \
--url https://api.brightdata.com/billing/autorecharge/dataset \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"enabled": true,
"pmethod_id": "64f0c2a1e4b0a1b2c3d4e5f6"
}
'{
"available": true,
"enabled": true,
"pmethod_id": "<string>"
}{
"error": "<string>",
"error_code": "invalid_param"
}User authentication is requiredYour API key lacks the required permissions for this action. You can change your token permissions at https://brightdata.com/cp/setting/users<string>账户与状态
设置数据集自动充值
使用 Bright Data 账号管理 API 的 PUT /billing/autorecharge/dataset 开启或关闭数据集自动充值,并选择扣款的支付方式。
PUT
/
billing
/
autorecharge
/
dataset
curl --request PUT \
--url https://api.brightdata.com/billing/autorecharge/dataset \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"enabled": true,
"pmethod_id": "64f0c2a1e4b0a1b2c3d4e5f6"
}
'{
"available": true,
"enabled": true,
"pmethod_id": "<string>"
}{
"error": "<string>",
"error_code": "invalid_param"
}User authentication is requiredYour API key lacks the required permissions for this action. You can change your token permissions at https://brightdata.com/cp/setting/users<string>PUT /billing/autorecharge/dataset 端点开启或关闭 Bright Data 账户的数据集自动充值,并设置扣款的支付方式。常规自动充值设置不会改变。
将您的 API key 粘贴到授权字段中。要获取 API key,请创建账号,并查看如何生成新的 API key?
此端点需要哪种 API key 权限?
PUT /billing/autorecharge/dataset 需要 billing.write.pay.settings 权限。具有管理员或财务权限级别的 API key 拥有该权限。缺少该权限时,端点返回 HTTP 403 和纯文本消息。请在账户设置中管理 API key 权限。
如何开启数据集自动充值?
发送enabled: true 并附带 pmethod_id。数据集自动充值不接受 amount:
- 从
GET /billing/pmethods获取autorecharge_supported为true的支付方式 ID。 - 发送请求:
curl -X PUT "https://api.brightdata.com/billing/autorecharge/dataset" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"enabled": true, "pmethod_id": "64f0c2a1e4b0a1b2c3d4e5f6"}'
available、enabled 和 pmethod_id。当可使用常规自动充值且账户拥有数据集 zone 时,数据集自动充值可用。请在 GET /billing/autorecharge 中查看 dataset.available。
数据集自动充值扣款多少?
仅当数据集快照构建开始且余额不足以支付快照费用时,数据集自动充值才会扣款。扣款在快照构建开始时进行,金额为 $50 与该快照所差余额两者中的较大值:| 快照所差余额 | 扣款 |
|---|---|
| $120 | $120 |
| $20 | $50 |
如何关闭数据集自动充值?
只发送enabled: false,不附带其他字段:
curl -X PUT "https://api.brightdata.com/billing/autorecharge/dataset" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"enabled": false}'
available 为 false。关闭数据集自动充值不会关闭常规自动充值。在 enabled: false 时发送 pmethod_id 会返回 invalid_param。
PUT 如何更新设置?
请求体包含数据集部分的全部设置,请求是幂等的。重复发送相同的请求体,设置保持不变。此端点可能返回哪些错误?
HTTP 400 和not_eligible 的 HTTP 403 返回包含 error 和 error_code 的 JSON:
| HTTP 状态码 | error_code | 原因 |
|---|---|---|
| 400 | invalid_param | 类型错误、未知字段、enabled: true 时缺少 pmethod_id,或 enabled: false 时发送了该字段 |
| 400 | pmethod_not_found | 账户中没有此 ID 的已激活支付方式 |
| 400 | pmethod_not_supported | 该支付方式不支持自动充值或尚未确认 |
| 400 | payment_required | 账户没有已完成的付款 |
| 403 | not_eligible | 账户不可使用自动充值(available: false),而请求中包含 enabled: true |
相关端点
授权
在 Authorization 头中使用您的 Bright Data API Key 作为 Bearer token。
认证方法:
- 从 Bright Data 账户设置获取您的 API Key: https://brightdata.com/cp/setting/users
- 在请求的 Authorization 头中包含 API Key
- 格式:
Authorization: Bearer YOUR_API_KEY
示例:
Authorization: Bearer b5648e1096c6442f60a6c4bbbe73f8d2234d3d8324554bd6a7ec8f3f251f07df
了解如何获取 Bright Data API Key: https://docs.brightdata.com/cn/api-reference/authentication#如何生成新的-api-key?
请求体
application/json
此页面对您有帮助吗?