API endpoint:
POST /api/zone
POST body :
zone
[JSON] [Required]name=NAME
[string] - Zone name
plan
[JSON] [Required]type="static|resident|unblocker"
[string]- 'static' : Datacenter, ISP
- 'resident' : Residential, Mobile, SERP
- 'unblocker' : unlocker
ips_type="shared|dedicated|selective"
[string] - specify this parameter when adding a Datacenter or ISP zone- 'shared' : Shared
- 'dedicated' : Exclusive - All domain
- 'selective' : Exclusvie - Exclusive domain specified (domain_whitelist is required)
bandwidth="payperusage|unlimited"
[string]- 'unlimited' : enable unlimited bandwidth, this setting will be applied only to Datacenter - Shared per IP or Exclusive types.
ip_alloc_preset="shared_block|shared_res_block"
[string] - to set a zone with Shared - Pay per usage type.ips=0
[integer] - number of static IPs to allocate to the zonecountry="any"
[string] - specify which country IP to allocate to the zone, specify this parameter when 'ips_type=static'country_city="any"
[string] - country code followed by city (e.g. "se-stockholm") - specify which City IP to allocate to the zone, specify this parameter when 'ips_type=static'mobile=false
[boolean] - 'true' when adding a Mobile proxy zone, type value must be 'resident'serp=false
[boolean] - 'true' when adding a SERP API zonecity=false
[boolean] - 'true' when enabling City targeting permissionasn=false
[boolean] - 'true' when enabling ASN targeting permissionvip=false
[boolean] - 'true' when allocating gIP (group of IPs)vips_type="shared|domain"
[string] - specify this parameter when adding a Residential or Mobile zone- 'shared' : Shared
- 'domain' : Exclusive (domain_whitelist is required)
vips=0
[integer] - number of gIP (group of IPs) to allocate to the zonedomain_whitelist="d1.com d2.com"
[string] - Space separated list of whitelisted domainsvip_country="any"
[string] - specify which country IP to allocate to the zone, specify this parameter when 'ips_type=resident' and 'vip=true'vip_country_city="any"
[string] - country code followed by city (e.g. "se-stockholm") - specify which City IP to allocate to the zone, specify this parameter when 'ips_type=resident' and 'vip=true'
Sample Response:
{"plan":{"start":"2019-07-15T18:08:59.269Z","type":"static","ips_type":"shared","ip_alloc_preset":"shared_block","bandwidth":"payperusage"},"zone":{"ips":"any","password":["PASSWORD"],"plans":[{"start":"2019-07-15T18:08:59.269Z","type":"static","ips_type":"shared","ip_alloc_preset":"shared_block","bandwidth":"payperusage"}]}}
Plan Examples :
-
Add Datacenter - Shared - Pay per Usage zone :
curl "https://api.brightdata.com/zone" -H "Content-Type: application/json" -H "Authorization: Bearer API_TOKEN" -d "{\"zone\":{\"name\":\"ZONE_NAME\"},\"plan\":{\"type\":\"static\",\"ips_type\":\"shared\",\"ip_alloc_preset\":\"shared_block\"}}"
-
Add ISP - Exclusive zone :
curl "https://api.brightdata.com/zone" -H "Content-Type: application/json" -H "Authorization: Bearer API_TOKEN" -d "{\"zone\":{\"name\":\"ZONE_NAME\"},\"plan\":{\"type\":\"static\",\"ips_type\":\"dedicated\",\"pool_ip_type\":\"static_res\",\"ips\":3}}"
-
Add Residential - Exclusive with Exclusive domain 'example.com' zone :
curl "https://api.brightdata.com/zone" -H "Content-Type: application/json" -H "Authorization: Bearer API_TOKEN" -d "{\"zone\":{\"name\":\"ZONE_NAME\"},\"plan\":{\"type\":\"resident\",\"vips_type\":\"domain\",\"vip\":true,\"vips\":3,\"domain_whitelist\":\"example.com\"}}"
-
Add Mobile - Shared zone :
curl "https://api.brightdata.com/zone" -H "Content-Type: application/json" -H "Authorization: Bearer API_TOKEN" -d "{\"zone\":{\"name\":\"ZONE_NAME\"},\"plan\":{\"type\":\"resident\",\"mobile\":true,\"vips_type\":\"shared\"}}"
-
Add Unlocker zone :
curl "https://api.brightdata.com/zone" -H "Content-Type: application/json" -H "Authorization: Bearer API_TOKEN" -d "{\"zone\":{\"name\":\"ZONE_NAME\"},\"plan\":{\"type\":\"unblocker\"}}"
-
Add Search Engine Crawler zone :
curl "https://api.brightdata.com/zone" -H "Content-Type: application/json" -H "Authorization: Bearer API_TOKEN" -d "{\"zone\":{\"name\":\"ZONE_NAME\"},\"plan\":{\"type\":\"resident\",\"serp\":true}}"
Shell
curl "https://api.brightdata.com/zone" -H "Content-Type: application/json" -H "Authorization: Bearer API_TOKEN" -d "{\"zone\":{\"name\":\"ZONE_NAME\"},\"plan\":{\"type\":\"static|resident\",\"ips_type\":\"shared|dedicated|selective\",\"ip_alloc_preset\":\"shared_block\",\"bandwidth\":\"payperusage|unlimited\",\"mobile\":false,\"city\":false,\"asn\":false,\"vip\":false,\"vips_type\":\"shared|vip|domain\",\"vips\":0,\"domain_whitelist\":\"test.com fb.com\",\"not_country\":null,\"vip_country\":\"any\",\"exclusive_sec\":0,\"exclusive_type\":\"days\",\"exclusive_num\":0,\"ips\":0}}"
Node.js
#!/usr/bin/env node
require('request-promise')({
method: 'POST',
url: 'https://api.brightdata.com/zone',
json: {'zone':{'name': 'ZONE_NAME'},'plan':{'type':'static|resident','ips_type':'shared|dedicated|selective','ip_alloc_preset':'shared_block','bandwidth':'payperusage|unlimited','mobile':false,'city':false,'asn':false,'vip':false,'vips_type':'shared|vip|domain','vips':0,'domain_whitelist':'test.com fb.com','not_country':null,'vip_country':'any','exclusive_sec':0,'exclusive_type':'days','exclusive_num':0,'ips':0}},
headers: {'Authorization': 'Bearer API_TOKEN'},
}).then(function(data){ console.log(data); },
function(err){ console.error(err); });
Java
package example; import org.apache.http.HttpHost; import org.apache.http.client.fluent.*; public class Example { public static void main(String[] args) throws Exception {
String body = "{\"zone\":{\"name\":\"ZONE_NAME\"},\"plan\":{\"type\":\"static|resident\",\"ips_type\":\"shared|dedicated|selective\",\"ip_alloc_preset\":\"shared_block\",\"bandwidth\":\"payperusage|unlimited\",\"mobile\":false,\"city\":false,\"asn\":false,\"vip\":false,\"vips_type\":\"shared|vip|domain\",\"vips\":0,\"domain_whitelist\":\"test.com fb.com\",\"not_country\":null,\"vip_country\":\"any\",\"exclusive_sec\":0,\"exclusive_type\":\"days\",\"exclusive_num\":0,\"ips\":0}}"; String res = Executor.newInstance() .addHeader("Authorization", "Bearer API_TOKEN")
.execute(Request.Post("https://api.brightdata.com/zone")
.bodyString(body, ContentType.APPLICATION_JSON))
.returnContent().asString();
System.out.println(res) }
}
C#
using System; using System.Net; using System.Net.Http; using System.Net.Http.Headers; public class Program { public static async Task Main() { var client = new HttpClient(); var requestMessage = new HttpRequestMessage { Method = HttpMethod.Post,
RequestUri = new Uri("https://api.brightdata.com/zone"), Headers = { {"Authorization", "Bearer API_TOKEN"} },
Content = new StringContent(JsonConvert.SerializeObject(new {
zone = new { name = "ZONE_NAME" },
plan = new { type = "static|resident", ips_type = "shared|dedicated|selective", ip_alloc_preset = "shared_block", bandwidth = "payperusage|unlimited", mobile = false, city = false, asn = false, vip = false, vips_type = "shared|vip|domain", vips = 0, domain_whitelist = "test.com fb.com", not_country = null, vip_country = "any", exclusive_sec = 0, exclusive_type = "days", exclusive_num = 0, ips = 0 }
}), Encoding.UTF8, "application/json")) }; var response = await client.SendAsync(requestMessage); var responseString = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseString); } }
Python
#!/usr/bin/env python
print('If you get error "ImportError: No module named requests", please install it:\n$ sudo pip install requests');
import requests
data = {'zone':{'name': 'ZONE_NAME'},'plan':{'type':'static|resident','ips_type':'shared|dedicated|selective','ip_alloc_preset':'shared_block','bandwidth':'payperusage|unlimited','mobile':false,'city':false,'asn':false,'vip':false,'vips_type':'shared|vip|domain','vips':0,'domain_whitelist':'test.com fb.com','not_country':null,'vip_country':'any','exclusive_sec':0,'exclusive_type':'days','exclusive_num':0,'ips':0}}
headers = {'Authorization': 'Bearer API_TOKEN'}
r = requests.post('https://api.brightdata.com/zone', data=data, headers=headers)
print(r.content)