How to Delete Reserved IPs

A DigitalOcean Reserved IP address is a publicly-accessible static IP address that you can assign to a Droplet and then reassign to another Droplet later, as needed. You can implement a failover mechanism with reserved IPs to build a high availability infrastructure.


Deleting a reserved IP unassigns it and permanently removes it from your account.

Delete an Assigned IP Using Automation

How to delete a Reserved IP using the DigitalOcean CLI

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

                  doctl compute reserved-ip delete <reserved-ip> [flags]
                

    The following example deletes the reserved IP address 203.0.113.25

                   doctl compute reserved-ip delete 203.0.113.25
                
How to delete a Reserved IP using the DigitalOcean API

To delete a Reserved IP 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/reserved_ips/{reserved_ip}

    cURL

    To delete a Reserved IP with cURL, call:

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

    Go

    Go developers can use Godo, the official DigitalOcean V2 API client for Go. To delete a Reserved IP 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.ReservedIPs.Delete(ctx, "45.55.96.34")
    }

    Ruby

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

    
                    require 'droplet_kit'
    token = ENV['DIGITALOCEAN_TOKEN']
    client = DropletKit::Client.new(access_token: token)
    
    client.reserved_ips.delete(ip: '45.55.96.47') 

    Python

    
                    import os
    from pydo import Client
    
    client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))
    
    resp = client.reserved_ips.delete(reserved_ip="45.55.96.47")

Delete an Assigned IP Using the Control Panel

To delete a reserved IP from the control panel, click Networking in the main navigation, then click the Reserved IPs tab. Open the More menu of the reserved IP you want to delete, then click Delete.

Reserved IP with more menu open

In the confirmation window, click Delete Reserved IP to perform the deletion.