How to Manage Routespublic

Last verified 22 Sep 2026

A Virtual Private Cloud (VPC) is a private network interface for collections of DigitalOcean resources. VPC networks are inaccessible from the public internet and other VPC networks, and traffic on them doesn’t count against bandwidth usage. You can link VPC networks to each other using VPC peering connections.

Note

VPC subnets and routes are in public preview and available to all customers without opting in from the Feature Preview page. During the public preview, you manage subnets and routes with the DigitalOcean API. The Control Panel does not support them yet.

Routes determine how traffic from a VPC or subnet reaches its destination. VPC-scoped routes are read-only. On a subnet, you can create static routes that direct traffic to a target you manage, such as a Droplet acting as a firewall or VPN gateway. During the public preview, routes are available through the DigitalOcean API only.

Prerequisites

List VPC Routes

To list the routes that apply to an entire VPC network, send a GET request to the /v2/vpcs/<vpc-id>/routes endpoint, replacing <vpc-id> with your VPC’s ID:

curl -X GET \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  "https://api.digitalocean.com/v2/vpcs/<vpc-id>/routes"

The response is paginated and lists each route’s ID, type, destination CIDR, target URNs, and whether it is modifiable. For example, when you create a subnet, DigitalOcean creates a VPC-scoped route to the subnet’s IP range:

Output
{
  "routes": [
    {
      "id": "f0e1d2c3-b4a5-6789-0fed-cba987654321",
      "type": "STATIC",
      "destination_cidr": "192.168.11.0/24",
      "target_urns": ["do:vpc_subnet:4de7ac8b-495b-4884-9a69-1050c6793cd6"],
      "modifiable": false,
      "created_at": "2026-07-30T10:00:00Z"
    }
  ],
  "meta": {
    "total": 1
  }
}

VPC-scoped routes are read-only. You cannot create, update, or delete routes at the VPC scope. To add your own routes, use subnet routes instead.

List Subnet Routes

To list the routes for a subnet, send a GET request to the /v2/vpcs/<vpc-id>/subnets/<subnet-id>/routes endpoint:

curl -X GET \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  "https://api.digitalocean.com/v2/vpcs/<vpc-id>/subnets/<subnet-id>/routes"

The response includes both the VPC-scoped routes propagated into the subnet’s effective routing and any routes defined on the subnet itself. Routes with modifiable set to true are static routes you created on the subnet and can update or delete. Routes with modifiable set to false are managed by DigitalOcean, including DYNAMIC routes and static routes created by products like DigitalOcean Kubernetes (DOKS).

Create a Subnet Route

To create a static route on a subnet, send a POST request to the /v2/vpcs/<vpc-id>/subnets/<subnet-id>/routes endpoint. The request body requires a destination_cidr (an IPv4 CIDR) and target_urns referencing a supported next hop type, such as a Droplet. The target_urns field accepts a list, but routes currently support only one target:

curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  -d '{
    "destination_cidr": "0.0.0.0/0",
    "target_urns": ["do:droplet:14aa1d1b-e6ab-4ccb-bb10-dade56fcb8ec"]
}' \
  "https://api.digitalocean.com/v2/vpcs/<vpc-id>/subnets/<subnet-id>/routes"

The server assigns the route’s ID and type. Subnet routes do not replace VPC-scoped routes; they are additional to the routes the VPC already propagates to the subnet.

Update a Subnet Route

To change the target of a static route you created, send a PATCH request to the /v2/vpcs/<vpc-id>/subnets/<subnet-id>/routes/<route-id> endpoint with the new target_urns:

curl -X PATCH \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  -d '{
    "target_urns": ["do:droplet:aa5c334c-eab4-4bde-ae21-daed56fcb9ec"]
}' \
  "https://api.digitalocean.com/v2/vpcs/<vpc-id>/subnets/<subnet-id>/routes/<route-id>"

The request fails if the route is not a user-created static subnet route.

Delete a Subnet Route

To delete a static route you created, send a DELETE request to the /v2/vpcs/<vpc-id>/subnets/<subnet-id>/routes/<route-id> endpoint:

curl -X DELETE \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  "https://api.digitalocean.com/v2/vpcs/<vpc-id>/subnets/<subnet-id>/routes/<route-id>"

A successful request returns a 204 status code with no response body. The server rejects the request if the route is managed by DigitalOcean.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.