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 use DigitalOcean to manage your domain’s DNS records, you can delete the domain. This removes the domain and its DNS records from your current team. It does not cancel the domain registration because your domain is managed by the registrar you purchased it from.

To delete a domain that is associated with a Let’s Encrypt certificate, you must first delete the certificate and 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
  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, run doctl compute domain delete. Basic usage looks like this, but you can 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
  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

    Using cURL:

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

    Go

    Using Godo, the official DigitalOcean V2 API client for Go:

                    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

    Using DropletKit, the official DigitalOcean V2 API client for Ruby:

                    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.