How to Delete Domains

Adding a domain you own to your DigitalOcean account lets you manage the domain’s DNS records with the control panel and API. Domains you manage on DigitalOcean integrate with DigitalOcean Load Balancers and Spaces to streamline automatic SSL certificate management.


If you no longer want to manage the DNS records for a domain on DigitalOcean, you can delete the domain. This removes the domain and its DNS records from the account, but it does not delete the domain name registration. The domain registrar manages registration.

Note
To delete a domain that is associated with a Let’s Encrypt certificate used with other DigitalOcean resources, you must first delete the certificate. Make sure to reconfigure anything that used the certificate, like load balancer SSL termination or custom Spaces CDN endpoints.

Delete a Domain Using Automation

How to delete a domain using the DigitalOcean CLI

To delete a domain via the command-line, follow these steps:

  1. Install doctl, the DigitalOcean command-line tool.

  2. Create a personal access token, and save it for use with doctl.

  3. Use the token to grant doctl access to your DigitalOcean account.

                  doctl auth init
                
  4. Finally, delete a domain with doctl compute domain delete. The basic usage looks like this, but you'll want to read the usage docs for more details:

                  doctl compute domain delete <domain> [flags]
                

    The following command deletes the domain example.com

                       doctl compute domain delete example.com
                    
How to delete a domain using the DigitalOcean API

To delete a domain using the DigitalOcean API, follow these steps:

  1. Create a personal access token, and save it for use with the API.

  2. Send a DELETE request to https://api.digitalocean.com/v2/domains/{domain_name}

    cURL

    To delete a domain with cURL, call:

    
                    curl -X DELETE \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
      "https://api.digitalocean.com/v2/domains/example.com"

    Go

    Go developers can use Godo, the official DigitalOcean V2 API client for Go. To delete a domain with Godo, use the following code:

    
                    import (
        "context"
        "os"
    
        "github.com/digitalocean/godo"
    )
    
    func main() {
        token := os.Getenv("DIGITALOCEAN_TOKEN")
    
        client := godo.NewFromToken(token)
        ctx := context.TODO()
    
        _, err := client.Domains.Delete(ctx, "example.com")
    }

    Ruby

    Ruby developers can use DropletKit, the official DigitalOcean V2 API client for Ruby. To delete a domain with DropletKit, use the following code:

    
                    require 'droplet_kit'
    token = ENV['DIGITALOCEAN_TOKEN']
    client = DropletKit::Client.new(access_token: token)
    
    client.domains.delete(name: 'example.com')

    Python

    
                    import os
    from pydo import Client
    
    client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))
    
    delete_resp = client.domains.delete(domain_name="example.com")

Delete a Domain Using the Control Panel

To delete a domain, log in to the control panel and click Networking in the main menu to go to the Domains tab.

A single domain listed

Open the More menu of the domain you want to delete, then click Delete. In the confirmation window, click Delete Domain to permanently delete the domain and its records from the account.