Updated on 2026-09-10 GMT+08:00

Creating a Domain Name

Function

This API is used to create a domain name.

Calling Method

For details, see Calling APIs.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, no identity policy-based permission required for calling this API.

URI

POST /v2/aad/domains

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

token

Content-Type

Yes

String

Content-Type

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

domain_name

Yes

String

Domain name

enterprise_project_id

Yes

String

Enterprise project ID. It must be the same as that of the AAD instance. You can view the enterprise project ID in Huawei Cloud EPS. The default enterprise project ID is 0.

ips

Yes

Array of strings

IP addresses of AAD instances. IP addresses of AAD instances must belong to the same enterprise project.

real_server_type

Yes

Integer

Origin server type. 0: origin server IP address. 1: origin server domain name.

port_http

Yes

Array of integers

HTTP port. This parameter and port_https cannot be both empty. You can view the HTTP ports supported by AAD on the console.

port_https

No

Array of integers

HTTPS port. This parameter and port_http cannot be both empty. You can view the HTTPS ports supported by AAD on the console.

real_server

Yes

String

Origin server. (IP address or domain names of the origin server)

overseas_type

Yes

String

Protection region. 0: regions in the Chinese mainland. 1: regions outside the Chinese mainland.

cert_name

No

String

Certificate name. It must be the name of an existing certificate.

waf_switch

No

String

0: enabled. 1: disabled.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

cname

String

CNAME address provided by AAD.

domain_id

String

Domain name ID.

Example Requests

Add the domain name test.com, set the AAD IP address to 2.x.x.2, enterprise project ID to 0, origin server type to origin server IP address, port to 80, origin server to 4.x.x.2, certificate name to 123, and enable WAF.

POST https://{endpoint}/v2/aad/domains

{
  "domain_name" : "test.com",
  "enterprise_project_id" : "0",
  "ips" : [ "2.x.x.2" ],
  "real_server_type" : 0,
  "port_http" : [ 80 ],
  "real_server" : "4.x.x.2",
  "overseas_type" : "0",
  "cert_name" : "123",
  "waf_switch" : "0"
}

Example Responses

Status code: 200

{
  "domain_id" : "81c8xxxxxxxxxxxxxxxx11c9",
  "cname" : "29xxxxxxxxxxxx1e.huaweisafedns.cn"
}

Status Codes

Status Code

Description

200

OK

400

Error

Error Codes

See Error Codes.