Automating the ChunkHost DNS


I’ve been using ChunkHost for the past few months. They are a VPS provider and are very cheap, their customer service is excellent and today I was informed about a nascent API for controlling your chunk’s DNS.

This is a really nice tool that they’re releasing, as it allows everything my upcoming project will do, to be automated, which is always nice. If you’ve not checked them out, take a look (disclaimer: this is my referral link).

How do I get started?

So if you’re like me, you’ve never actually seen this page. This is one of the key pages as it’s where we get our data about the domains that we control.

Getting the domain list

curl -u ‘’ -H ‘Accept: application/json’

This will get our list of domains that we can can edit, and give us a useable id to use.

Creating a domain

curl -u ‘’ -H ‘Accept: application/json’ -H ‘Content-type: application/json’ –data ‘{“domain”:{“name”:””}}’ -X POST

On successfully creating a domain, we will get a 201 response with the value of;

Deleting a domain

curl -u ‘’ -H ‘Accept: application/json’ -X DELETE

This will (presumably, I haven’t checked and I wasn’t told) delete a domain, if you can believe the title and the -X DELETE parameter.

Get the record listings for a domain (use the id from above)

curl -u ‘’ -H ‘Accept: application/json’

Gather all of the record listings for a domain using the ID that we either retrieved or created previously. This is our result.

Creating a record (with post)

curl -u ‘’ -H ‘Accept: application/json’ -H ‘Content-type: application/json’ –data ‘{“record”:{“name”:”some_new_subdomain”,”kind”:”TXT”,”content”:”Hey fancypants!”}}’ -X POST

This will allow us to create a record for the domain we are using, we can specify the canonical name, the type of the record (CNAME, TXT, MX, PTR, SPF, A, AAAA etc), and the content.
{“record”:{“name”:”some_new_subdomain”,”kind”:”TXT”,”ttl”:3600,”fqdn”:””,”priority”:10,”domain_id”:712479003,”id”:1022740758,”content”:”Hey fancypants!”}}

Updating a record (With PUT)

curl -u ‘’ -H ‘Accept: application/json’ -H ‘Content-type: application/json’ –data ‘{“record”:{“kind”:”CNAME”,”content”:””}}’ -X PUT

This will update the record that you specify (record 932868131 on the domain 214305242) so that all of your web traffic will be routed to my blog. Not a bad trade, my knowledge for your users?

Deleting a record (with delete)

curl -u ‘’ -H ‘Accept: application/json’ -X DELETE

Simply delete a record (not a domain), it doesn’t get any simpler than that.

Official Documentation

There is currently no official documentation, although once the api matures it will be released – I’ll blog about it, and ChunkHost will tweet/blog about it.

Upcoming Features

Rumour has it that there may possibly be authentication keys involved, allowing you to give people only certain control to portions of your server. Pesky clients want their mail server updated? Well now they can do it themselves!

Disclaimer: This api is subject to change thus making this post incorrect. It is correct as of 30/10/2013. All information was given by Nate@ChunkHost.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s