> ## Documentation Index
> Fetch the complete documentation index at: https://brightdata-ipv6-release.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 添加区域

> Add a new zone

<Warning> **Warning:** This API can modify your account settings, damage your operations or incur charges.</Warning>

<Tip>
  将您的 API 令牌粘贴到身份验证字段。要获得令牌，创建账户并了解如何生成令牌

  [Create an account](https://brightdata.com/?hs_signup=1\&utm_source=docs\&utm_campaign=playground), [generate a token](/cn/api-reference/unlocker/api_token)
</Tip>

# 添加计划示例

<Tabs>
  <Tab title="数据中心">
    ```sh 添加共享数据中心 - 按使用区域付费 theme={null}
    curl "https://api.brightdata.com/区域" -H "Content-Type: application/json" -H "身份验证: 持有者 API_TOKEN" -d "{'区域':{'名称':'区域_名称'},'计划':{'类型':'static','ips_类型':'shared','ip_alloc_preset':'shared_block'}}"
    ```
  </Tab>

  <Tab title="ISP">
    ```sh Add an ISP - Exclusive 区域 theme={null}
    curl "https://api.brightdata.com/区域" -H "Content-Type: application/json" -H "身份验证: 持有者 API_TOKEN" -d "{'区域':{'名称':'区域_名称'},'计划':{'类型':'static','ips_类型':'dedicated','pool_ip_类型':'static_res','ips':3}}"
    ```
  </Tab>

  <Tab title="住宅">
    ```sh Add a 住宅 - Exclusive with Exclusive domain 'example.com' 区域 theme={null}
    curl "https://api.brightdata.com/区域" -H "Content-Type: application/json" -H "身份验证: 持有者 API_TOKEN" -d "{'区域':{'名称':'区域_名称'},'计划':{'类型':'resident','VIP_类型':'domain','VIP':true,'VIP':3,'domain_whitelist':'example.com'}}"
    ```
  </Tab>

  <Tab title="移动设备">
    *

    ```sh Add a 移动设备 - Shared 区域 theme={null}
    curl "https://api.brightdata.com/区域" -H "Content-Type: application/json" -H "身份验证: 持有者 API_TOKEN" -d "{'区域':{'名称':'区域_名称'},'计划':{'类型':'resident','移动设备':true,'VIP_类型':'shared'}}"
    ```
  </Tab>

  <Tab title="解锁器">
    ```sh Add a Web Unlcoker Zone theme={null}
    curl "https://api.brightdata.com/区域" -H "Content-Type: application/json" -H "身份验证: 持有者 API_TOKEN" -d "{'区域':{'名称':'区域_名称'},'计划':{'类型':'unblocker'}}"
    ```
  </Tab>

  <Tab title="SERP">
    ```sh Add a SERP Zone theme={null}
    curl "https://api.brightdata.com/区域" -H "Content-Type: application/json" -H "身份验证: 持有者 API_TOKEN" -d "{'区域':{'名称':'区域_名称'},'计划':{'类型':'resident','serp':true}}"
    ```
  </Tab>
</Tabs>

<RequestExample>
  ```sh Shell theme={null}
  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}}"
  ```

  ```js NodeJS theme={null}
  #!/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 Java theme={null}
  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)
    }
  }
  ```

  ```cs C# theme={null}
  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 Python theme={null}
  #!/usr/bin/env python
  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)
  ```
</RequestExample>


## OpenAPI

````yaml POST /zone
openapi: 3.0.1
info:
  title: Brightdata 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:
  /zone:
    post:
      description: Add a new zone
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewZoneBody'
      responses:
        '201':
          description: Zone added
components:
  schemas:
    NewZoneBody:
      required:
        - zone
        - plan
      type: object
      properties:
        zone:
          $ref: '#/components/schemas/Zone'
        plan:
          $ref: '#/components/schemas/Plan'
    Zone:
      required:
        - name
      type: object
      properties:
        name:
          description: The name of the zone
          type: string
        type:
          description: Zone Type, e.g. serp, isp, mobile, etc.
          type: string
      example:
        name: zone-name
        type: serp
    Plan:
      required:
        - type
      type: object
      properties:
        type:
          description: type of zone
          type: string
          enum:
            - static
            - resident
            - unblocker
        domain_whitelist:
          description: Space separated list of whitelisted domains
          type: string
        ips_type:
          description: '`domain_whitelist` is required for `selective`'
          type: string
          enum:
            - shared
            - dedicated
            - selective
        bandwidth:
          description: '`bandwidth`: for bandwidth `unlimited`: enable unlimited bandwidth'
          type: string
          enum:
            - bandwidth
            - unlimited
        ip_alloc_preset:
          description: To set a zone with Shared - Pay per usage type
          type: string
          enum:
            - shared_block
            - shared_res_block
        ips:
          description: Number of static IPs to allocate to the zone
          type: integer
          default: 0
        country:
          description: >-
            Specify which country IP to allocate to the zone, specify this
            parameter when `ips_type=static`
          type: string
          default: any
        country_city:
          description: >-
            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`
          type: string
          default: any
        mobile:
          description: >-
            `true` when adding a Mobile proxy zone, type value must be
            `resident`
          type: boolean
          default: 'false'
        serp:
          description: '`true` when adding a SERP API zone'
          type: boolean
          default: 'false'
        city:
          description: '`true` when enabling City targeting permission'
          type: boolean
          default: 'false'
        asn:
          description: '`true` when enabling ASN targeting permission'
          type: boolean
          default: 'false'
        vip:
          description: '`true` when allocating `gIP` (group of IPs)'
          type: boolean
          default: 'false'
        vips_type:
          description: specify this parameter when adding a Residential or Mobile zone
          type: string
          enum:
            - shared
            - domain
        vips:
          description: Number of `gIP` (group of IPs) to allocate to the zone
          type: integer
          default: '0'
        vip_country:
          description: >-
            Specify which country IP to allocate to the zone, specify this
            parameter when `ips_type=resident` and `vip=true`
          type: string
        vip_country_city:
          description: >-
            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`
          type: string
          default: any
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````