Skip to content
Start here

Set Account Custom Nameserver Related Zone Metadata

Deprecated
client.zones.customNameservers.update(CustomNameserverUpdateParams { zone_id, enabled, ns_set } params, RequestOptionsoptions?): SinglePage<CustomNameserverUpdateResponse>
PUT/zones/{zone_id}/custom_ns

Set metadata for account-level custom nameservers on a zone.

If you would like new zones in the account to use account custom nameservers by default, use PUT /accounts/:identifier to set the account setting use_account_custom_ns_by_default to true.

Deprecated in favor of Update DNS Settings.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Zone Write
ParametersExpand Collapse
params: CustomNameserverUpdateParams { zone_id, enabled, ns_set }
zone_id: string

Path param: Identifier.

maxLength32
enabled?: boolean

Body param: Whether zone uses account-level custom nameservers.

ns_set?: number

Body param: The number of the name server set to assign to the zone.

maximum5
minimum1
ReturnsExpand Collapse
CustomNameserverUpdateResponse = string

Unused

Set Account Custom Nameserver Related Zone Metadata

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const customNameserverUpdateResponse of client.zones.customNameservers.update({
  zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
})) {
  console.log(customNameserverUpdateResponse);
}
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": [],
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": [],
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000
  }
}