Showing results for 
Show  only  | Search instead for 
Did you mean: 

Deleting a single DNS record through the API

I'm trying to make a script that does the LetsEncrypt DNS challenge with my domain.  This involves creating a TXT record for the domain to verify.  I have the API call down that lets me add the TXT record, but now I want to delete that one record, and i don't see the API call to do that.  just trying the method DELETE on the /v1/domains/{domain}/records/{type}/{name} endpoint doesn't work, and PUTing and empty record to that same endpoint doesn't do anything.  Any tips?




Did you find a solution to this?


Doesn't look like there is an endpoint to remove a single record, however you can achieve the same result by making two calls, one to a list of all TXT records, removing the records you want to delete, then the second submitting that new list back.


1.  get an array of all TXT records:

GET /v1/domains/{domain}/records/TXT/


in the returned array, locate and remove the record you want to delete


2.  replace all TXT records with this new array 

 PUT /v1/domains/{domain}/records/TXT


The only time this will fail is when you only have one TXT record, as removing that record from the array will result in submitting an empty array to step 2.  The easy fix is to add a dummy TXT record.