Official OnlyDNS CLI Tool
Fast, type-safe, zero-bloat command-line interface for the OnlyDNS System API. Manage DNS zones, records, 1-click DNSSEC, and TSIG dynamic keys directly from your terminal, GitHub Actions, or AI agent runtimes.
Installation & Execution
Deploy the CLI tool across local workstations, continuous integration runners, or containerized environments.
Global Installation (npm / pnpm / bun)
Recommended
Install globally to make the onlydns command available system-wide in any terminal shell:
# Install globally with npm
npm install -g @onlydns/cli
# Or with pnpm or Bun
pnpm add -g @onlydns/cli
bun add -g @onlydns/cli
onlydns --version
Instant Run via npx / bunx
Zero InstallExecute single commands on-demand without permanently installing packages to your system:
# Run any command directly via npx
npx @onlydns/cli domains list
# Filter records with bunx
bunx @onlydns/cli records find example.com --name api
Authentication & Configuration
Flexible credential resolution designed for secure workstations and automated deployment pipelines.
Resolution Priority Order
The CLI automatically checks for authentication tokens in the following order:
- CLI Argument:
--api-key <token>or-k <token> - Environment Variable:
ONLYDNS_API_KEYorONLYDNS_API_TOKEN - Encrypted Config: Stored profile in
~/.config/onlydns/config.json(permissions mode0600)
1. Storing Your Token (Local Dev)
# Save your API token securely to ~/.config/onlydns/config.json (mode 0600)
onlydns config login <YOUR_API_KEY>
# Check authentication status
onlydns config show
# View configuration path
onlydns config path
# Clear stored credentials
onlydns config clear
2. Using Environment Variables (CI/CD & Docker)
# Export API key in shell session or CI pipeline secret
export ONLYDNS_API_KEY="odn_live_your_token_here"
# Execute commands directly
onlydns domains list
Command Reference & Examples
Real-world examples covering everyday DNS operations, DNSSEC management, and TSIG key provisioning.
Structured JSON Output & Global Flags
Every command outputs machine-readable JSON for integration into shell pipelines, jq filters, and autonomous agents.
Piping with jq & Shell Scripts
Use the --json flag to receive parseable JSON responses:
# Extract active A record IPs with jq
onlydns --json records list example.com | \
jq -r '.[] | select(.type=="A") | .records[]'
# Check domain DNSSEC status programmatically
STATUS=$(onlydns --json dnssec status example.com | jq -r .enabled)
if [ "$STATUS" = "true" ]; then
echo "DNSSEC verified!"
fi
Global Options
| Flag | Description |
|---|---|
--json |
Output responses in structured JSON |
-k, --api-key |
Explicit API token override |
--base-url |
Custom API base URL endpoint |
--timeout |
HTTP request timeout in seconds (default: 30) |
-h, --help |
Display inline help and command syntax |
Explore the Source Code on GitHub
Inspect the implementation, read the full README, submit feature requests, report bugs, or contribute to @onlydns/cli on GitHub.
CLI Tool FAQ
How do I generate an API token for the CLI?
Log into the OnlyDNS Portal > Developers > API Tokens and click Create API Token. You can then run onlydns config login <token> to save it locally.
Can I use the CLI in TypeScript / Node.js scripts programmatically?
Yes. You can import { runCli } directly from @onlydns/cli:
import { runCli } from '@onlydns/cli';
await runCli(['records', 'list', 'example.com', '--json']);
How quickly do changes made via CLI propagate?
All modifications executed through the CLI synchronize across all 23 global Anycast edge nodes in real time, typically completing within 0.2 to 5 seconds.
Supercharge Your Terminal with OnlyDNS CLI
250,000 monthly DNS queries included on all free accounts. Start automating your DNS infrastructure today.