cURL
curl --request GET \
--url https://api.brightdata.com/billing/autorecharge \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.brightdata.com/billing/autorecharge"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.brightdata.com/billing/autorecharge', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.brightdata.com/billing/autorecharge",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.brightdata.com/billing/autorecharge"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.brightdata.com/billing/autorecharge")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.brightdata.com/billing/autorecharge")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"regular": {
"available": true,
"enabled": true,
"pmethod_id": "<string>",
"amount": 123,
"threshold": 123,
"limits": {
"min_amount": 123,
"max_amount": 123
}
},
"dataset": {
"available": true,
"enabled": true,
"pmethod_id": "<string>"
},
"suspended": true
}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>Account & status
Get auto-recharge settings
Use GET /billing/autorecharge in the Bright Data Account Management API to read regular and dataset auto-recharge settings: amount, threshold and limits.
GET
/
billing
/
autorecharge
cURL
curl --request GET \
--url https://api.brightdata.com/billing/autorecharge \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.brightdata.com/billing/autorecharge"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.brightdata.com/billing/autorecharge', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.brightdata.com/billing/autorecharge",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.brightdata.com/billing/autorecharge"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.brightdata.com/billing/autorecharge")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.brightdata.com/billing/autorecharge")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"regular": {
"available": true,
"enabled": true,
"pmethod_id": "<string>",
"amount": 123,
"threshold": 123,
"limits": {
"min_amount": 123,
"max_amount": 123
}
},
"dataset": {
"available": true,
"enabled": true,
"pmethod_id": "<string>"
},
"suspended": true
}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>The
Regular auto-recharge is on when
For example, with
Dataset auto-recharge charges only when a dataset snapshot build starts and the balance cannot cover the snapshot cost. Regular and dataset auto-recharge are set separately, so turning one off does not change the other.
GET /billing/autorecharge endpoint returns the auto-recharge settings of your Bright Data account: the regular section, the dataset section and whether auto-recharge is suspended for the account.
Paste your API key into the authorization field. To get an API key, create an account and learn how to generate an API key.
Which API key permission does this endpoint need?
GET /billing/autorecharge requires the billing.read permission. API keys with the Admin or Finance permission level have it. Without it, the endpoint returns HTTP 403 with a plain-text message. Manage API key permissions in Account settings.
How do I check whether auto-recharge is on?
CallGET /billing/autorecharge. The endpoint takes no parameters:
curl -H "Authorization: Bearer YOUR_API_KEY" \
"https://api.brightdata.com/billing/autorecharge"
regular.enabled is true. Dataset auto-recharge is on when dataset.enabled is true. When suspended is true, auto-recharge is suspended for the whole account.
What does the regular section return?
Theregular object holds the regular auto-recharge settings:
| Field | Type | Description |
|---|---|---|
available | boolean | true when regular auto-recharge is available for the account and the account has a payment method that supports auto-recharge |
enabled | boolean | true when regular auto-recharge is on |
pmethod_id | string or null | Payment method charged by auto-recharge. null when disabled |
amount | integer or null | Charge amount in USD. null when disabled |
threshold | number or null | Balance level for a charge. A charge starts when the available balance drops below ceil(amount / 4). null when disabled |
limits.min_amount | integer | Minimum amount, in USD. $50 for all accounts |
limits.max_amount | integer | Maximum amount, in USD. Depends on the company type and can be changed per account |
amount set to 200, a charge starts when the available balance drops below $50. To learn how much each charge is, see How much does regular auto-recharge charge?.
What does the dataset section return?
Thedataset object holds the dataset auto-recharge settings:
| Field | Type | Description |
|---|---|---|
available | boolean | true when regular auto-recharge is available and the account has a dataset zone |
enabled | boolean | true when dataset auto-recharge is on |
pmethod_id | string or null | Payment method charged by dataset auto-recharge. null when disabled |
Why is auto-recharge not available on my account?
regular.available is false when one of these is true:
- The account is an AWS Marketplace organic account
- The account is an IBM account
- The account has no payment method that supports auto-recharge, or all such payment methods are blocked
dataset.available is also false when the account has no dataset zone. Turning auto-recharge off works even when available is false.
What are the rate limits for the billing endpoints?
The billing endpoints allow 1,000 requests per minute and 5,000 requests per hour. Over the limit, the endpoint returns HTTP 429 with a plain-text body.Related endpoints
- Set regular auto-recharge. Turn regular auto-recharge on or off, or change its amount.
- Set dataset auto-recharge. Turn dataset auto-recharge on or off.
- Get payment methods. Payment method IDs and auto-recharge support.
Authorizations
Use your Bright Data API Key as a Bearer token in the Authorization header.
How to authenticate:
- Obtain your API Key from the Bright Data account settings at https://brightdata.com/cp/setting/users
- Include the API Key in the Authorization header of your requests
- 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
Was this page helpful?