PHPackages                             automattic/dn-cli - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. automattic/dn-cli

ActiveLibrary[CLI &amp; Console](/categories/cli)

automattic/dn-cli
=================

CLI tool for Automattic Domain Services API

v1.4.0(2mo ago)57GPL-2.0-or-laterPHPPHP &gt;=8.0

Since Mar 11Pushed 1mo agoCompare

[ Source](https://github.com/Automattic/dn-cli)[ Packagist](https://packagist.org/packages/automattic/dn-cli)[ RSS](/packages/automattic-dn-cli/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (10)Versions (9)Used By (0)

dn — Domain Name CLI
====================

[](#dn--domain-name-cli)

Manage domains from your terminal. `dn` works in two modes: directly through the Automattic Domain Services API (partner mode), or through WordPress.com (user mode).

Installation
------------

[](#installation)

### Composer (global)

[](#composer-global)

```
composer global require automattic/dn-cli
```

Make sure `~/.composer/vendor/bin` (or `~/.config/composer/vendor/bin`) is in your `PATH`:

```
export PATH="$HOME/.composer/vendor/bin:$PATH"
```

### From source

[](#from-source)

```
git clone https://github.com/Automattic/dn-cli.git
cd dn-cli
composer install
```

Then run with `./bin/dn` or symlink it into your PATH:

```
ln -s "$(pwd)/bin/dn" /usr/local/bin/dn
```

Setup
-----

[](#setup)

Run `dn configure` to pick a mode and authenticate:

- **User mode** — WordPress.com OAuth. Requires a WordPress.com account.
- **Partner mode** — Automattic Domain Services API. Requires an API key and API user.

Your mode determines which commands are available. User mode covers domain search, purchase, and transfer through WordPress.com checkout. Partner mode gives you the full set: registration, DNS, contacts, privacy, transfers.

### Non-interactive setup

[](#non-interactive-setup)

Pipe credentials via stdin for scripts and CI/CD:

```
# Partner mode
printf '%s\n%s\n' "$DN_API_KEY" "$DN_API_USER" | dn configure --mode=partner --stdin

# User mode (pipe an OAuth token)
printf '%s\n' "$DN_OAUTH_TOKEN" | dn configure --mode=user --stdin
```

### Environment variables

[](#environment-variables)

Environment variables override the config file:

```
# Partner mode
export DN_API_KEY="your-api-key"
export DN_API_USER="your-api-user"
export DN_API_URL="https://custom-endpoint.example.com/command"  # optional

# User mode
export DN_OAUTH_TOKEN="your-oauth-token"

# Override mode regardless of config file
export DN_MODE="user"  # or "partner"

# Auto-checkout preference (user mode)
export DN_AUTO_CHECKOUT="both"  # "credits", "card", or "both"
```

### Config file

[](#config-file)

Stored at `~/.config/dn/config.json` with `0600` permissions:

```
{
    "mode": "partner",
    "api_key": "your-api-key",
    "api_user": "your-api-user"
}
```

```
{
    "mode": "user",
    "oauth_token": "your-oauth-token",
    "auto_checkout": "both"
}
```

To remove stored credentials:

```
dn reset
```

Commands
--------

[](#commands)

### Check domain availability

[](#check-domain-availability)

Both modes.

```
dn check example.com
dn check example.com example.net example.org
```

### Get domain suggestions

[](#get-domain-suggestions)

Both modes.

```
dn suggest "coffee shop"

# Filter by TLDs and limit results
dn suggest "coffee" --tlds=com,net,io --count=20

# Exact match only
dn suggest "mycoffee" --exact
```

### Register a domain

[](#register-a-domain)

In **partner mode**, registers the domain directly:

```
# Interactive — prompts for contact details
dn register newdomain.com

# Non-interactive with all options
dn register newdomain.com \
  --first-name=Jane \
  --last-name=Doe \
  --email=jane@example.com \
  --phone=+1.5551234567 \
  --address="123 Main St" \
  --city="San Francisco" \
  --state=CA \
  --postal-code=94110 \
  --country=US \
  --period=2 \
  --privacy=on
```

In **user mode**, adds the domain to your WordPress.com cart and prints a checkout link:

```
dn register newdomain.com

# With a specific site
dn register newdomain.com --site=mysite.wordpress.com
```

#### Auto-checkout (user mode)

[](#auto-checkout-user-mode)

Complete purchases from the terminal without opening a browser. Requires a saved payment method or account credits, and contact information on file from a previous purchase.

```
# Auto-checkout: try credits first, then stored card
dn register newdomain.com --auto-checkout

# Use account credits only
dn register newdomain.com --auto-pay-credits

# Use a stored payment method only
dn register newdomain.com --auto-pay-card

# Skip confirmation prompt (for scripts)
dn register newdomain.com --auto-checkout --yes
```

Set a persistent preference during `dn configure` or with the `DN_AUTO_CHECKOUT` environment variable (`credits`, `card`, or `both`).

### Cart and checkout (user mode)

[](#cart-and-checkout-user-mode)

```
dn cart
dn checkout
dn checkout --site=mysite.wordpress.com
```

`dn register` adds to cart, `dn cart` shows what's in it, `dn checkout` opens WordPress.com checkout in your browser.

### Domain information

[](#domain-information)

Partner mode. In user mode, points you to WordPress.com.

```
dn info example.com
```

### Transfer a domain

[](#transfer-a-domain)

Both modes. Transfers a domain from another registrar. The domain must be unlocked and you need the EPP authorization code.

In **partner mode**, submits the transfer directly:

```
dn transfer example.com --auth-code=ABC123XYZ
```

In **user mode**, validates the auth code, adds the transfer to your WordPress.com cart, and prints a checkout link:

```
dn transfer example.com

# With a specific site
dn transfer example.com --site=mysite.wordpress.com
```

Auto-checkout works the same as with `dn register`:

```
dn transfer example.com --auto-checkout
dn transfer example.com --auto-pay-credits --yes
```

### Partner mode commands

[](#partner-mode-commands)

The remaining commands are partner mode only. In user mode, they'll point you to WordPress.com where you can manage these settings.

```
dn renew example.com --expiration-year=2026 --period=1
dn delete example.com
dn restore example.com
```

#### DNS

[](#dns)

```
dn dns:get example.com
dn dns:set example.com --type=A --name=@ --value=1.2.3.4 --ttl=3600
dn dns:set example.com --type=A --name=@ --value=1.2.3.4 --value=5.6.7.8
```

Supported record types: `A`, `AAAA`, `ALIAS`, `CAA`, `CNAME`, `MX`, `NS`, `PTR`, `TXT`, `SRV`.

#### Contacts, privacy, transfer lock

[](#contacts-privacy-transfer-lock)

```
dn contacts:set example.com
dn contacts:set example.com --type=admin --first-name=Jane --last-name=Doe --email=admin@example.com

dn privacy example.com on      # enable privacy service
dn privacy example.com off     # disclose contact info
dn privacy example.com redact  # redact contact info

dn transferlock example.com on
dn transferlock example.com off
```

Command reference
-----------------

[](#command-reference)

CommandModeDescription`dn configure`—Set up credentials and select mode`dn reset`—Remove stored configuration`dn check ...`bothCheck availability and pricing`dn suggest `bothGet domain name suggestions`dn register `bothRegister a domain (partner) or add to cart (user)`dn cart`userView your shopping cart`dn checkout`userOpen WordPress.com checkout in browser`dn info `partnerDomain details and status`dn renew `partnerRenew registration`dn delete `partnerDelete a domain`dn restore `partnerRestore a deleted domain`dn transfer `bothTransfer a domain in (partner: direct, user: add to cart)`dn dns:get `partnerView DNS records`dn dns:set `partnerSet DNS records`dn contacts:set `partnerUpdate contact information`dn privacy  `partnerWHOIS privacy settings`dn transferlock  `partnerTransfer lock controlClaude Code plugin
------------------

[](#claude-code-plugin)

If you use [Claude Code](https://claude.com/claude-code), you can install the `domain-names` plugin for guided domain management skills:

```
/plugin marketplace add Automattic/dn-cli
/plugin install domain-names

```

Run `/domain-names:setup` to verify the CLI is installed and configured. Then use skills like `/domain-names:dn-check`, `/domain-names:dn-register`, etc.

Shell completion
----------------

[](#shell-completion)

```
# Bash
dn completion bash | sudo tee /etc/bash_completion.d/dn

# Zsh
dn completion zsh | sudo tee /usr/local/share/zsh/site-functions/_dn

# Fish
dn completion fish | tee ~/.config/fish/completions/dn.fish
```

License
-------

[](#license)

GPL-2.0-or-later

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance86

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 89.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~5 days

Total

5

Last Release

88d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7c5869ecbb8e0eac7e8b8e0f3cf7bdd8d5fcdc4abc10a72281872c53f8639d44?d=identicon)[automattic](/maintainers/automattic)

---

Top Contributors

[![p3ob7o](https://avatars.githubusercontent.com/u/1436372?v=4)](https://github.com/p3ob7o "p3ob7o (51 commits)")[![claude](https://avatars.githubusercontent.com/u/81847?v=4)](https://github.com/claude "claude (6 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/automattic-dn-cli/health.svg)

```
[![Health](https://phpackages.com/badges/automattic-dn-cli/health.svg)](https://phpackages.com/packages/automattic-dn-cli)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.2k532.1M2.5k](/packages/aws-aws-sdk-php)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19564.8M1.6k](/packages/drupal-core)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.8M712](/packages/sylius-sylius)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6941.5M396](/packages/drupal-core-recommended)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.4M519](/packages/shopware-core)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
