Overview
The DNS API module allows you to manage your domain's DNS records. The following options are available.
- List all records (dns-list_records)
- Add a record (dns-add_record)
- Remove a record (dns-remove_record)
View the following article for instructions on how to connect to the DreamHost API. You will use the instructions in this article to construct your API call.
dns-list_records
The dns-list_records command lists all DNS records for all domains on all accounts you have access to. This command will not list records in the following cases:
- Registration only domain
- dreamhosters.com subdomain
Running the command
The following command lists all DNS records for all domains in your account.
https://api.dreamhost.com/?key=1A2B3C4D5E6F7G8H&cmd=dns-list_records
dns-add_record
The dns-add_record allows you to add a new DNS record to a domain (excluding dreamhosters.com subdomains).
After adding a record, it will still take several hours to propagate online.
Running the command
You must specify the following values when running this command.
- record : The domain name you are adding the record to (example.com)
- type : A,CNAME,NS,NAPTR,SRV,TXT, or AAAA
- value : The DNS record's value.
- comment : Optional comment for this record.
The following command adds a TXT record with a value of test123 to the domain example.com.
https://api.dreamhost.com/?key=1A2B3C4D5E6F7G8H&cmd=dns-add_record&record=example.com&type=TXT&value=test123
dns-remove_record
This is the opposite of dns-add_record. The same values must be specified when running the command. The following command removes a TXT record with a value of test123 from the domain example.com.
https://api.dreamhost.com/?key=1A2B3C4D5E6F7G8H&cmd=dns-remove_record&record=example.com&type=TXT&value=test123