gandi-cli

🌐 DNS

List, create, update, and delete LiveDNS records.

The gandi dns group manages LiveDNS records for a domain. It supports all standard record types and custom TTLs.

📋 List records

List every DNS record for a domain:

gandi dns list example.com

Requires: the Manage technical configuration (domain:tech) permission on your token.

✏️ Create or update a record

gandi dns set creates a record, or replaces it if one already exists for the same type and name:

gandi dns set example.com A www 1.2.3.4

Provide a custom TTL in seconds with --ttl:

gandi dns set example.com A www 1.2.3.4 --ttl 300

This works for any standard record type — A, AAAA, CNAME, MX, TXT, and so on:

gandi dns set example.com CNAME blog example.com
gandi dns set example.com TXT @ "v=spf1 include:_mailcust.gandi.net ~all"

Requires: the Manage technical configuration (domain:tech) permission on your token.

➕ Append a value

A DNS record (rrset) can hold several values — multiple A addresses, several TXT strings, and so on. gandi dns set replaces the whole set, so use gandi dns add to append a value without clobbering the existing ones:

gandi dns add example.com A www 5.6.7.8
gandi dns add example.com TXT @ "google-site-verification=…"

add reads the current record, adds your value, and keeps the existing TTL (override it with --ttl). If the value is already present, it's left untouched.

Requires: the Manage technical configuration (domain:tech) permission on your token.

🔍 Show a record

Print a single record — its values and TTL:

gandi dns get example.com A www

Requires: the Manage technical configuration (domain:tech) permission on your token.

📤 Export the zone

Export the entire zone as a BIND-format master file — handy for backups or review. Redirect it to a file:

gandi dns export example.com > example.com.zone

Requires: the Manage technical configuration (domain:tech) permission on your token.

🗑️ Delete a record

Remove a record by type and name. Deletes ask for confirmation — pass --yes to skip the prompt (for example, in scripts):

gandi dns delete example.com A www --yes

Requires: the Manage technical configuration (domain:tech) permission on your token.

📖 Command reference

CommandDescription
gandi dns list <domain>List all DNS records for a domain
gandi dns set <domain> <type> <name> <value>Create or replace a DNS record
gandi dns set <domain> <type> <name> <value> --ttl <seconds>Set with a custom TTL in seconds
gandi dns add <domain> <type> <name> <value>Append a value without replacing
gandi dns get <domain> <type> <name>Show a single record
gandi dns export <domain>Export the zone as a BIND file
gandi dns delete <domain> <type> <name> --yesDelete a record (skip the prompt)

Not sure which commands your token can run? Use gandi doctor to check your scopes.

On this page