How to Delete Projects

Projects let you organize your DigitalOcean resources (like Droplets, Spaces, and load balancers) into groups that fit the way you work. You can create projects that align with the applications, environments, and clients that you host on DigitalOcean.


To delete a project, the following criteria must be true:

  • The project must have no resources in it. To empty out the resources in a project, you can either destroy them or move them into a new project.

  • The project must not be the default project. You can set a different project as the default on the Settings tab of that project.

Delete a Project Using Automation

How to delete a project using the DigitalOcean CLI

To delete a project 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 project with doctl projects delete. The basic usage looks like this, but you'll want to read the usage docs for more details:

                  doctl projects delete <id> [<id> ...] [flags]
                

    The following example deletes the project with the ID f81d4fae-7dec-11d0-a765-00a0c91e6bf6

                   doctl projects delete f81d4fae-7dec-11d0-a765-00a0c91e6bf6
                
How to delete a project using the DigitalOcean API

To delete a project 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/projects/{project_id}

    cURL

    To delete a project with cURL, call:

    
                    curl -X DELETE -H 'Content-Type: application/json' -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
      "https://api.digitalocean.com/v2/projects/4e1bfbc3-dc3e-41f2-a18f-1b4d7ba71679"

    Go

    Go developers can use Godo, the official DigitalOcean V2 API client for Go. To delete a project 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.Projects.Delete(ctx, '4e1bfbc3-dc3e-41f2-a18f-1b4d7ba71679')
    }

    Ruby

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

    
                    require 'droplet_kit'
    token = ENV['DIGITALOCEAN_TOKEN']
    client = DropletKit::Client.new(access_token: token)
    
    client.projects.delete(id: '4e1bfbc3-dc3e-41f2-a18f-1b4d7ba71679') 

    Python

    
                    import os
    from pydo import Client
    
    client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))
    
    resp = client.projects.delete(project_id="fda9fda")

Delete a Project Using the Control Panel

To delete an empty, non-default project, visit the project’s Settings tab.

Settings tab of a project

In the Delete project section, click Delete Project. When prompted, click Confirm Delete. This permanently removes the project from your account.