Getting started with the Porkbun DNS API
Good news, hobbyists, tinkerers, hackers, and other assorted nerds: you can now manipulate Porkbun DNS programmatically via our RESTful API (documented here.)
To kick-start your API adventure, we built a few basic programs that already know how to talk to the API:
- Porkbun's Dynamic DNS client (Python edition)
- Porkbun's Dynamic DNS client (Java edition)
- Porkbun's SSL Certbot Alternative
- DomainCopy (A PHP program that copies DNS zones with 94.2% accuracy)
Generating API Keys
Whether you're using one of our example apps or coding your own, the first thing you'll need to do is generate an API key and a Secret Key:
- Log in. You should arrive at the Domain Management screen.
- Click on ACCOUNT in the top-right corner and select "API Access"
- Under the yellow box, type the name of the key you want to create. You can call it whatever you want, for example: "mykey". Click Create API Key.
- A green box will appear containing your API Key and your Secret Key
Do not close or navigate away from the page with the green SUCCESS! message until you have saved your Secret Key. It will only be visible to you this one time. If you close this page before you save your Secret Key, you'll have to delete the key and generate a new one.
Installing keys and enabling API access on specific domains
- Install the key by copying and pasting the API and Secret keys you generated in the previous section into the configuration for your application. For instance, if you're using a Porkbun Dynamic DNS client, you'll want to rename config.json.example to config.json, copy and paste the corresponding values into the file, then save the file.
- You still need to switch on API access for each individual domain to be manipulated via API. Click on ACCOUNT in the top-right corner and select Domain Management.
Locate the domain on which you wish to enable API access. Click Details to the far right, then click the switch to the right of "API ACCESS" in the leftmost column.
Congrats, you successfully generated API keys, installed the keys, and switched on access for at least one domain. You can now use the Dynamic DNS client or other Porkbun utilities that use the API. Or, if you're coding your own program from scratch, here's a link to the API reference.