Installation
The NexDNS CLI is a single binary with no external dependencies. Choose the installation method that suits your environment.
Quick Install (Linux / macOS)
curl -sL https://get.nexdns.tech/cli | sh
Homebrew
brew install nexdns/tap/nexdns-cli
Docker
docker pull nexdns/cli
Verify Installation
After installing, confirm the CLI is available and check its version:
nexdns version
Authentication
The CLI requires an API token to communicate with the NexDNS API. You can create a token at nexdns.tech/settings/api-keys.
Save Token to Config
nexdns auth token nxd_xxxxxxxxxxxxxxxxxxxx
Environment Variable (CI/CD)
export NEXDNS_TOKEN=nxd_xxxxxxxxxxxxxxxxxxxx
Check Authentication Status
nexdns auth status
Config File
The token is stored in ~/.nexdns/config.yaml. The CLI resolves credentials in the following priority order:
--tokenflag (highest priority)NEXDNS_TOKENenvironment variable- Config file
~/.nexdns/config.yaml
Zone Management
Manage DNS zones from the command line. All zone commands are under the nexdns zone subcommand.
List Zones
nexdns zone list
Add a Zone
nexdns zone add example.com --ns-group eu
Zone Information
nexdns zone info example.com
Export Zone (BIND Format)
nexdns zone export example.com
Import Zone File
Use --dry-run to preview changes before applying them:
nexdns zone import example.com zone.txt --dry-run
Ensure Zone Exists
Creates the zone only if it does not already exist (idempotent):
nexdns zone ensure example.com
Check Zone Health
nexdns zone check example.com
Delete a Zone
nexdns zone delete example.com
Record Management
Manage DNS records within a zone. All record commands are under the nexdns record subcommand.
List Records
nexdns record list example.com
Add Records
# A record
nexdns record add example.com A www 1.2.3.4 --ttl 300
# MX record with priority
nexdns record add example.com MX @ mail.example.com --priority 10
Update a Record
nexdns record update example.com <record-id> --content 5.6.7.8
Create Record If Missing
Creates the record only if it does not already exist (an exact match of type, name and content). Existing records with different content are left untouched – safe for round-robin setups. Idempotent:
nexdns record ensure example.com A www 1.2.3.4
Delete a Record
nexdns record delete example.com <record-id>
DNSSEC
Manage DNSSEC signing for your zones.
Check DNSSEC Status
nexdns dnssec status example.com
Enable DNSSEC
nexdns dnssec enable example.com
Get DS Records
Retrieve DS records to configure at your domain registrar:
nexdns dnssec ds-records example.com
Disable DNSSEC
nexdns dnssec disable example.com
DNS-as-Code
Define your DNS infrastructure declaratively in a nexdns.yaml file and manage it with version control. The CLI compares your local configuration against the live state and applies only the necessary changes.
Configuration Format
zones:
example.com:
dnssec: true
records:
- type: A
name: "@"
content: "1.2.3.4"
ttl: 300
- type: CNAME
name: www
content: example.com
Preview Changes
Show a diff of what would change without applying anything:
nexdns apply
Apply Changes
Apply the changes after reviewing the diff:
nexdns apply --confirm
Diff Only
nexdns diff
Pull Live State
Generate a nexdns.yaml from the current live DNS configuration:
nexdns pull example.com
Environment Variable Substitution
Use ${VARIABLE} syntax in your configuration file. The CLI substitutes environment variables at apply time, making it easy to reuse configs across environments:
zones:
${DOMAIN}:
records:
- type: A
name: "@"
content: "${SERVER_IP}"
Docker
The CLI is available as a Docker image. Pass your API token via the NEXDNS_TOKEN environment variable.
Run Commands
docker run --rm -e NEXDNS_TOKEN=nxd_xxx nexdns/cli zone list
Import a Zone File
Mount a local directory to pass zone files into the container:
docker run --rm -e NEXDNS_TOKEN=nxd_xxx \
-v ./zones:/zones \
nexdns/cli zone import example.com /zones/example.com.zone
Global Flags
The following flags are available on all commands:
| Flag | Description |
|---|---|
--token |
API token (overrides config file and environment variable) |
--api-url |
Override the API base URL (default: https://api.nexdns.tech/v1) |
--output, -o |
Output format: table (default), json, yaml, csv |
--color |
Force colored output (auto, always, never) |
--quiet, -q |
Suppress non-essential output |
--verbose, -v |
Enable verbose logging (useful for debugging) |
--dry-run |
Preview changes without applying them |
--timeout |
Request timeout in seconds (default: 30) |
Terraform
The NexDNS Terraform provider lets you manage zones and records as Terraform resources. Install the provider from the Terraform Registry and configure it with your API token.
provider "nexdns" {
api_token = var.nexdns_token
}
resource "nexdns_zone" "main" {
name = "example.com"
ns_group = "eu"
}
resource "nexdns_record" "www" {
zone_id = nexdns_zone.main.id
type = "A"
name = "www"
content = "1.2.3.4"
}
DNSControl
DNSControl is a DNS-as-code tool by Stack Overflow. Use the NexDNS provider to manage your zones declaratively.
creds.json
{
"nexdns": {
"TYPE": "NEXDNS",
"api_token": "nxd_xxxxxxxxxxxxxxxxxxxx"
}
}
dnsconfig.js
var REG_NONE = NewRegistrar("none");
var DSP_NEXDNS = NewDnsProvider("nexdns");
D("example.com", REG_NONE, DnsProvider(DSP_NEXDNS),
A("@", "1.2.3.4"),
A("www", "1.2.3.4"),
MX("@", 10, "mail.example.com."),
CNAME("blog", "example.com.")
);
OctoDNS
OctoDNS is a DNS-as-code tool by GitHub. Install the NexDNS provider and configure it as a source or target in your OctoDNS config.
Install Provider
pip install octodns-nexdns
config/production.yaml
providers:
nexdns:
class: octodns_nexdns.NexdnsProvider
api_token: env/NEXDNS_TOKEN
zones:
example.com.:
sources:
- config
targets:
- nexdns
zones/example.com.yaml
"":
type: A
value: 1.2.3.4
www:
type: A
value: 1.2.3.4
blog:
type: CNAME
value: example.com.