pydo.vpc_subnet_routes.create()

Generated on 1 Oct 2026 from pydo version v0.43.0

Usage

client.vpc_subnet_routes.create(
    vpc_uuid="997615ce-132d-4bae-9270-9ee21b395e5d",
    subnet_uuid="4de7ac8b-495b-4884-9a69-1050c6793cd6",
    body={
        "destination_cidr": "0.0.0.0/0",
        "target_urns": [...],
    },
)
Returns JSONRaises HttpResponseError

Description

To add a static route to a VPC subnet, send a POST request to /v2/vpcs/{vpc_uuid}/subnets/{subnet_uuid}/routes. This route is additional to the routes the VPC already propagates to the subnet. The server assigns the route’s id and type.

Droplet targets must use a numeric ID. A Droplet UUID or another invalid target_urns value returns a 422 response.

Parameters

vpc_uuid string required

The unique identifier of the VPC.

subnet_uuid string required

The unique identifier of the VPC subnet.

destination_cidr string required

Example: 0.0.0.0/0

A valid IPv4 CIDR accepted by the VPC routing product.

target_urns array of strings required

Example: ['do:droplet:4126873']

The URNs of supported next-hop resources. Droplet targets must use a
numeric ID in the format do:droplet:<id>. VPC NAT Gateway targets use
a UUID in the format do:nat_gateway:<uuid>.

Request Sample

Show Request Sample
import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

req = {
  "destination_cidr": "0.0.0.0/0",
  "target_urns": [
    "do:droplet:4126873"
  ]
}

resp = client.vpc_subnet_routes.create(vpc_uuid="997615ce-132d-4bae-9270-9ee21b395e5d", subnet_uuid="4de7ac8b-495b-4884-9a69-1050c6793cd6", body=req)

Response Example

Show Response Example
{
  "route": {
    "id": "f0e1d2c3-b4a5-6789-0fed-cba987654321",
    "type": "STATIC",
    "destination_cidr": "0.0.0.0/0",
    "target_urns": [
      "do:droplet:4126873"
    ],
    "modifiable": true,
    "created_at": "2026-01-14T10:05:00Z"
  }
}

More Information

See /v2/vpcs/{vpc_uuid}/subnets/{subnet_uuid}/routes in the API reference for additional detail on responses, headers, parameters, and more.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.