Skip to contents

Deletes DNS records on Netlify for the specified domain using the deleteDnsRecord endpoint of Netlify's REST API. DNS records must be provided as either a character vector of record identifiers or a dataframe/tibble with an id column. Further columns are silently ignored.

Usage

netlify_dns_records_delete(records, domain, token, max_tries = 3L)

Arguments

records

DNS records to delete. A character vector of record identifiers or a dataframe/tibble with an id column. Further columns are silently ignored.

domain

Domain name to delete DNS records for. This is translated into the corresponding Netlify DNS Zone. A character scalar.

token

Personal access token used for authentication.

max_tries

Maximum number of attempts to retry in case of an HTTP error. An integerish scalar.

Value

A character vector of deleted record identifiers, invisibly.

Details

Supported are the DNS record types ALIAS, CAA, CNAME, MX, NS, SPF, SRV and TXT. A and AAAA (or NETLIFY and NETLIFY6, respectively) cannot be deleted via the API, but must be configured via Netlify's web interface instead.

See also

Other Netlify functions: netlify_dns_records_get(), netlify_dns_records_set()

Examples

if (FALSE) {
yay::netlify_dns_records_delete(domain = "my.site",
                                records = "xyz123",
                                token = Sys.getenv("NETLIFY_PAT"))

# The output of `netlify_dns_records_get()` can directly be fed. To delete all (!) records:
yay::netlify_dns_records_get(domain = "my.site",
                             token = Sys.getenv("NETLIFY_PAT")) |>
  dplyr::filter(!managed) |>
  yay::netlify_dns_records_delete(domain = "my.site",
                                  token = Sys.getenv("NETLIFY_PAT"))}