How to Delete Projects

Projects let you organize your DigitalOcean resources into groups that fit the way you work. 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 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.

Delete a Project Using Automation

How to Delete a Project 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 projects delete. Basic usage looks like this, but you can read the usage docs for more details:

                doctl projects delete <project-id> [<project-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
  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

    Using cURL:

                    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

    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.Projects.Delete(ctx, '4e1bfbc3-dc3e-41f2-a18f-1b4d7ba71679')
    }
                  

    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.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")