How do I find domain record_id using api v2

Hi, I am using the following api v2 command to create a new A record for users when they register:

curl -X POST -H 'Content-Type: application/json' -H 'Authorization: Bearer **KEY**' -d '{"type":"A","name":"**NAME**","data":"","priority":null,"port":null,"weight":null}' ""

If the user decides to delete their account, I need the A record to be removed as well, but this requires me to provide the record id. how do I find the record id of a record using the api?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Part of the response for the record creation process is the record ID. I would suggest storing this ID so you can easily send it to the delete endpoint when you need to.

This is a far more efficient way than to list all domain records for your domain, and then filter through them by type/name/data to find the ID you need, and then send the delete request.

This is a possible method to achieve what you want, but it’s slower and unnecessary if the ID is saved during the creation process. This method is perhaps good for a fallback in case there is some sort of error using your saved record ID.

See ‘RESPONSE BODY’ on the right: /documentation/v2/#create-a-new-domain-record

Hi, I will find a way to store the outputted id along with the username. Thank you for your response :)