Help Center/ Domain Name Service/ API Reference/ APIs/ Private Zone Management/ Querying Name Servers in a Private Zone
Updated on 2025-10-30 GMT+08:00

Querying Name Servers in a Private Zone

Function

This API is used to query the name server information of a private zone after the private zone is created. The information includes the priority and DNS server address.

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, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    dns:zone:get

    Read

    zone *

    • g:ResourceTag/<tag-key>

    • g:EnterpriseProjectId

    -

    -

URI

GET /v2/zones/{zone_id}/nameservers

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

zone_id

Yes

String

Definition

Zone ID

Constraints

N/A

Range

N/A

Default Value

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

The user token.

The token can be obtained by calling an IAM API. The value of X-Subject-Token in the response header is the user token.

For details about how to obtain a user token, seeObtaining a User Token.

Constraints

N/A

Range

N/A

Default Value

N/A

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

nameservers

Array of PrivateNameServer objects

Definition

Name server list

Range

N/A

Table 4 PrivateNameServer

Parameter

Type

Description

priority

Integer

Definition

Priority. If the priority of a name server is set to 1, it is used to resolve domain names in the first priority.

Range

N/A

address

String

Definition

Address of the DNS server

Range

N/A

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

code

String

Definition

Error code

Range

N/A

message

String

Definition

Error description

Range

N/A

Status code: 404

Table 6 Response body parameters

Parameter

Type

Description

code

String

Definition

Error code

Range

N/A

message

String

Definition

Error description

Range

N/A

Status code: 500

Table 7 Response body parameters

Parameter

Type

Description

code

String

Definition

Error code

Range

N/A

message

String

Definition

Error description

Range

N/A

Example Requests

None

Example Responses

Status code: 200

Successful request

{
  "nameservers" : [ {
    "priority" : 1,
    "address" : "100.125.0.81"
  }, {
    "priority" : 2,
    "address" : "100.125.0.82"
  } ]
}

Status Codes

Status Code

Description

200

Successful request

400

Error response

404

Error response

500

Error response

Error Codes

See Error Codes.