Skip to content
vforshPublic

About

CLI for REG.RU API2 (non-reseller): domains, services, and DNS automation

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

Repository files navigation

regru-cli

regru-cli is a Bun-based command line tool for REG.RU API2 focused on non-reseller workflows.

Official API docs: https://www.reg.ru/reseller/api2doc

Install

Requires Bun 1.4.3 or newer. Development uses native TypeScript 7.0.2 (tsc).

bun upgrade
bun add --global @vforsh/regru-cli
regru --help

From a local checkout:

cd ~/dev/regru-cli
bun install
bun link
regru --help

Development checks: bun run typecheck && bun test.

The published package includes the Bun entry point, TypeScript sources, and agent skill.

Auth and config

Secrets are never accepted in argv flags.

regru cfg set username your-username
printf 'your-password' | regru cfg set password -
regru cfg set endpoint=https://api.reg.ru/api/regru2 timeout=20000 retries=1

Config precedence: explicit CLI flags > environment variables > saved config > built-in defaults. Config files are saved with owner-only permissions (0600).

Environment variables:

  • REGRU_USERNAME
  • REGRU_PASSWORD
  • REGRU_ENDPOINT
  • REGRU_TIMEOUT
  • REGRU_RETRIES
  • REGRU_REGION

timeout must be an integer from 1 to 120000 milliseconds; retries must be an integer from 0 to 10. Endpoints must use HTTP or HTTPS. Invalid values exit with code 2. Retries apply to read-only nop and get_* calls after network failures or HTTP 408/429/5xx responses; write operations are sent once.

Quick examples

# Basic connectivity
regru nop

# List all services
regru services list

# List domains only
regru domains list

# Get zone records
regru zone records example.test

# Add DNS TXT record (non-reseller API)
regru zone add txt example.test subdomain=_acme-challenge text='token-value' ttl=300

# Batch DNS update (action_list is sent as structured JSON)
regru zone update example.test 'action_list=[{"action":"add_txt","subdomain":"_acme-challenge","text":"token-value"}]'

# Generic call for any non-reseller endpoint
regru do service/get_list servtype=domain

# Secret API parameters come from stdin
printf 'new-password' | regru do user/create user_login=new-user user_password=- user_email=user@example.test

Commands

  • cfg|config - config management (list|ls|path|get|set|unset|import|export)
  • doctor|check - read-only readiness checks
  • skill - prints skill install URL
  • nop - authenticated no-op check
  • services list
  • domains list
  • zone records|add|remove|update|clear
  • do|run|gen - generic non-reseller method call
  • result, wait - reserved; not supported for REG.RU synchronous API flow

Output modes

  • default: human output
  • --plain: stable line-oriented output
  • --json: single JSON object output

cfg path, cfg set, cfg unset, and skill also honor --json. Errors use { "error": { "message", "exitCode", "details" } } on stdout; a failed doctor --json places its check report in error.details. Usage errors exit with code 2; API/network failures exit with code 1, including per-domain and per-action failures inside a successful API envelope. zone records --plain prints one JSON record per line.

Notes

  • Reseller API methods are intentionally blocked in this CLI.
  • REG.RU can restrict API access by source IP. ACCESS_DENIED_FROM_IP means the request reached REG.RU but its API IP allowlist rejected the connection; check the API access settings and the VPN/direct public IP.
  • Read-only verification: regru doctor, regru nop, regru domains list, regru zone records <domain>.
  • REG.RU provides a test account: REGRU_USERNAME=test REGRU_PASSWORD=test regru --json nop. Test mode validates requests and returns simulated results without making real changes.
  • Full config roundtrip:
regru cfg export --json > cfg.json
regru cfg import --json < cfg.json

About

CLI for REG.RU API2 (non-reseller): domains, services, and DNS automation

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages