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

Querying Name Servers in a Public Zone

Function

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

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 Nameserver objects

Definition

Response to the request for querying the name servers in a public zone

Range

N/A

Table 4 Nameserver

Parameter

Type

Description

hostname

String

Definition

Host name

Range

N/A

priority

Integer

Definition

Priority

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

Querying name servers in a public zone

GET https://{endpoint}/v2/zones/2c9eb155587194ec01587224c9f90149/nameservers

Example Responses

Status code: 200

Successful request

{
  "nameservers" : [ {
    "hostname" : "ns1.example.com.",
    "priority" : 1
  }, {
    "hostname" : "ns2.example.com.",
    "priority" : 2
  } ]
}

Status Codes

Status Code

Description

200

Successful request

400

Error response

404

Error response

500

Error response

Error Codes

See Error Codes.