# Networks # Routes ## List tunnel routes `zero_trust.networks.routes.list(RouteListParams**kwargs) -> SyncV4PagePaginationArray[Teamnet]` **get** `/accounts/{account_id}/teamnet/routes` Lists and filters private network routes in an account. ### Parameters - `account_id: str` Cloudflare account ID - `comment: Optional[str]` Optional remark describing the route. - `existed_at: Optional[str]` If provided, include only resources that were created (and not deleted) before this time. URL encoded. - `is_deleted: Optional[bool]` If `true`, only include deleted routes. If `false`, exclude deleted routes. If empty, all routes will be included. - `network_subset: Optional[str]` If set, only list routes that are contained within this IP range. - `network_superset: Optional[str]` If set, only list routes that contain this IP range. - `page: Optional[float]` Page number of paginated results. - `per_page: Optional[float]` Number of results to display. - `route_id: Optional[str]` UUID of the route. - `tun_types: Optional[List[Literal["cfd_tunnel", "warp_connector", "warp", 4 more]]]` The types of tunnels to filter by, separated by commas. - `"cfd_tunnel"` - `"warp_connector"` - `"warp"` - `"magic"` - `"ip_sec"` - `"gre"` - `"cni"` - `tunnel_id: Optional[str]` UUID of the tunnel. - `virtual_network_id: Optional[str]` UUID of the virtual network. ### Returns - `class Teamnet: …` - `id: Optional[str]` UUID of the route. - `comment: Optional[str]` Optional remark describing the route. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `network: Optional[str]` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "warp", 4 more]]` The type of tunnel. - `"cfd_tunnel"` - `"warp_connector"` - `"warp"` - `"magic"` - `"ip_sec"` - `"gre"` - `"cni"` - `tunnel_id: Optional[str]` UUID of the tunnel. - `tunnel_name: Optional[str]` A user-friendly name for a tunnel. - `virtual_network_id: Optional[str]` UUID of the virtual network. - `virtual_network_name: Optional[str]` A user-friendly name for the virtual network. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.zero_trust.networks.routes.list( account_id="699d98642c564d2e855e9661899b7252", ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "Example comment for this route.", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "network": "172.16.0.0/16", "tun_type": "cfd_tunnel", "tunnel_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "tunnel_name": "blog", "virtual_network_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "virtual_network_name": "us-east-1-vpc" } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Get tunnel route `zero_trust.networks.routes.get(strroute_id, RouteGetParams**kwargs) -> Route` **get** `/accounts/{account_id}/teamnet/routes/{route_id}` Get a private network route in an account. ### Parameters - `account_id: str` Cloudflare account ID - `route_id: str` UUID of the route. ### Returns - `class Route: …` - `id: Optional[str]` UUID of the route. - `comment: Optional[str]` Optional remark describing the route. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `network: Optional[str]` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tunnel_id: Optional[str]` UUID of the tunnel. - `virtual_network_id: Optional[str]` UUID of the virtual network. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) route = client.zero_trust.networks.routes.get( route_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) print(route.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "Example comment for this route.", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "network": "172.16.0.0/16", "tunnel_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "virtual_network_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415" }, "success": true } ``` ## Create a tunnel route `zero_trust.networks.routes.create(RouteCreateParams**kwargs) -> Route` **post** `/accounts/{account_id}/teamnet/routes` Routes a private network through a Cloudflare Tunnel. ### Parameters - `account_id: str` Cloudflare account ID - `network: str` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tunnel_id: str` UUID of the tunnel. - `comment: Optional[str]` Optional remark describing the route. - `virtual_network_id: Optional[str]` UUID of the virtual network. ### Returns - `class Route: …` - `id: Optional[str]` UUID of the route. - `comment: Optional[str]` Optional remark describing the route. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `network: Optional[str]` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tunnel_id: Optional[str]` UUID of the tunnel. - `virtual_network_id: Optional[str]` UUID of the virtual network. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) route = client.zero_trust.networks.routes.create( account_id="699d98642c564d2e855e9661899b7252", network="172.16.0.0/16", tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) print(route.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "Example comment for this route.", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "network": "172.16.0.0/16", "tunnel_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "virtual_network_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415" }, "success": true } ``` ## Update a tunnel route `zero_trust.networks.routes.edit(strroute_id, RouteEditParams**kwargs) -> Route` **patch** `/accounts/{account_id}/teamnet/routes/{route_id}` Updates an existing private network route in an account. The fields that are meant to be updated should be provided in the body of the request. ### Parameters - `account_id: str` Cloudflare account ID - `route_id: str` UUID of the route. - `comment: Optional[str]` Optional remark describing the route. - `network: Optional[str]` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tunnel_id: Optional[str]` UUID of the tunnel. - `virtual_network_id: Optional[str]` UUID of the virtual network. ### Returns - `class Route: …` - `id: Optional[str]` UUID of the route. - `comment: Optional[str]` Optional remark describing the route. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `network: Optional[str]` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tunnel_id: Optional[str]` UUID of the tunnel. - `virtual_network_id: Optional[str]` UUID of the virtual network. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) route = client.zero_trust.networks.routes.edit( route_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) print(route.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "Example comment for this route.", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "network": "172.16.0.0/16", "tunnel_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "virtual_network_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415" }, "success": true } ``` ## Delete a tunnel route `zero_trust.networks.routes.delete(strroute_id, RouteDeleteParams**kwargs) -> Route` **delete** `/accounts/{account_id}/teamnet/routes/{route_id}` Deletes a private network route from an account. ### Parameters - `account_id: str` Cloudflare account ID - `route_id: str` UUID of the route. ### Returns - `class Route: …` - `id: Optional[str]` UUID of the route. - `comment: Optional[str]` Optional remark describing the route. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `network: Optional[str]` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tunnel_id: Optional[str]` UUID of the tunnel. - `virtual_network_id: Optional[str]` UUID of the virtual network. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) route = client.zero_trust.networks.routes.delete( route_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) print(route.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "Example comment for this route.", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "network": "172.16.0.0/16", "tunnel_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "virtual_network_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415" }, "success": true } ``` ## Domain Types ### Network Route - `class NetworkRoute: …` - `id: Optional[str]` UUID of the route. - `comment: Optional[str]` Optional remark describing the route. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `network: Optional[str]` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tunnel_id: Optional[str]` UUID of the tunnel. - `virtual_network_id: Optional[str]` UUID of the virtual network. ### Route - `class Route: …` - `id: Optional[str]` UUID of the route. - `comment: Optional[str]` Optional remark describing the route. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `network: Optional[str]` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tunnel_id: Optional[str]` UUID of the tunnel. - `virtual_network_id: Optional[str]` UUID of the virtual network. ### Teamnet - `class Teamnet: …` - `id: Optional[str]` UUID of the route. - `comment: Optional[str]` Optional remark describing the route. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `network: Optional[str]` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "warp", 4 more]]` The type of tunnel. - `"cfd_tunnel"` - `"warp_connector"` - `"warp"` - `"magic"` - `"ip_sec"` - `"gre"` - `"cni"` - `tunnel_id: Optional[str]` UUID of the tunnel. - `tunnel_name: Optional[str]` A user-friendly name for a tunnel. - `virtual_network_id: Optional[str]` UUID of the virtual network. - `virtual_network_name: Optional[str]` A user-friendly name for the virtual network. # IPs ## Get tunnel route by IP `zero_trust.networks.routes.ips.get(strip, IPGetParams**kwargs) -> Teamnet` **get** `/accounts/{account_id}/teamnet/routes/ip/{ip}` Fetches routes that contain the given IP address. ### Parameters - `account_id: str` Cloudflare account ID - `ip: str` - `default_virtual_network_fallback: Optional[bool]` When the virtual_network_id parameter is not provided the request filter will default search routes that are in the default virtual network for the account. If this parameter is set to false, the search will include routes that do not have a virtual network. - `virtual_network_id: Optional[str]` UUID of the virtual network. ### Returns - `class Teamnet: …` - `id: Optional[str]` UUID of the route. - `comment: Optional[str]` Optional remark describing the route. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `network: Optional[str]` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "warp", 4 more]]` The type of tunnel. - `"cfd_tunnel"` - `"warp_connector"` - `"warp"` - `"magic"` - `"ip_sec"` - `"gre"` - `"cni"` - `tunnel_id: Optional[str]` UUID of the tunnel. - `tunnel_name: Optional[str]` A user-friendly name for a tunnel. - `virtual_network_id: Optional[str]` UUID of the virtual network. - `virtual_network_name: Optional[str]` A user-friendly name for the virtual network. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) teamnet = client.zero_trust.networks.routes.ips.get( ip="10.1.0.137", account_id="699d98642c564d2e855e9661899b7252", ) print(teamnet.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "Example comment for this route.", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "network": "172.16.0.0/16", "tun_type": "cfd_tunnel", "tunnel_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "tunnel_name": "blog", "virtual_network_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "virtual_network_name": "us-east-1-vpc" }, "success": true } ``` # Networks ## Create a tunnel route (CIDR Endpoint) `zero_trust.networks.routes.networks.create(strip_network_encoded, NetworkCreateParams**kwargs) -> Route` **post** `/accounts/{account_id}/teamnet/routes/network/{ip_network_encoded}` Routes a private network through a Cloudflare Tunnel. The CIDR in `ip_network_encoded` must be written in URL-encoded format. ### Parameters - `account_id: str` Cloudflare account ID - `ip_network_encoded: str` IP/CIDR range in URL-encoded format - `tunnel_id: str` UUID of the tunnel. - `comment: Optional[str]` Optional remark describing the route. - `virtual_network_id: Optional[str]` UUID of the virtual network. ### Returns - `class Route: …` - `id: Optional[str]` UUID of the route. - `comment: Optional[str]` Optional remark describing the route. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `network: Optional[str]` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tunnel_id: Optional[str]` UUID of the tunnel. - `virtual_network_id: Optional[str]` UUID of the virtual network. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) route = client.zero_trust.networks.routes.networks.create( ip_network_encoded="172.16.0.0%2F16", account_id="699d98642c564d2e855e9661899b7252", tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) print(route.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "Example comment for this route.", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "network": "172.16.0.0/16", "tunnel_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "virtual_network_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415" }, "success": true } ``` ## Update a tunnel route (CIDR Endpoint) `zero_trust.networks.routes.networks.edit(strip_network_encoded, NetworkEditParams**kwargs) -> Route` **patch** `/accounts/{account_id}/teamnet/routes/network/{ip_network_encoded}` Updates an existing private network route in an account. The CIDR in `ip_network_encoded` must be written in URL-encoded format. ### Parameters - `account_id: str` Cloudflare account ID - `ip_network_encoded: str` IP/CIDR range in URL-encoded format ### Returns - `class Route: …` - `id: Optional[str]` UUID of the route. - `comment: Optional[str]` Optional remark describing the route. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `network: Optional[str]` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tunnel_id: Optional[str]` UUID of the tunnel. - `virtual_network_id: Optional[str]` UUID of the virtual network. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) route = client.zero_trust.networks.routes.networks.edit( ip_network_encoded="172.16.0.0%2F16", account_id="699d98642c564d2e855e9661899b7252", ) print(route.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "Example comment for this route.", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "network": "172.16.0.0/16", "tunnel_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "virtual_network_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415" }, "success": true } ``` ## Delete a tunnel route (CIDR Endpoint) `zero_trust.networks.routes.networks.delete(strip_network_encoded, NetworkDeleteParams**kwargs) -> Route` **delete** `/accounts/{account_id}/teamnet/routes/network/{ip_network_encoded}` Deletes a private network route from an account. The CIDR in `ip_network_encoded` must be written in URL-encoded format. If no virtual_network_id is provided it will delete the route from the default vnet. If no tun_type is provided it will fetch the type from the tunnel_id or if that is missing it will assume Cloudflare Tunnel as default. If tunnel_id is provided it will delete the route from that tunnel, otherwise it will delete the route based on the vnet and tun_type. ### Parameters - `account_id: str` Cloudflare account ID - `ip_network_encoded: str` IP/CIDR range in URL-encoded format - `tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "warp", 4 more]]` The type of tunnel. - `"cfd_tunnel"` - `"warp_connector"` - `"warp"` - `"magic"` - `"ip_sec"` - `"gre"` - `"cni"` - `tunnel_id: Optional[str]` UUID of the tunnel. - `virtual_network_id: Optional[str]` UUID of the virtual network. ### Returns - `class Route: …` - `id: Optional[str]` UUID of the route. - `comment: Optional[str]` Optional remark describing the route. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `network: Optional[str]` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tunnel_id: Optional[str]` UUID of the tunnel. - `virtual_network_id: Optional[str]` UUID of the virtual network. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) route = client.zero_trust.networks.routes.networks.delete( ip_network_encoded="172.16.0.0%2F16", account_id="699d98642c564d2e855e9661899b7252", ) print(route.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "Example comment for this route.", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "network": "172.16.0.0/16", "tunnel_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "virtual_network_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415" }, "success": true } ``` # Virtual Networks ## List virtual networks `zero_trust.networks.virtual_networks.list(VirtualNetworkListParams**kwargs) -> SyncSinglePage[VirtualNetwork]` **get** `/accounts/{account_id}/teamnet/virtual_networks` Lists and filters virtual networks in an account. ### Parameters - `account_id: str` Cloudflare account ID - `id: Optional[str]` UUID of the virtual network. - `is_default: Optional[bool]` If `true`, only include the default virtual network. If `false`, exclude the default virtual network. If empty, all virtual networks will be included. - `is_default_network: Optional[bool]` If `true`, only include the default virtual network. If `false`, exclude the default virtual network. If empty, all virtual networks will be included. - `is_deleted: Optional[bool]` If `true`, only include deleted virtual networks. If `false`, exclude deleted virtual networks. If empty, all virtual networks will be included. - `name: Optional[str]` A user-friendly name for the virtual network. ### Returns - `class VirtualNetwork: …` - `id: str` UUID of the virtual network. - `comment: str` Optional remark describing the virtual network. - `created_at: datetime` Timestamp of when the resource was created. - `is_default_network: bool` If `true`, this virtual network is the default for the account. - `name: str` A user-friendly name for the virtual network. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.zero_trust.networks.virtual_networks.list( account_id="699d98642c564d2e855e9661899b7252", ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "Staging VPC for data science", "created_at": "2021-01-25T18:22:34.317854Z", "is_default_network": true, "name": "us-east-1-vpc", "deleted_at": "2009-11-10T23:00:00.000000Z" } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Get a virtual network `zero_trust.networks.virtual_networks.get(strvirtual_network_id, VirtualNetworkGetParams**kwargs) -> VirtualNetwork` **get** `/accounts/{account_id}/teamnet/virtual_networks/{virtual_network_id}` Get a virtual network. ### Parameters - `account_id: str` Cloudflare account ID - `virtual_network_id: str` UUID of the virtual network. ### Returns - `class VirtualNetwork: …` - `id: str` UUID of the virtual network. - `comment: str` Optional remark describing the virtual network. - `created_at: datetime` Timestamp of when the resource was created. - `is_default_network: bool` If `true`, this virtual network is the default for the account. - `name: str` A user-friendly name for the virtual network. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) virtual_network = client.zero_trust.networks.virtual_networks.get( virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) print(virtual_network.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "Staging VPC for data science", "created_at": "2021-01-25T18:22:34.317854Z", "is_default_network": true, "name": "us-east-1-vpc", "deleted_at": "2009-11-10T23:00:00.000000Z" }, "success": true } ``` ## Create a virtual network `zero_trust.networks.virtual_networks.create(VirtualNetworkCreateParams**kwargs) -> VirtualNetwork` **post** `/accounts/{account_id}/teamnet/virtual_networks` Adds a new virtual network to an account. ### Parameters - `account_id: str` Cloudflare account ID - `name: str` A user-friendly name for the virtual network. - `comment: Optional[str]` Optional remark describing the virtual network. - `is_default: Optional[bool]` If `true`, this virtual network is the default for the account. - `is_default_network: Optional[bool]` If `true`, this virtual network is the default for the account. ### Returns - `class VirtualNetwork: …` - `id: str` UUID of the virtual network. - `comment: str` Optional remark describing the virtual network. - `created_at: datetime` Timestamp of when the resource was created. - `is_default_network: bool` If `true`, this virtual network is the default for the account. - `name: str` A user-friendly name for the virtual network. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) virtual_network = client.zero_trust.networks.virtual_networks.create( account_id="699d98642c564d2e855e9661899b7252", name="us-east-1-vpc", ) print(virtual_network.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "Staging VPC for data science", "created_at": "2021-01-25T18:22:34.317854Z", "is_default_network": true, "name": "us-east-1-vpc", "deleted_at": "2009-11-10T23:00:00.000000Z" }, "success": true } ``` ## Update a virtual network `zero_trust.networks.virtual_networks.edit(strvirtual_network_id, VirtualNetworkEditParams**kwargs) -> VirtualNetwork` **patch** `/accounts/{account_id}/teamnet/virtual_networks/{virtual_network_id}` Updates an existing virtual network. ### Parameters - `account_id: str` Cloudflare account ID - `virtual_network_id: str` UUID of the virtual network. - `comment: Optional[str]` Optional remark describing the virtual network. - `is_default_network: Optional[bool]` If `true`, this virtual network is the default for the account. - `name: Optional[str]` A user-friendly name for the virtual network. ### Returns - `class VirtualNetwork: …` - `id: str` UUID of the virtual network. - `comment: str` Optional remark describing the virtual network. - `created_at: datetime` Timestamp of when the resource was created. - `is_default_network: bool` If `true`, this virtual network is the default for the account. - `name: str` A user-friendly name for the virtual network. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) virtual_network = client.zero_trust.networks.virtual_networks.edit( virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) print(virtual_network.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "Staging VPC for data science", "created_at": "2021-01-25T18:22:34.317854Z", "is_default_network": true, "name": "us-east-1-vpc", "deleted_at": "2009-11-10T23:00:00.000000Z" }, "success": true } ``` ## Delete a virtual network `zero_trust.networks.virtual_networks.delete(strvirtual_network_id, VirtualNetworkDeleteParams**kwargs) -> VirtualNetwork` **delete** `/accounts/{account_id}/teamnet/virtual_networks/{virtual_network_id}` Deletes an existing virtual network. ### Parameters - `account_id: str` Cloudflare account ID - `virtual_network_id: str` UUID of the virtual network. ### Returns - `class VirtualNetwork: …` - `id: str` UUID of the virtual network. - `comment: str` Optional remark describing the virtual network. - `created_at: datetime` Timestamp of when the resource was created. - `is_default_network: bool` If `true`, this virtual network is the default for the account. - `name: str` A user-friendly name for the virtual network. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) virtual_network = client.zero_trust.networks.virtual_networks.delete( virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) print(virtual_network.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "Staging VPC for data science", "created_at": "2021-01-25T18:22:34.317854Z", "is_default_network": true, "name": "us-east-1-vpc", "deleted_at": "2009-11-10T23:00:00.000000Z" }, "success": true } ``` ## Domain Types ### Virtual Network - `class VirtualNetwork: …` - `id: str` UUID of the virtual network. - `comment: str` Optional remark describing the virtual network. - `created_at: datetime` Timestamp of when the resource was created. - `is_default_network: bool` If `true`, this virtual network is the default for the account. - `name: str` A user-friendly name for the virtual network. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. # Subnets ## List Subnets `zero_trust.networks.subnets.list(SubnetListParams**kwargs) -> SyncV4PagePaginationArray[Subnet]` **get** `/accounts/{account_id}/zerotrust/subnets` Lists and filters subnets in an account. ### Parameters - `account_id: str` Cloudflare account ID - `address_family: Optional[Literal["v4", "v6"]]` If set, only include subnets in the given address family - `v4` or `v6` - `"v4"` - `"v6"` - `comment: Optional[str]` If set, only list subnets with the given comment. - `existed_at: Optional[str]` If provided, include only resources that were created (and not deleted) before this time. URL encoded. - `is_default_network: Optional[bool]` If `true`, only include default subnets. If `false`, exclude default subnets subnets. If not set, all subnets will be included. - `is_deleted: Optional[bool]` If `true`, only include deleted subnets. If `false`, exclude deleted subnets. If not set, all subnets will be included. - `name: Optional[str]` If set, only list subnets with the given name - `network: Optional[str]` If set, only list the subnet whose network exactly matches the given CIDR. - `page: Optional[float]` Page number of paginated results. - `per_page: Optional[float]` Number of results to display. - `sort_order: Optional[Literal["asc", "desc"]]` Sort order of the results. `asc` means oldest to newest, `desc` means newest to oldest. If not set, they will not be in any particular order. - `"asc"` - `"desc"` - `subnet_types: Optional[Literal["cloudflare_source", "warp"]]` If set, the types of subnets to include, separated by comma. - `"cloudflare_source"` - `"warp"` ### Returns - `class Subnet: …` - `id: Optional[str]` The UUID of the subnet. - `comment: Optional[str]` An optional description of the subnet. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `is_default_network: Optional[bool]` If `true`, this is the default subnet for the account. There can only be one default subnet per account. - `name: Optional[str]` A user-friendly name for the subnet. - `network: Optional[str]` The private IPv4 or IPv6 range defining the subnet, in CIDR notation. - `subnet_type: Optional[Literal["cloudflare_source", "warp"]]` The type of subnet. - `"cloudflare_source"` - `"warp"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.zero_trust.networks.subnets.list( account_id="699d98642c564d2e855e9661899b7252", ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "example comment", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "is_default_network": true, "name": "IPv4 Cloudflare Source IPs", "network": "100.64.0.0/12", "subnet_type": "cloudflare_source" } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` # WARP ## Create WARP IP subnet `zero_trust.networks.subnets.warp.create(WARPCreateParams**kwargs) -> Subnet` **post** `/accounts/{account_id}/zerotrust/subnets/warp` Create a WARP IP assignment subnet. Currently, only IPv4 subnets can be created. **Network constraints:** - The network must be within one of the following private IP ranges: - `10.0.0.0/8` (RFC 1918) - `172.16.0.0/12` (RFC 1918) - `192.168.0.0/16` (RFC 1918) - `100.64.0.0/10` (RFC 6598 - CGNAT) - The subnet must have a prefix length of `/24` or larger (e.g., `/16`, `/20`, `/24` are valid; `/25`, `/28` are not) ### Parameters - `account_id: str` Cloudflare account ID - `name: str` A user-friendly name for the subnet. - `network: str` The private IPv4 or IPv6 range defining the subnet, in CIDR notation. - `comment: Optional[str]` An optional description of the subnet. - `is_default_network: Optional[bool]` If `true`, this is the default subnet for the account. There can only be one default subnet per account. ### Returns - `class Subnet: …` - `id: Optional[str]` The UUID of the subnet. - `comment: Optional[str]` An optional description of the subnet. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `is_default_network: Optional[bool]` If `true`, this is the default subnet for the account. There can only be one default subnet per account. - `name: Optional[str]` A user-friendly name for the subnet. - `network: Optional[str]` The private IPv4 or IPv6 range defining the subnet, in CIDR notation. - `subnet_type: Optional[Literal["cloudflare_source", "warp"]]` The type of subnet. - `"cloudflare_source"` - `"warp"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) subnet = client.zero_trust.networks.subnets.warp.create( account_id="699d98642c564d2e855e9661899b7252", name="IPv4 Cloudflare Source IPs", network="100.64.0.0/12", ) print(subnet.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "example comment", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "is_default_network": true, "name": "IPv4 Cloudflare Source IPs", "network": "100.64.0.0/12", "subnet_type": "cloudflare_source" }, "success": true } ``` ## Get WARP IP subnet `zero_trust.networks.subnets.warp.get(strsubnet_id, WARPGetParams**kwargs) -> Subnet` **get** `/accounts/{account_id}/zerotrust/subnets/warp/{subnet_id}` Get a WARP IP assignment subnet. ### Parameters - `account_id: str` Cloudflare account ID - `subnet_id: str` The UUID of the subnet. ### Returns - `class Subnet: …` - `id: Optional[str]` The UUID of the subnet. - `comment: Optional[str]` An optional description of the subnet. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `is_default_network: Optional[bool]` If `true`, this is the default subnet for the account. There can only be one default subnet per account. - `name: Optional[str]` A user-friendly name for the subnet. - `network: Optional[str]` The private IPv4 or IPv6 range defining the subnet, in CIDR notation. - `subnet_type: Optional[Literal["cloudflare_source", "warp"]]` The type of subnet. - `"cloudflare_source"` - `"warp"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) subnet = client.zero_trust.networks.subnets.warp.get( subnet_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) print(subnet.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "example comment", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "is_default_network": true, "name": "IPv4 Cloudflare Source IPs", "network": "100.64.0.0/12", "subnet_type": "cloudflare_source" }, "success": true } ``` ## Update WARP IP subnet `zero_trust.networks.subnets.warp.edit(strsubnet_id, WARPEditParams**kwargs) -> Subnet` **patch** `/accounts/{account_id}/zerotrust/subnets/warp/{subnet_id}` Updates a WARP IP assignment subnet. **Update constraints:** - The `network` field cannot be modified for WARP subnets. Only `name`, `comment`, and `is_default_network` can be updated. - IPv6 subnets cannot be updated ### Parameters - `account_id: str` Cloudflare account ID - `subnet_id: str` The UUID of the subnet. - `comment: Optional[str]` An optional description of the subnet. - `is_default_network: Optional[bool]` If `true`, this is the default subnet for the account. There can only be one default subnet per account. - `name: Optional[str]` A user-friendly name for the subnet. - `network: Optional[str]` The private IPv4 or IPv6 range defining the subnet, in CIDR notation. ### Returns - `class Subnet: …` - `id: Optional[str]` The UUID of the subnet. - `comment: Optional[str]` An optional description of the subnet. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `is_default_network: Optional[bool]` If `true`, this is the default subnet for the account. There can only be one default subnet per account. - `name: Optional[str]` A user-friendly name for the subnet. - `network: Optional[str]` The private IPv4 or IPv6 range defining the subnet, in CIDR notation. - `subnet_type: Optional[Literal["cloudflare_source", "warp"]]` The type of subnet. - `"cloudflare_source"` - `"warp"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) subnet = client.zero_trust.networks.subnets.warp.edit( subnet_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) print(subnet.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "example comment", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "is_default_network": true, "name": "IPv4 Cloudflare Source IPs", "network": "100.64.0.0/12", "subnet_type": "cloudflare_source" }, "success": true } ``` ## Delete WARP IP subnet `zero_trust.networks.subnets.warp.delete(strsubnet_id, WARPDeleteParams**kwargs) -> WARPDeleteResponse` **delete** `/accounts/{account_id}/zerotrust/subnets/warp/{subnet_id}` Delete a WARP IP assignment subnet. This operation is idempotent - deleting an already-deleted or non-existent subnet will return success with a null result. ### Parameters - `account_id: str` Cloudflare account ID - `subnet_id: str` The UUID of the subnet. ### Returns - `class WARPDeleteResponse: …` - `id: Optional[str]` The UUID of the subnet. - `comment: Optional[str]` An optional description of the subnet. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `is_default_network: Optional[bool]` If `true`, this is the default subnet for the account. There can only be one default subnet per account. - `name: Optional[str]` A user-friendly name for the subnet. - `network: Optional[str]` The private IPv4 or IPv6 range defining the subnet, in CIDR notation. - `subnet_type: Optional[Literal["cloudflare_source", "warp"]]` The type of subnet. - `"cloudflare_source"` - `"warp"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) warp = client.zero_trust.networks.subnets.warp.delete( subnet_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) print(warp.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "example comment", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "is_default_network": true, "name": "IPv4 Cloudflare Source IPs", "network": "100.64.0.0/12", "subnet_type": "cloudflare_source" }, "success": true } ``` ## Domain Types ### Subnet - `class Subnet: …` - `id: Optional[str]` The UUID of the subnet. - `comment: Optional[str]` An optional description of the subnet. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `is_default_network: Optional[bool]` If `true`, this is the default subnet for the account. There can only be one default subnet per account. - `name: Optional[str]` A user-friendly name for the subnet. - `network: Optional[str]` The private IPv4 or IPv6 range defining the subnet, in CIDR notation. - `subnet_type: Optional[Literal["cloudflare_source", "warp"]]` The type of subnet. - `"cloudflare_source"` - `"warp"` ### WARP Delete Response - `class WARPDeleteResponse: …` - `id: Optional[str]` The UUID of the subnet. - `comment: Optional[str]` An optional description of the subnet. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `is_default_network: Optional[bool]` If `true`, this is the default subnet for the account. There can only be one default subnet per account. - `name: Optional[str]` A user-friendly name for the subnet. - `network: Optional[str]` The private IPv4 or IPv6 range defining the subnet, in CIDR notation. - `subnet_type: Optional[Literal["cloudflare_source", "warp"]]` The type of subnet. - `"cloudflare_source"` - `"warp"` # Cloudflare Source ## Update Cloudflare Source Subnet `zero_trust.networks.subnets.cloudflare_source.update(Literal["v4", "v6"]address_family, CloudflareSourceUpdateParams**kwargs) -> Subnet` **patch** `/accounts/{account_id}/zerotrust/subnets/cloudflare_source/{address_family}` Updates the Cloudflare Source subnet of the given address family ### Parameters - `account_id: str` Cloudflare account ID - `address_family: Literal["v4", "v6"]` IP address family, either `v4` (IPv4) or `v6` (IPv6) - `"v4"` - `"v6"` - `comment: Optional[str]` An optional description of the subnet. - `name: Optional[str]` A user-friendly name for the subnet. - `network: Optional[str]` The private IPv4 or IPv6 range defining the subnet, in CIDR notation. ### Returns - `class Subnet: …` - `id: Optional[str]` The UUID of the subnet. - `comment: Optional[str]` An optional description of the subnet. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `is_default_network: Optional[bool]` If `true`, this is the default subnet for the account. There can only be one default subnet per account. - `name: Optional[str]` A user-friendly name for the subnet. - `network: Optional[str]` The private IPv4 or IPv6 range defining the subnet, in CIDR notation. - `subnet_type: Optional[Literal["cloudflare_source", "warp"]]` The type of subnet. - `"cloudflare_source"` - `"warp"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) subnet = client.zero_trust.networks.subnets.cloudflare_source.update( address_family="v4", account_id="699d98642c564d2e855e9661899b7252", ) print(subnet.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "example comment", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "is_default_network": true, "name": "IPv4 Cloudflare Source IPs", "network": "100.64.0.0/12", "subnet_type": "cloudflare_source" }, "success": true } ``` # Hostname Routes ## List hostname routes `zero_trust.networks.hostname_routes.list(HostnameRouteListParams**kwargs) -> SyncV4PagePaginationArray[HostnameRoute]` **get** `/accounts/{account_id}/zerotrust/routes/hostname` Lists and filters hostname routes in an account. ### Parameters - `account_id: str` Cloudflare account ID - `id: Optional[str]` The hostname route ID. - `comment: Optional[str]` If set, only list hostname routes with the given comment. - `existed_at: Optional[str]` If provided, include only resources that were created (and not deleted) before this time. URL encoded. - `hostname: Optional[str]` If set, only list hostname routes that contain a substring of the given value, the filter is case-insensitive. - `is_deleted: Optional[bool]` If `true`, only return deleted hostname routes. If `false`, exclude deleted hostname routes. - `page: Optional[float]` Page number of paginated results. - `per_page: Optional[float]` Number of results to display. - `tunnel_id: Optional[str]` If set, only list hostname routes that point to a specific tunnel. ### Returns - `class HostnameRoute: …` - `id: Optional[str]` The hostname route ID. - `comment: Optional[str]` An optional description of the hostname route. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `hostname: Optional[str]` The hostname of the route. - `tunnel_id: Optional[str]` UUID of the tunnel. - `tunnel_name: Optional[str]` A user-friendly name for a tunnel. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.zero_trust.networks.hostname_routes.list( account_id="699d98642c564d2e855e9661899b7252", ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "example comment", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "hostname": "office-1.local", "tunnel_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "tunnel_name": "api-tunnel" } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Get hostname route `zero_trust.networks.hostname_routes.get(strhostname_route_id, HostnameRouteGetParams**kwargs) -> HostnameRoute` **get** `/accounts/{account_id}/zerotrust/routes/hostname/{hostname_route_id}` Get a hostname route. ### Parameters - `account_id: str` Cloudflare account ID - `hostname_route_id: str` The hostname route ID. ### Returns - `class HostnameRoute: …` - `id: Optional[str]` The hostname route ID. - `comment: Optional[str]` An optional description of the hostname route. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `hostname: Optional[str]` The hostname of the route. - `tunnel_id: Optional[str]` UUID of the tunnel. - `tunnel_name: Optional[str]` A user-friendly name for a tunnel. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) hostname_route = client.zero_trust.networks.hostname_routes.get( hostname_route_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) print(hostname_route.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "example comment", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "hostname": "office-1.local", "tunnel_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "tunnel_name": "api-tunnel" }, "success": true } ``` ## Create hostname route `zero_trust.networks.hostname_routes.create(HostnameRouteCreateParams**kwargs) -> HostnameRoute` **post** `/accounts/{account_id}/zerotrust/routes/hostname` Create a hostname route. ### Parameters - `account_id: str` Cloudflare account ID - `comment: Optional[str]` An optional description of the hostname route. - `hostname: Optional[str]` The hostname of the route. - `tunnel_id: Optional[str]` UUID of the tunnel. ### Returns - `class HostnameRoute: …` - `id: Optional[str]` The hostname route ID. - `comment: Optional[str]` An optional description of the hostname route. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `hostname: Optional[str]` The hostname of the route. - `tunnel_id: Optional[str]` UUID of the tunnel. - `tunnel_name: Optional[str]` A user-friendly name for a tunnel. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) hostname_route = client.zero_trust.networks.hostname_routes.create( account_id="699d98642c564d2e855e9661899b7252", ) print(hostname_route.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "example comment", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "hostname": "office-1.local", "tunnel_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "tunnel_name": "api-tunnel" }, "success": true } ``` ## Update hostname route `zero_trust.networks.hostname_routes.edit(strhostname_route_id, HostnameRouteEditParams**kwargs) -> HostnameRoute` **patch** `/accounts/{account_id}/zerotrust/routes/hostname/{hostname_route_id}` Updates a hostname route. ### Parameters - `account_id: str` Cloudflare account ID - `hostname_route_id: str` The hostname route ID. - `comment: Optional[str]` An optional description of the hostname route. - `hostname: Optional[str]` The hostname of the route. - `tunnel_id: Optional[str]` UUID of the tunnel. ### Returns - `class HostnameRoute: …` - `id: Optional[str]` The hostname route ID. - `comment: Optional[str]` An optional description of the hostname route. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `hostname: Optional[str]` The hostname of the route. - `tunnel_id: Optional[str]` UUID of the tunnel. - `tunnel_name: Optional[str]` A user-friendly name for a tunnel. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) hostname_route = client.zero_trust.networks.hostname_routes.edit( hostname_route_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) print(hostname_route.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "example comment", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "hostname": "office-1.local", "tunnel_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "tunnel_name": "api-tunnel" }, "success": true } ``` ## Delete hostname route `zero_trust.networks.hostname_routes.delete(strhostname_route_id, HostnameRouteDeleteParams**kwargs) -> HostnameRoute` **delete** `/accounts/{account_id}/zerotrust/routes/hostname/{hostname_route_id}` Delete a hostname route. ### Parameters - `account_id: str` Cloudflare account ID - `hostname_route_id: str` The hostname route ID. ### Returns - `class HostnameRoute: …` - `id: Optional[str]` The hostname route ID. - `comment: Optional[str]` An optional description of the hostname route. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `hostname: Optional[str]` The hostname of the route. - `tunnel_id: Optional[str]` UUID of the tunnel. - `tunnel_name: Optional[str]` A user-friendly name for a tunnel. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) hostname_route = client.zero_trust.networks.hostname_routes.delete( hostname_route_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) print(hostname_route.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "comment": "example comment", "created_at": "2021-01-25T18:22:34.317854Z", "deleted_at": "2009-11-10T23:00:00.000000Z", "hostname": "office-1.local", "tunnel_id": "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", "tunnel_name": "api-tunnel" }, "success": true } ``` ## Domain Types ### Hostname Route - `class HostnameRoute: …` - `id: Optional[str]` The hostname route ID. - `comment: Optional[str]` An optional description of the hostname route. - `created_at: Optional[datetime]` Timestamp of when the resource was created. - `deleted_at: Optional[datetime]` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `hostname: Optional[str]` The hostname of the route. - `tunnel_id: Optional[str]` UUID of the tunnel. - `tunnel_name: Optional[str]` A user-friendly name for a tunnel.