> ## 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 账号管理 API 的 GET /billing/autorecharge 读取账户的常规自动充值和数据集自动充值设置，包括充值金额、触发阈值和金额限制。

`GET /billing/autorecharge` 端点返回 Bright Data 账户的自动充值设置：`regular` 部分、`dataset` 部分，以及账户的自动充值是否被暂停（`suspended`）。

> [!TIP]
>
> 将您的 API key 粘贴到授权字段中。要获取 API key，请[创建账号](https://www.bright.cn/?hs_signup=1\&utm_source=docs\&utm_campaign=playground)，并查看[如何生成新的 API key？](https://docs.brightdata.com/cn/api-reference/authentication.md#如何生成新的-api-key？)

## 此端点需要哪种 API key 权限？

`GET /billing/autorecharge` 需要 `billing.read` 权限。具有**管理员**或**财务**[权限级别](https://docs.brightdata.com/cn/api-reference/authentication.md#api-key-拥有哪些权限级别？)的 API key 拥有该权限。缺少该权限时，端点返回 HTTP 403 和纯文本消息。请在[账户设置](https://www.bright.cn/cp/setting/users)中管理 API key 权限。

## 如何检查自动充值是否已开启？

调用 `GET /billing/autorecharge`。此端点不接受任何参数：

```bash theme={null}
curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.brightdata.com/billing/autorecharge"
```

`regular.enabled` 为 `true` 时，常规自动充值已开启。`dataset.enabled` 为 `true` 时，数据集自动充值已开启。`suspended` 为 `true` 时，整个账户的自动充值被暂停。

## regular 部分返回哪些字段？

`regular` 对象包含常规自动充值设置：

| 字段 | 类型 | 说明 |
| - | - | - |
| `available` | boolean | 账户可使用常规自动充值，且账户中有支持自动充值的支付方式时为 `true` |
| `enabled` | boolean | 常规自动充值已开启时为 `true` |
| `pmethod_id` | string 或 null | 自动充值扣款的支付方式。停用时为 `null` |
| `amount` | integer 或 null | 充值金额，单位为美元。停用时为 `null` |
| `threshold` | number 或 null | 触发充值的余额水平。当可用余额低于 ceil(`amount` / 4) 时开始充值。停用时为 `null` |
| `limits.min_amount` | integer | 最低 `amount`，单位为美元。所有账户均为 \$50 |
| `limits.max_amount` | integer | 最高 `amount`，单位为美元。取决于公司类型，也可以按账户调整 |

例如，当 `amount` 设置为 200 时，可用余额低于 \$50 时开始充值。每次扣款金额请参阅[常规自动充值扣款多少？](https://docs.brightdata.com/cn/api-reference/account-management-api/Set_regular_auto_recharge.md#常规自动充值扣款多少？)。

## dataset 部分返回哪些字段？

`dataset` 对象包含数据集自动充值设置：

| 字段 | 类型 | 说明 |
| - | - | - |
| `available` | boolean | 可使用常规自动充值且账户拥有数据集 zone 时为 `true` |
| `enabled` | boolean | 数据集自动充值已开启时为 `true` |
| `pmethod_id` | string 或 null | 数据集自动充值扣款的支付方式。停用时为 `null` |

仅当数据集快照构建开始且余额不足以支付快照费用时，数据集自动充值才会扣款。常规自动充值和数据集自动充值分别设置，关闭其中一个不会改变另一个。

## 为什么我的账户无法使用自动充值？

满足以下任一条件时，`regular.available` 为 `false`：

* 账户是 AWS Marketplace organic 账户
* 账户是 IBM 账户
* 账户没有支持自动充值的支付方式，或所有此类支付方式均被冻结

账户没有数据集 zone 时，`dataset.available` 也为 `false`。即使 `available` 为 `false`，也始终可以关闭自动充值。

## 账单端点有哪些速率限制？

账单端点允许每分钟 1,000 个请求、每小时 5,000 个请求。超出限制时，端点返回 HTTP 429 和纯文本响应体。

## 相关端点

* [设置常规自动充值](https://docs.brightdata.com/cn/api-reference/account-management-api/Set_regular_auto_recharge.md)。开启或关闭常规自动充值，或修改充值金额。
* [设置数据集自动充值](https://docs.brightdata.com/cn/api-reference/account-management-api/Set_dataset_auto_recharge.md)。开启或关闭数据集自动充值。
* [获取支付方式](https://docs.brightdata.com/cn/api-reference/account-management-api/Get_payment_methods.md)。支付方式 ID 以及是否支持自动充值。


## OpenAPI

````yaml cn-openapi GET /billing/autorecharge
openapi: 3.0.1
info:
  title: Bright Data API
  description: 将 Bright Data API 集成到您的流程中，以实现高端的爬取精度
  version: 1.0.0
servers:
  - url: https://api.brightdata.com
security:
  - bearerAuth: []
paths:
  /billing/autorecharge:
    get:
      description: 获取账户的常规自动充值和数据集自动充值设置。需要 `billing.read` 权限。
      operationId: getAutoRecharge
      responses:
        '200':
          description: 自动充值设置
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BillingAutoRecharge'
        '401':
          description: 身份验证失败
          content:
            text/plain:
              schema:
                type: string
              example: User authentication is required
        '403':
          description: API key 缺少所需权限
          content:
            text/plain:
              schema:
                type: string
              example: >-
                Your API key lacks the required permissions for this action. You
                can change your token permissions at
                https://brightdata.com/cp/setting/users
        '429':
          description: 超出速率限制（每分钟 1,000 个请求，每小时 5,000 个请求）
          content:
            text/plain:
              schema:
                type: string
components:
  schemas:
    BillingAutoRecharge:
      type: object
      required:
        - regular
        - dataset
        - suspended
      properties:
        regular:
          $ref: '#/components/schemas/BillingAutoRechargeRegular'
        dataset:
          $ref: '#/components/schemas/BillingAutoRechargeDataset'
        suspended:
          type: boolean
          description: 账户的自动充值被暂停时为 `true`。
    BillingAutoRechargeRegular:
      type: object
      required:
        - available
        - enabled
        - pmethod_id
        - amount
        - threshold
        - limits
      properties:
        available:
          type: boolean
          description: >-
            账户可使用常规自动充值，且账户中有支持自动充值的支付方式时为 `true`。AWS Marketplace organic 账户、IBM
            账户，以及没有支持自动充值的支付方式或所有此类支付方式均被冻结的账户为 `false`。
        enabled:
          type: boolean
          description: 此部分已启用自动充值时为 `true`。
        pmethod_id:
          type: string
          nullable: true
          description: 用于自动充值的支付方式。停用时为 `null`。
        amount:
          type: integer
          nullable: true
          description: 充值金额，单位为美元。停用时为 `null`。
        threshold:
          type: number
          nullable: true
          readOnly: true
          description: 触发充值的余额水平：当可用余额低于 ceil(`amount` / 4) 时开始充值。停用时为 `null`。只读。
        limits:
          type: object
          description: 账户的金额限制。
          required:
            - min_amount
            - max_amount
          properties:
            min_amount:
              type: integer
              description: 最低金额，单位为美元。所有账户均为 $50。
            max_amount:
              type: integer
              description: 最高金额，单位为美元。取决于公司类型，也可以按账户调整。
    BillingAutoRechargeDataset:
      type: object
      required:
        - available
        - enabled
        - pmethod_id
      properties:
        available:
          type: boolean
          description: 可使用常规自动充值且账户拥有数据集 zone 时为 `true`。
        enabled:
          type: boolean
          description: 此部分已启用自动充值时为 `true`。
        pmethod_id:
          type: string
          nullable: true
          description: 用于自动充值的支付方式。停用时为 `null`。
  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

````