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

# Set dataset auto-recharge

> Use PUT /billing/autorecharge/dataset in the Bright Data Account Management API to turn dataset auto-recharge on or off and pick its payment method.

The `PUT /billing/autorecharge/dataset` endpoint turns dataset auto-recharge on or off on your Bright Data account, and sets the payment method it charges. The regular auto-recharge settings do not change.

> [!TIP]
>
> Paste your API key into the authorization field. To get an API key, [create an account](https://brightdata.com/?hs_signup=1\&utm_source=docs\&utm_campaign=playground) and learn [how to generate an API key](https://docs.brightdata.com/api-reference/authentication.md#how-do-i-generate-a-new-api-key%3F).

## Which API key permission does this endpoint need?

`PUT /billing/autorecharge/dataset` requires the `billing.write.pay.settings` permission. API keys with the **Admin** or **Finance** [permission level](https://docs.brightdata.com/api-reference/authentication.md#what-permissions-level-does-an-api-key-have) have it. Without it, the endpoint returns HTTP 403 with a plain-text message. Manage API key permissions in [Account settings](https://brightdata.com/cp/setting/users).

## How do I turn on dataset auto-recharge?

Send `enabled: true` with a `pmethod_id`. Dataset auto-recharge takes no `amount`:

1. Get a payment method ID where `autorecharge_supported` is `true` from [`GET /billing/pmethods`](https://docs.brightdata.com/api-reference/account-management-api/Get_payment_methods).
2. Send the request:

```bash theme={null}
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"}'
```

The response returns the new dataset auto-recharge settings: `available`, `enabled` and `pmethod_id`. Dataset auto-recharge is available when regular auto-recharge is available and the account has a dataset zone. Check `dataset.available` in [`GET /billing/autorecharge`](https://docs.brightdata.com/api-reference/account-management-api/Get_auto_recharge_settings).

## How much does dataset auto-recharge charge?

Dataset auto-recharge charges only when a dataset snapshot build starts and the balance cannot cover the snapshot cost. The charge happens at the start of the snapshot build and is the larger of \$50 and the amount the balance is short for that snapshot:

| Balance short for the snapshot | Charge |
| - | - |
| \$120 | \$120 |
| \$20 | \$50 |

## How do I turn off dataset auto-recharge?

Send `enabled: false` and no other field:

```bash theme={null}
curl -X PUT "https://api.brightdata.com/billing/autorecharge/dataset" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"enabled": false}'
```

Turning dataset auto-recharge off is always allowed, also when `available` is `false`. Turning off dataset auto-recharge does not turn off regular auto-recharge. Sending `pmethod_id` with `enabled: false` returns `invalid_param`.

## How does PUT update the settings?

The request body holds all the settings for the dataset section, and the request is idempotent. Sending the same body twice leaves the same settings.

## Which errors can this endpoint return?

HTTP 400 and the `not_eligible` HTTP 403 return JSON with `error` and `error_code`:

| HTTP status | `error_code` | Cause |
| - | - | - |
| 400 | `invalid_param` | Wrong type, unknown field, `pmethod_id` missing with `enabled: true`, or sent with `enabled: false` |
| 400 | `pmethod_not_found` | No active payment method with this ID on the account |
| 400 | `pmethod_not_supported` | The payment method does not support auto-recharge or is not confirmed |
| 400 | `payment_required` | The account has no completed payment |
| 403 | `not_eligible` | Auto-recharge is not available for the account (`available: false`) and the request has `enabled: true` |

HTTP 401, the permission HTTP 403 and HTTP 429 return plain text. The billing endpoints allow 1,000 requests per minute and 5,000 requests per hour.

## Related endpoints

* [Get auto-recharge settings](https://docs.brightdata.com/api-reference/account-management-api/Get_auto_recharge_settings.md). Current regular and dataset auto-recharge settings.
* [Set regular auto-recharge](https://docs.brightdata.com/api-reference/account-management-api/Set_regular_auto_recharge.md). Turn regular auto-recharge on or off, or change its amount.
* [Get payment methods](https://docs.brightdata.com/api-reference/account-management-api/Get_payment_methods.md). Payment method IDs and auto-recharge support.


## OpenAPI

````yaml api-reference/openapi PUT /billing/autorecharge/dataset
openapi: 3.0.1
info:
  title: Bright Data API
  description: >-
    Integrate Bright Data APIs to your pipeline and secure high-end scraping
    precision
  version: 1.0.0
servers:
  - url: https://api.brightdata.com
security:
  - bearerAuth: []
paths:
  /billing/autorecharge/dataset:
    put:
      description: >-
        Enable or disable dataset auto-recharge. Requires the
        `billing.write.pay.settings` permission.


        The body holds all the settings for the dataset section, and PUT is
        idempotent. The regular section does not change. `{"enabled": false}` is
        always allowed, also when `available` is `false`.


        Dataset auto-recharge charges only when a dataset snapshot build starts
        and the balance cannot cover the snapshot cost. The charge is the larger
        of $50 and the amount the balance is short for that snapshot. Regular
        and dataset auto-recharge are set separately.
      operationId: setDatasetAutoRecharge
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/BillingDatasetEnable'
                - $ref: '#/components/schemas/BillingDisable'
            examples:
              enable:
                summary: Enable
                value:
                  enabled: true
                  pmethod_id: 64f0c2a1e4b0a1b2c3d4e5f6
              disable:
                summary: Disable
                value:
                  enabled: false
      responses:
        '200':
          description: New dataset auto-recharge settings
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BillingAutoRechargeDataset'
        '400':
          description: >-
            Bad request. `error_code` values:


            - `invalid_param`: wrong type, unknown field, `pmethod_id` missing
            with `enabled: true`, or `pmethod_id` sent with `enabled: false`.

            - `pmethod_not_found`: no active payment method with this ID in the
            account.

            - `pmethod_not_supported`: the payment method does not support
            auto-recharge or is not confirmed.

            - `payment_required`: the account has no completed payment.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BillingError'
        '401':
          description: Authentication failed
          content:
            text/plain:
              schema:
                type: string
              example: User authentication is required
        '403':
          description: >-
            `text/plain`: the API key lacks the `billing.write.pay.settings`
            permission. `application/json` with `error_code` `not_eligible`:
            auto-recharge is not available for the account (`available: false`)
            and the request has `enabled: true`.
          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
            application/json:
              schema:
                $ref: '#/components/schemas/BillingError'
              example:
                error: Autocharge is not available for this account
                error_code: not_eligible
        '429':
          description: Rate limit exceeded (1,000 requests per minute, 5,000 per hour)
          content:
            text/plain:
              schema:
                type: string
components:
  schemas:
    BillingDatasetEnable:
      title: Enable
      type: object
      required:
        - enabled
        - pmethod_id
      additionalProperties: false
      properties:
        enabled:
          type: boolean
          enum:
            - true
        pmethod_id:
          type: string
          description: Payment method ID from `GET /billing/pmethods`.
          example: 64f0c2a1e4b0a1b2c3d4e5f6
    BillingDisable:
      title: Disable
      type: object
      required:
        - enabled
      additionalProperties: false
      properties:
        enabled:
          type: boolean
          enum:
            - false
    BillingAutoRechargeDataset:
      type: object
      required:
        - available
        - enabled
        - pmethod_id
      properties:
        available:
          type: boolean
          description: >-
            `true` when regular auto-recharge is available and the account has a
            dataset zone.
        enabled:
          type: boolean
          description: '`true` when auto-recharge is enabled for this section.'
        pmethod_id:
          type: string
          nullable: true
          description: Payment method used for auto-recharge. `null` if disabled.
    BillingError:
      type: object
      required:
        - error
        - error_code
      properties:
        error:
          type: string
          description: Human-readable message
        error_code:
          type: string
          enum:
            - invalid_param
            - amount_too_low
            - amount_too_high
            - amount_not_whole
            - pmethod_not_found
            - pmethod_not_supported
            - payment_required
            - not_eligible
  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

````