Gandi - Registrar & DNS
by @chrisagiddings
Comprehensive Gandi domain registrar integration for domain and DNS management. Register and manage domains, create/update/delete DNS records (A, AAAA, CNAME...
clawhub install gandi-skillπ About This Skill
name: gandi description: "Comprehensive Gandi domain registrar integration for domain and DNS management. Register and manage domains, create/update/delete DNS records (A, AAAA, CNAME, MX, TXT, SRV, and more), configure email forwarding and aliases, check SSL certificate status, create DNS snapshots for safe rollback, bulk update zone files, and monitor domain expiration. Supports multi-domain management, zone file import/export, and automated DNS backups. Includes both read-only and destructive operations with safety controls." disable-model-invocation: true metadata: {"openclaw":{"version":"0.2.7","disable-model-invocation":true,"capabilities":["dns-modification","email-management","domain-registration","destructive-operations"],"credentials":{"type":"file","location":"~/.config/gandi/api_token","description":"Gandi Personal Access Token (PAT)","permissions":600},"requires":{"bins":["node","npm"],"env":["GANDI_API_TOKEN"]},"primaryEnv":"GANDI_API_TOKEN"}}
Gandi Domain Registrar Skill
Comprehensive Gandi domain registrar integration for Moltbot.
Status: β Phase 2 Complete - DNS modification & snapshots functional
β οΈ Security Warning
This skill can perform DESTRUCTIVE operations on your Gandi account:
Before running ANY script:
1. Review the script code to understand what it does
2. Create DNS snapshots before bulk changes (create-snapshot.js)
3. Use read-only Personal Access Tokens where possible
4. Test on non-production domains first
5. Understand that some operations cannot be undone
Destructive scripts (β οΈ modify or delete data):
add-dns-record.js, delete-dns-record.js, update-dns-bulk.jsadd-email-forward.js, update-email-forward.js, delete-email-forward.jsrestore-snapshot.js (replaces current DNS)Read-only scripts (β safe, no modifications):
list-domains.js, list-dns.js, list-snapshots.jslist-email-forwards.js, check-domain.js, check-ssl.jsπ For complete script documentation: See SCRIPTS.md for detailed information about:
Current Capabilities
Phase 1 (Complete)
Phase 2 (Complete)
Coming Soon (Phase 3+)
Setup
Step 1: Create Personal Access Token
β οΈ Security Recommendation: Use the minimum required scopes for your use case.
1. Go to Gandi Admin β Personal Access Tokens 2. Click "Create a token" 3. Select your organization 4. Choose scopes: Read-Only (Recommended for viewing only): - β Domain: read (required for listing domains) - β LiveDNS: read (required for viewing DNS records) - β Email: read (required for viewing email forwards) Write Access (Required for modifications - use with caution): - β οΈ LiveDNS: write (enables DNS modification, deletion, bulk operations) - β οΈ Email: write (enables email forward creation, updates, deletions)
5. Copy the token (you won't see it again!)
Security Best Practices:
Step 2: Store Token
Scripts check for credentials in priority order:
1. GANDI_API_TOKEN environment variable (checked first)
2. ~/.config/gandi/api_token file (fallback if env var not set)
Choose the method that fits your workflow:
#### Option A: Environment Variable (Recommended for CI/CD)
# Set environment variable (replace YOUR_PAT with actual token)
export GANDI_API_TOKEN="YOUR_PERSONAL_ACCESS_TOKEN"Add to shell profile for persistence (~/.bashrc, ~/.zshrc, etc.)
echo 'export GANDI_API_TOKEN="YOUR_PERSONAL_ACCESS_TOKEN"' >> ~/.bashrc
Benefits:
#### Option B: File-based (Recommended for local development)
# Create config directory
mkdir -p ~/.config/gandiStore your token (replace YOUR_PAT with actual token)
echo "YOUR_PERSONAL_ACCESS_TOKEN" > ~/.config/gandi/api_tokenSecure the file (owner read-only)
chmod 600 ~/.config/gandi/api_token
Benefits:
Step 3: Install Dependencies
Required: Node.js >= 18.0.0
cd gandi-skill/scriptsInstall npm dependencies
npm installVerify installation
npm list --depth=0
Expected packages:
Troubleshooting:
node or npm not found: Install Node.js from nodejs.orgsudo - fix npm permissions or use nvmnode_modules/ and package-lock.json, then npm install againStep 4: Test Authentication
cd gandi-skill/scripts
node test-auth.js
Expected output:
β
Authentication successful!Your organizations:
1. Personal Account (uuid-here)
Type: individual
π You're ready to use the Gandi skill!
Step 5: Setup Contact Information (Optional, for Domain Registration)
If you plan to register domains, save your contact information once for reuse:
cd gandi-skill/scripts
node setup-contact.js
The script will prompt for:
Contact information is saved to:
~/.config/gandi/contact.jsonPrivacy Options:
1. RETAIN (default): Keep contact saved for future registrations
- Best for frequent domain registrations
- Setup once, use forever
- Delete manually anytime with delete-contact.js
2. PURGE: Auto-delete contact after each registration - Best for privacy-conscious users - Contact info only exists during registration - Must re-enter for next registration
Managing saved contact:
# View current contact
node view-contact.jsUpdate contact info or privacy preference
node setup-contact.jsDelete saved contact manually
node delete-contact.jsDelete without confirmation
node delete-contact.js --force
One-time purge override:
# Register and delete contact (even if preference is "retain")
node register-domain.js example.com --purge-contact
Usage Examples
List Your Domains
node list-domains.js
Output shows:
List DNS Records
node list-dns.js example.com
Output shows:
Using from Moltbot
Once configured, you can use natural language:
> "List my Gandi domains"
> "Show DNS records for example.com"
> "When does example.com expire?"
> "Is auto-renewal enabled for example.com?"
Domain Availability Checking
Check Single Domain
Check if a specific domain is available for registration:
node check-domain.js example.com
Features:
Example Output:
π Checking availability for: example.comDomain: example.com
β
Status: AVAILABLE
π° Pricing:
1 year: 12.00 EUR (+ 2.40 tax)
2 years: 24.00 EUR (+ 4.80 tax)
π Supported Features:
β’ create
β’ dnssec
β’ livedns
π TLD Information:
Extension: com
Smart Domain Suggestions
Find available alternatives with TLD variations and name modifications:
# Check all configured TLDs + variations
node suggest-domains.js exampleCheck specific TLDs only
node suggest-domains.js example --tlds com,net,ioSkip name variations (only check TLDs)
node suggest-domains.js example --no-variationsOutput as JSON
node suggest-domains.js example --json
Name Variation Patterns:
1. Hyphenated: Adds hyphens between word boundaries (example β ex-ample)
2. Abbreviated: Removes vowels (example β exmpl)
3. Prefix: Adds common prefixes (example β get-example, my-example)
4. Suffix: Adds common suffixes (example β example-app, example-hub)
5. Numbers: Appends numbers (example β example2, example3)
Example Output:
π Checking availability for: exampleπ Checking 13 TLDs and generating variations...
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π EXACT MATCHES (Different TLDs)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
Available:
example.net 12.00 EUR
example.io 39.00 EUR
example.dev 15.00 EUR
β Unavailable:
example.com (unavailable)
example.org (unavailable)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π¨ NAME VARIATIONS
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Hyphenated:
β
ex-ample.com 12.00 EUR
Prefix:
β
get-example.com 12.00 EUR
β
my-example.com 12.00 EUR
Suffix:
β
example-app.com 12.00 EUR
β
example-io.com 12.00 EUR
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π SUMMARY: 8 available domains found
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Configuration
Domain checker configuration is stored in gandi-skill/config/domain-checker-defaults.json.
Structure:
{
"tlds": {
"mode": "extend",
"defaults": ["com", "net", "org", "info", "io", "dev", "app", "ai", "tech"],
"custom": []
},
"variations": {
"enabled": true,
"patterns": ["hyphenated", "abbreviated", "prefix", "suffix", "numbers"],
"prefixes": ["get", "my", "the", "try"],
"suffixes": ["app", "hub", "io", "ly", "ai", "hq"],
"maxNumbers": 3
},
"rateLimit": {
"maxConcurrent": 3,
"delayMs": 200,
"maxRequestsPerMinute": 100
},
"limits": {
"maxTlds": 5,
"maxVariations": 10
}
}
Rate Limiting & Limits:
These limits ensure good API citizenship and prevent overwhelming Gandi's API.
TLD Modes:
"extend": Use defaults + custom TLDs (merged list)"replace": Use only custom TLDs (ignore defaults)Gateway Console Integration:
When Gateway Console support is added (#3), configuration will be available at:
skills:
entries:
gandi:
config:
domainChecker:
tlds:
mode: extend
defaults: [...]
custom: [...]
variations:
enabled: true
patterns: [...]
See docs/gateway-config-design.md for complete configuration architecture.
DNS Management (Phase 2)
Add or Update DNS Records
Create or update individual DNS records:
# Add an A record for root domain
node add-dns-record.js example.com @ A 192.168.1.1Add www subdomain pointing to root
node add-dns-record.js example.com www CNAME @Add MX record for email
node add-dns-record.js example.com @ MX "10 mail.example.com."Add TXT record for SPF
node add-dns-record.js example.com @ TXT "v=spf1 include:_spf.google.com ~all"Add with custom TTL (5 minutes)
node add-dns-record.js example.com api A 192.168.1.10 300
Supported record types: A, AAAA, CNAME, MX, TXT, NS, SRV, CAA, PTR
Delete DNS Records
Remove specific DNS records:
# Delete old A record
node delete-dns-record.js example.com old ADelete with confirmation prompt
node delete-dns-record.js example.com test CNAMEDelete without confirmation
node delete-dns-record.js example.com old A --force
Bulk DNS Operations
Replace all DNS records at once:
# From JSON file
node update-dns-bulk.js example.com new-records.jsonFrom stdin
cat records.json | node update-dns-bulk.js example.comSkip automatic snapshot
node update-dns-bulk.js example.com records.json --no-snapshotSkip confirmation
node update-dns-bulk.js example.com records.json --force
JSON format:
[
{
"rrset_name": "@",
"rrset_type": "A",
"rrset_ttl": 10800,
"rrset_values": ["192.168.1.1"]
},
{
"rrset_name": "www",
"rrset_type": "CNAME",
"rrset_ttl": 10800,
"rrset_values": ["@"]
},
{
"rrset_name": "@",
"rrset_type": "MX",
"rrset_ttl": 10800,
"rrset_values": ["10 mail.example.com.", "20 mail2.example.com."]
}
]
DNS Zone Snapshots
Create safety backups before making changes:
# Create a snapshot
node create-snapshot.js example.com "Before migration"List all snapshots
node list-snapshots.js example.comRestore from a snapshot
node restore-snapshot.js example.com abc123-def456-ghi789Restore without confirmation
node restore-snapshot.js example.com abc123-def456-ghi789 --force
Automatic snapshots:
--no-snapshot)Common DNS Configuration Examples
#### Basic Website Setup
# Root domain
node add-dns-record.js example.com @ A 192.168.1.1WWW subdomain
node add-dns-record.js example.com www CNAME @
#### Email Configuration (Google Workspace)
# MX records
node add-dns-record.js example.com @ MX "1 ASPMX.L.GOOGLE.COM."
node add-dns-record.js example.com @ MX "5 ALT1.ASPMX.L.GOOGLE.COM."
node add-dns-record.js example.com @ MX "5 ALT2.ASPMX.L.GOOGLE.COM."SPF record
node add-dns-record.js example.com @ TXT "v=spf1 include:_spf.google.com ~all"
#### Domain Redirect Setup To redirect one domain to another:
# Point root domain to same server
node add-dns-record.js old-domain.com @ A 192.168.1.1Point www to same CNAME
node add-dns-record.js old-domain.com www CNAME @
Then configure HTTP 301 redirect at the server level.
#### Subdomain Setup
# API subdomain
node add-dns-record.js example.com api A 192.168.1.10Staging subdomain
node add-dns-record.js example.com staging A 192.168.1.20Wildcard subdomain
node add-dns-record.js example.com "*" A 192.168.1.100
Email Forwarding (Phase 2)
List Email Forwards
See all email forwards configured for a domain:
node list-email-forwards.js example.com
Create Email Forwards
Forward emails to one or more destinations:
# Simple forward
node add-email-forward.js example.com hello you@personal.comForward to multiple destinations
node add-email-forward.js example.com support team1@example.com team2@example.comCatch-all forward (forwards all unmatched emails)
node add-email-forward.js example.com @ catchall@example.com
Update Email Forwards
Change the destination(s) for an existing forward:
# Update single destination
node update-email-forward.js example.com hello newemail@personal.comUpdate to multiple destinations
node update-email-forward.js example.com support new1@example.com new2@example.com
Note: This replaces all existing destinations with the new ones.
Delete Email Forwards
Remove email forwards:
# Delete with confirmation prompt
node delete-email-forward.js example.com oldDelete without confirmation
node delete-email-forward.js example.com old --forceDelete catch-all forward
node delete-email-forward.js example.com @ --force
Common Email Forwarding Use Cases
#### Basic Email Forwarding
# Forward contact@ to your personal email
node add-email-forward.js example.com contact you@gmail.comForward sales@ to team
node add-email-forward.js example.com sales team@example.com
#### Domain Migration Email Forwarding
# Forward all email from old domain to new domain
Preserves the local part (username before @)
First, list existing forwards on old domain
node list-email-forwards.js old-domain.comThen create matching forwards on new domain
node add-email-forward.js old-domain.com contact contact@new-domain.com
node add-email-forward.js old-domain.com support support@new-domain.comOr use catch-all to forward everything
node add-email-forward.js old-domain.com @ admin@new-domain.com
#### Team Distribution Lists
# Forward to entire team
node add-email-forward.js example.com team alice@example.com bob@example.com charlie@example.comUpdate team members
node update-email-forward.js example.com team alice@example.com dave@example.com
#### Catch-All Configuration
# Forward all unmatched emails to one address
node add-email-forward.js example.com @ catchall@example.comForward all unmatched emails to multiple addresses
node add-email-forward.js example.com @ admin1@example.com admin2@example.com
Note: Catch-all forwards only apply to email addresses that don't have specific forwards configured.
Email Forward Management Tips
1. Test after creating: Send a test email to verify forwarding works 2. Use specific forwards over catch-all: More control and easier to manage 3. Multiple destinations: Email is sent to all destinations (not round-robin) 4. Order doesn't matter: Gandi processes most specific match first 5. Check spam folders: Forwarded emails may be filtered by recipient's spam filter
Example: Complete Domain Email Setup
# 1. Set up MX records (if not already done)
node add-dns-record.js example.com @ MX "10 spool.mail.gandi.net."
node add-dns-record.js example.com @ MX "50 fb.mail.gandi.net."2. Create specific forwards
node add-email-forward.js example.com hello you@personal.com
node add-email-forward.js example.com support team@example.com
node add-email-forward.js example.com sales sales-team@example.com3. Set up catch-all for everything else
node add-email-forward.js example.com @ admin@example.com4. List all forwards to verify
node list-email-forwards.js example.com
Helper Scripts
All scripts are in gandi-skill/scripts/:
Authentication & Setup
| Script | Purpose | |--------|---------| |test-auth.js | Verify authentication works |
| setup-contact.js | Save contact info for domain registration (run once) |
| view-contact.js | View saved contact information |
| delete-contact.js | Delete saved contact (with optional --force) |Domain & DNS Viewing
| Script | Purpose | |--------|---------| |list-domains.js | Show all domains in account |
| list-dns.js | Show DNS records for domain |
| check-domain.js | Check single domain availability + pricing |
| suggest-domains.js | Smart domain suggestions with variations |
| check-ssl.js | Check SSL certificate status for all domains |DNS Modification (Phase 2)
| Script | Purpose | |--------|---------| |add-dns-record.js [ttl] | Add or update a DNS record |
| delete-dns-record.js [--force] | Delete a DNS record |
| update-dns-bulk.js [--no-snapshot] [--force] | Bulk update all DNS records |
| list-snapshots.js | List DNS zone snapshots |
| create-snapshot.js [name] | Create a DNS zone snapshot |
| restore-snapshot.js [--force] | Restore DNS zone from snapshot |Email Forwarding (Phase 2)
| Script | Purpose | |--------|---------| |list-email-forwards.js | List all email forwards for a domain |
| add-email-forward.js [dest2...] | Create email forward (use @ for catch-all) |
| update-email-forward.js [dest2...] | Update email forward destinations |
| delete-email-forward.js [--force] | Delete email forward |Core Library
| Script | Purpose | |--------|---------| |gandi-api.js | Core API client (importable) |Configuration
Default Configuration
~/.config/gandi/api_token (API authentication)~/.config/gandi/contact.json (domain registration info, optional)https://api.gandi.net (production)Sandbox Testing
To use Gandi's sandbox environment:
# Create sandbox token at: https://admin.sandbox.gandi.net
echo "YOUR_SANDBOX_TOKEN" > ~/.config/gandi/api_token
echo "https://api.sandbox.gandi.net" > ~/.config/gandi/api_url
Troubleshooting
Token Not Found
# Verify file exists
ls -la ~/.config/gandi/api_tokenShould show: -rw------- (600 permissions)
Authentication Failed (401)
Permission Denied (403)
Domain Not Using LiveDNS
If you get "not using Gandi LiveDNS" error: 1. Log in to Gandi Admin 2. Go to domain management 3. Attach LiveDNS service to the domain
Rate Limit (429)
Gandi allows 1000 requests/minute. If exceeded:
API Reference
The skill provides importable functions:
import {
testAuth,
listDomains,
getDomain,
listDnsRecords,
getDnsRecord,
checkAvailability
} from './gandi-api.js';// Test authentication
const auth = await testAuth();
// List domains
const domains = await listDomains();
// Get domain info
const domain = await getDomain('example.com');
// List DNS records
const records = await listDnsRecords('example.com');
// Get specific DNS record
const record = await getDnsRecord('example.com', '@', 'A');
// Check availability
const available = await checkAvailability(['example.com', 'example.net']);
Security
Token Storage
β DO:
~/.config/gandi/api_tokenβ DON'T:
Token Scopes
Phase 1 (current):
Phase 2+ (future):
Architecture
gandi-skill/
βββ SKILL.md # This file
βββ references/ # API documentation
β βββ api-overview.md
β βββ authentication.md
β βββ domains.md
β βββ livedns.md
β βββ setup.md
βββ scripts/ # Helper utilities
βββ package.json
βββ gandi-api.js # Core API client
βββ test-auth.js # Test authentication
βββ list-domains.js # List domains
βββ list-dns.js # List DNS records
Development Roadmap
Phase 1: Read Operations (β Current)
Phase 2: DNS Modifications
Phase 3: Domain Management
Phase 4: Multi-Organization (#1)
Phase 5: Advanced Features
Contributing
See Contributing Guide in the main README.
Support
License
MIT License - See LICENSE
βοΈ Configuration
Domain checker configuration is stored in gandi-skill/config/domain-checker-defaults.json.
Structure:
{
"tlds": {
"mode": "extend",
"defaults": ["com", "net", "org", "info", "io", "dev", "app", "ai", "tech"],
"custom": []
},
"variations": {
"enabled": true,
"patterns": ["hyphenated", "abbreviated", "prefix", "suffix", "numbers"],
"prefixes": ["get", "my", "the", "try"],
"suffixes": ["app", "hub", "io", "ly", "ai", "hq"],
"maxNumbers": 3
},
"rateLimit": {
"maxConcurrent": 3,
"delayMs": 200,
"maxRequestsPerMinute": 100
},
"limits": {
"maxTlds": 5,
"maxVariations": 10
}
}
Rate Limiting & Limits:
These limits ensure good API citizenship and prevent overwhelming Gandi's API.
TLD Modes:
"extend": Use defaults + custom TLDs (merged list)"replace": Use only custom TLDs (ignore defaults)Gateway Console Integration:
When Gateway Console support is added (#3), configuration will be available at:
skills:
entries:
gandi:
config:
domainChecker:
tlds:
mode: extend
defaults: [...]
custom: [...]
variations:
enabled: true
patterns: [...]
See docs/gateway-config-design.md for complete configuration architecture.
π Tips & Best Practices
Token Not Found
# Verify file exists
ls -la ~/.config/gandi/api_tokenShould show: -rw------- (600 permissions)
Authentication Failed (401)
Permission Denied (403)
Domain Not Using LiveDNS
If you get "not using Gandi LiveDNS" error: 1. Log in to Gandi Admin 2. Go to domain management 3. Attach LiveDNS service to the domain
Rate Limit (429)
Gandi allows 1000 requests/minute. If exceeded: