Updated on 2025-11-21 GMT+08:00

Adding an Address Group

Function

This API is used to add an address group.

URI

POST /v1/{project_id}/address-set

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID, which can be obtained by calling an API or from the console. For details, see Obtaining a Project ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

enterprise_project_id

No

String

Enterprise project ID, which is the ID of a project planned based on organizations. If the enterprise project function is not enabled, the value is 0.

fw_instance_id

No

String

Firewall ID, which can be obtained by referring to Obtaining a Firewall ID.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. It can be obtained by calling the IAM API (value of X-Subject-Token in the response header).

Table 4 Request body parameters

Parameter

Mandatory

Type

Description

object_id

Yes

String

Protected object ID, which is used to distinguish between Internet border protection and VPC border protection after a cloud firewall is created. You can obtain the ID by calling the API for querying firewall instances. In the return value, find the ID in data.records.protect_objects.object_id (The period [.] is used to separate different levels of objects). If the value of type is 0, object_id is the protected object ID on the Internet border. If the value of type is 1, object_id is the protected object ID on the VPC border. You can obtain the value of type from data.records.protect_objects.type (The period [.] is used to separate different levels of objects). Here, only the protected object ID of the type with the value 0 can be used.

name

Yes

String

IP address group name.

description

No

String

Address group description.

address_type

No

Integer

Address type: 0 (IPv4), 1 (IPv6).

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

data

AddressSetId object

Data returned after an address group is added.

Table 6 AddressSetId

Parameter

Type

Description

id

String

Address group ID.

name

String

IP address group name.

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

Range

N/A

error_msg

String

Definition

Error description.

Range

N/A

Example Requests

Add an IPv4 address group whose project ID is 14181c1245cf4fd786824efe1e2b9388, protected object ID is 1530de8a-522d-4771-9067-9fa4e2f53b48, and name is ceshi.

https://{Endpoint}/v1/14181c1245cf4fd786824efe1e2b9388/address-set

{
  "object_id" : "1530de8a-522d-4771-9067-9fa4e2f53b48",
  "name" : "ceshi",
  "description" : "",
  "address_type" : 0
}

Example Responses

Status code: 200

OK

{
  "data" : {
    "id" : "9dffcd62-23bf-4456-83fa-80fa0fee47db",
    "name" : "name"
  }
}

Status code: 400

Bad Request

{
  "error_code" : "CFW.00900020",
  "error_msg" : "The number of address groups exceeds the upper limit."
}

Status Codes

Status Code

Description

200

OK

400

Bad Request

401

Unauthorized: Request error.

403

Forbidden: Access forbidden.

404

Not Found: Web page not found.

500

Internal Server Error

Error Codes

See Error Codes.