# Networks # Routes ## List tunnel routes `client.zeroTrust.networks.routes.list(RouteListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/teamnet/routes` Lists and filters private network routes in an account. ### Parameters - `params: RouteListParams` - `account_id: string` Path param: Cloudflare account ID - `comment?: string` Query param: Optional remark describing the route. - `existed_at?: string` Query param: If provided, include only resources that were created (and not deleted) before this time. URL encoded. - `is_deleted?: boolean` Query param: If `true`, only include deleted routes. If `false`, exclude deleted routes. If empty, all routes will be included. - `network_subset?: string` Query param: If set, only list routes that are contained within this IP range. - `network_superset?: string` Query param: If set, only list routes that contain this IP range. - `page?: number` Query param: Page number of paginated results. - `per_page?: number` Query param: Number of results to display. - `route_id?: string` Query param: UUID of the route. - `tun_types?: Array<"cfd_tunnel" | "warp_connector" | "warp" | 4 more>` Query param: The types of tunnels to filter by, separated by commas. - `"cfd_tunnel"` - `"warp_connector"` - `"warp"` - `"magic"` - `"ip_sec"` - `"gre"` - `"cni"` - `tunnel_id?: string` Query param: UUID of the tunnel. - `virtual_network_id?: string` Query param: UUID of the virtual network. ### Returns - `Teamnet` - `id?: string` UUID of the route. - `comment?: string` Optional remark describing the route. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `network?: string` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tun_type?: "cfd_tunnel" | "warp_connector" | "warp" | 4 more` The type of tunnel. - `"cfd_tunnel"` - `"warp_connector"` - `"warp"` - `"magic"` - `"ip_sec"` - `"gre"` - `"cni"` - `tunnel_id?: string` UUID of the tunnel. - `tunnel_name?: string` A user-friendly name for a tunnel. - `virtual_network_id?: string` UUID of the virtual network. - `virtual_network_name?: string` A user-friendly name for the virtual network. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const teamnet of client.zeroTrust.networks.routes.list({ account_id: '699d98642c564d2e855e9661899b7252', })) { console.log(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, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Get tunnel route `client.zeroTrust.networks.routes.get(stringrouteId, RouteGetParamsparams, RequestOptionsoptions?): Route` **get** `/accounts/{account_id}/teamnet/routes/{route_id}` Get a private network route in an account. ### Parameters - `routeId: string` UUID of the route. - `params: RouteGetParams` - `account_id: string` Cloudflare account ID ### Returns - `Route` - `id?: string` UUID of the route. - `comment?: string` Optional remark describing the route. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `network?: string` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tunnel_id?: string` UUID of the tunnel. - `virtual_network_id?: string` UUID of the virtual network. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const route = await client.zeroTrust.networks.routes.get('f70ff985-a4ef-4643-bbbc-4a0ed4fc8415', { account_id: '699d98642c564d2e855e9661899b7252', }); console.log(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 `client.zeroTrust.networks.routes.create(RouteCreateParamsparams, RequestOptionsoptions?): Route` **post** `/accounts/{account_id}/teamnet/routes` Routes a private network through a Cloudflare Tunnel. ### Parameters - `params: RouteCreateParams` - `account_id: string` Path param: Cloudflare account ID - `network: string` Body param: The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tunnel_id: string` Body param: UUID of the tunnel. - `comment?: string` Body param: Optional remark describing the route. - `virtual_network_id?: string` Body param: UUID of the virtual network. ### Returns - `Route` - `id?: string` UUID of the route. - `comment?: string` Optional remark describing the route. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `network?: string` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tunnel_id?: string` UUID of the tunnel. - `virtual_network_id?: string` UUID of the virtual network. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const route = await client.zeroTrust.networks.routes.create({ account_id: '699d98642c564d2e855e9661899b7252', network: '172.16.0.0/16', tunnel_id: 'f70ff985-a4ef-4643-bbbc-4a0ed4fc8415', }); console.log(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 `client.zeroTrust.networks.routes.edit(stringrouteId, RouteEditParamsparams, RequestOptionsoptions?): 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 - `routeId: string` UUID of the route. - `params: RouteEditParams` - `account_id: string` Path param: Cloudflare account ID - `comment?: string` Body param: Optional remark describing the route. - `network?: string` Body param: The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tunnel_id?: string` Body param: UUID of the tunnel. - `virtual_network_id?: string` Body param: UUID of the virtual network. ### Returns - `Route` - `id?: string` UUID of the route. - `comment?: string` Optional remark describing the route. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `network?: string` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tunnel_id?: string` UUID of the tunnel. - `virtual_network_id?: string` UUID of the virtual network. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const route = await client.zeroTrust.networks.routes.edit('f70ff985-a4ef-4643-bbbc-4a0ed4fc8415', { account_id: '699d98642c564d2e855e9661899b7252', }); console.log(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 `client.zeroTrust.networks.routes.delete(stringrouteId, RouteDeleteParamsparams, RequestOptionsoptions?): Route` **delete** `/accounts/{account_id}/teamnet/routes/{route_id}` Deletes a private network route from an account. ### Parameters - `routeId: string` UUID of the route. - `params: RouteDeleteParams` - `account_id: string` Cloudflare account ID ### Returns - `Route` - `id?: string` UUID of the route. - `comment?: string` Optional remark describing the route. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `network?: string` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tunnel_id?: string` UUID of the tunnel. - `virtual_network_id?: string` UUID of the virtual network. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const route = await client.zeroTrust.networks.routes.delete( 'f70ff985-a4ef-4643-bbbc-4a0ed4fc8415', { account_id: '699d98642c564d2e855e9661899b7252' }, ); console.log(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 - `NetworkRoute` - `id?: string` UUID of the route. - `comment?: string` Optional remark describing the route. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `network?: string` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tunnel_id?: string` UUID of the tunnel. - `virtual_network_id?: string` UUID of the virtual network. ### Route - `Route` - `id?: string` UUID of the route. - `comment?: string` Optional remark describing the route. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `network?: string` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tunnel_id?: string` UUID of the tunnel. - `virtual_network_id?: string` UUID of the virtual network. ### Teamnet - `Teamnet` - `id?: string` UUID of the route. - `comment?: string` Optional remark describing the route. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `network?: string` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tun_type?: "cfd_tunnel" | "warp_connector" | "warp" | 4 more` The type of tunnel. - `"cfd_tunnel"` - `"warp_connector"` - `"warp"` - `"magic"` - `"ip_sec"` - `"gre"` - `"cni"` - `tunnel_id?: string` UUID of the tunnel. - `tunnel_name?: string` A user-friendly name for a tunnel. - `virtual_network_id?: string` UUID of the virtual network. - `virtual_network_name?: string` A user-friendly name for the virtual network. # IPs ## Get tunnel route by IP `client.zeroTrust.networks.routes.ips.get(stringip, IPGetParamsparams, RequestOptionsoptions?): Teamnet` **get** `/accounts/{account_id}/teamnet/routes/ip/{ip}` Fetches routes that contain the given IP address. ### Parameters - `ip: string` - `params: IPGetParams` - `account_id: string` Path param: Cloudflare account ID - `default_virtual_network_fallback?: boolean` Query param: 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?: string` Query param: UUID of the virtual network. ### Returns - `Teamnet` - `id?: string` UUID of the route. - `comment?: string` Optional remark describing the route. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `network?: string` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tun_type?: "cfd_tunnel" | "warp_connector" | "warp" | 4 more` The type of tunnel. - `"cfd_tunnel"` - `"warp_connector"` - `"warp"` - `"magic"` - `"ip_sec"` - `"gre"` - `"cni"` - `tunnel_id?: string` UUID of the tunnel. - `tunnel_name?: string` A user-friendly name for a tunnel. - `virtual_network_id?: string` UUID of the virtual network. - `virtual_network_name?: string` A user-friendly name for the virtual network. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const teamnet = await client.zeroTrust.networks.routes.ips.get('10.1.0.137', { account_id: '699d98642c564d2e855e9661899b7252', }); console.log(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) `client.zeroTrust.networks.routes.networks.create(stringipNetworkEncoded, NetworkCreateParamsparams, RequestOptionsoptions?): 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 - `ipNetworkEncoded: string` IP/CIDR range in URL-encoded format - `params: NetworkCreateParams` - `account_id: string` Path param: Cloudflare account ID - `tunnel_id: string` Body param: UUID of the tunnel. - `comment?: string` Body param: Optional remark describing the route. - `virtual_network_id?: string` Body param: UUID of the virtual network. ### Returns - `Route` - `id?: string` UUID of the route. - `comment?: string` Optional remark describing the route. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `network?: string` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tunnel_id?: string` UUID of the tunnel. - `virtual_network_id?: string` UUID of the virtual network. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const route = await client.zeroTrust.networks.routes.networks.create('172.16.0.0%2F16', { account_id: '699d98642c564d2e855e9661899b7252', tunnel_id: 'f70ff985-a4ef-4643-bbbc-4a0ed4fc8415', }); console.log(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) `client.zeroTrust.networks.routes.networks.edit(stringipNetworkEncoded, NetworkEditParamsparams, RequestOptionsoptions?): 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 - `ipNetworkEncoded: string` IP/CIDR range in URL-encoded format - `params: NetworkEditParams` - `account_id: string` Cloudflare account ID ### Returns - `Route` - `id?: string` UUID of the route. - `comment?: string` Optional remark describing the route. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `network?: string` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tunnel_id?: string` UUID of the tunnel. - `virtual_network_id?: string` UUID of the virtual network. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const route = await client.zeroTrust.networks.routes.networks.edit('172.16.0.0%2F16', { account_id: '699d98642c564d2e855e9661899b7252', }); console.log(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) `client.zeroTrust.networks.routes.networks.delete(stringipNetworkEncoded, NetworkDeleteParamsparams, RequestOptionsoptions?): 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 - `ipNetworkEncoded: string` IP/CIDR range in URL-encoded format - `params: NetworkDeleteParams` - `account_id: string` Path param: Cloudflare account ID - `tun_type?: "cfd_tunnel" | "warp_connector" | "warp" | 4 more` Query param: The type of tunnel. - `"cfd_tunnel"` - `"warp_connector"` - `"warp"` - `"magic"` - `"ip_sec"` - `"gre"` - `"cni"` - `tunnel_id?: string` Query param: UUID of the tunnel. - `virtual_network_id?: string` Query param: UUID of the virtual network. ### Returns - `Route` - `id?: string` UUID of the route. - `comment?: string` Optional remark describing the route. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `network?: string` The private IPv4 or IPv6 range connected by the route, in CIDR notation. - `tunnel_id?: string` UUID of the tunnel. - `virtual_network_id?: string` UUID of the virtual network. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const route = await client.zeroTrust.networks.routes.networks.delete('172.16.0.0%2F16', { account_id: '699d98642c564d2e855e9661899b7252', }); console.log(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 `client.zeroTrust.networks.virtualNetworks.list(VirtualNetworkListParamsparams, RequestOptionsoptions?): SinglePage` **get** `/accounts/{account_id}/teamnet/virtual_networks` Lists and filters virtual networks in an account. ### Parameters - `params: VirtualNetworkListParams` - `account_id: string` Path param: Cloudflare account ID - `id?: string` Query param: UUID of the virtual network. - `is_default?: boolean` Query param: 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?: boolean` Query param: 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?: boolean` Query param: If `true`, only include deleted virtual networks. If `false`, exclude deleted virtual networks. If empty, all virtual networks will be included. - `name?: string` Query param: A user-friendly name for the virtual network. ### Returns - `VirtualNetwork` - `id: string` UUID of the virtual network. - `comment: string` Optional remark describing the virtual network. - `created_at: string` Timestamp of when the resource was created. - `is_default_network: boolean` If `true`, this virtual network is the default for the account. - `name: string` A user-friendly name for the virtual network. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const virtualNetwork of client.zeroTrust.networks.virtualNetworks.list({ account_id: '699d98642c564d2e855e9661899b7252', })) { console.log(virtualNetwork.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 `client.zeroTrust.networks.virtualNetworks.get(stringvirtualNetworkId, VirtualNetworkGetParamsparams, RequestOptionsoptions?): VirtualNetwork` **get** `/accounts/{account_id}/teamnet/virtual_networks/{virtual_network_id}` Get a virtual network. ### Parameters - `virtualNetworkId: string` UUID of the virtual network. - `params: VirtualNetworkGetParams` - `account_id: string` Cloudflare account ID ### Returns - `VirtualNetwork` - `id: string` UUID of the virtual network. - `comment: string` Optional remark describing the virtual network. - `created_at: string` Timestamp of when the resource was created. - `is_default_network: boolean` If `true`, this virtual network is the default for the account. - `name: string` A user-friendly name for the virtual network. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const virtualNetwork = await client.zeroTrust.networks.virtualNetworks.get( 'f70ff985-a4ef-4643-bbbc-4a0ed4fc8415', { account_id: '699d98642c564d2e855e9661899b7252' }, ); console.log(virtualNetwork.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 `client.zeroTrust.networks.virtualNetworks.create(VirtualNetworkCreateParamsparams, RequestOptionsoptions?): VirtualNetwork` **post** `/accounts/{account_id}/teamnet/virtual_networks` Adds a new virtual network to an account. ### Parameters - `params: VirtualNetworkCreateParams` - `account_id: string` Path param: Cloudflare account ID - `name: string` Body param: A user-friendly name for the virtual network. - `comment?: string` Body param: Optional remark describing the virtual network. - `is_default?: boolean` Body param: If `true`, this virtual network is the default for the account. - `is_default_network?: boolean` Body param: If `true`, this virtual network is the default for the account. ### Returns - `VirtualNetwork` - `id: string` UUID of the virtual network. - `comment: string` Optional remark describing the virtual network. - `created_at: string` Timestamp of when the resource was created. - `is_default_network: boolean` If `true`, this virtual network is the default for the account. - `name: string` A user-friendly name for the virtual network. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const virtualNetwork = await client.zeroTrust.networks.virtualNetworks.create({ account_id: '699d98642c564d2e855e9661899b7252', name: 'us-east-1-vpc', }); console.log(virtualNetwork.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 `client.zeroTrust.networks.virtualNetworks.edit(stringvirtualNetworkId, VirtualNetworkEditParamsparams, RequestOptionsoptions?): VirtualNetwork` **patch** `/accounts/{account_id}/teamnet/virtual_networks/{virtual_network_id}` Updates an existing virtual network. ### Parameters - `virtualNetworkId: string` UUID of the virtual network. - `params: VirtualNetworkEditParams` - `account_id: string` Path param: Cloudflare account ID - `comment?: string` Body param: Optional remark describing the virtual network. - `is_default_network?: boolean` Body param: If `true`, this virtual network is the default for the account. - `name?: string` Body param: A user-friendly name for the virtual network. ### Returns - `VirtualNetwork` - `id: string` UUID of the virtual network. - `comment: string` Optional remark describing the virtual network. - `created_at: string` Timestamp of when the resource was created. - `is_default_network: boolean` If `true`, this virtual network is the default for the account. - `name: string` A user-friendly name for the virtual network. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const virtualNetwork = await client.zeroTrust.networks.virtualNetworks.edit( 'f70ff985-a4ef-4643-bbbc-4a0ed4fc8415', { account_id: '699d98642c564d2e855e9661899b7252' }, ); console.log(virtualNetwork.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 `client.zeroTrust.networks.virtualNetworks.delete(stringvirtualNetworkId, VirtualNetworkDeleteParamsparams, RequestOptionsoptions?): VirtualNetwork` **delete** `/accounts/{account_id}/teamnet/virtual_networks/{virtual_network_id}` Deletes an existing virtual network. ### Parameters - `virtualNetworkId: string` UUID of the virtual network. - `params: VirtualNetworkDeleteParams` - `account_id: string` Cloudflare account ID ### Returns - `VirtualNetwork` - `id: string` UUID of the virtual network. - `comment: string` Optional remark describing the virtual network. - `created_at: string` Timestamp of when the resource was created. - `is_default_network: boolean` If `true`, this virtual network is the default for the account. - `name: string` A user-friendly name for the virtual network. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const virtualNetwork = await client.zeroTrust.networks.virtualNetworks.delete( 'f70ff985-a4ef-4643-bbbc-4a0ed4fc8415', { account_id: '699d98642c564d2e855e9661899b7252' }, ); console.log(virtualNetwork.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 - `VirtualNetwork` - `id: string` UUID of the virtual network. - `comment: string` Optional remark describing the virtual network. - `created_at: string` Timestamp of when the resource was created. - `is_default_network: boolean` If `true`, this virtual network is the default for the account. - `name: string` A user-friendly name for the virtual network. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. # Subnets ## List Subnets `client.zeroTrust.networks.subnets.list(SubnetListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/zerotrust/subnets` Lists and filters subnets in an account. ### Parameters - `params: SubnetListParams` - `account_id: string` Path param: Cloudflare account ID - `address_family?: "v4" | "v6"` Query param: If set, only include subnets in the given address family - `v4` or `v6` - `"v4"` - `"v6"` - `comment?: string` Query param: If set, only list subnets with the given comment. - `existed_at?: string` Query param: If provided, include only resources that were created (and not deleted) before this time. URL encoded. - `is_default_network?: boolean` Query param: If `true`, only include default subnets. If `false`, exclude default subnets subnets. If not set, all subnets will be included. - `is_deleted?: boolean` Query param: If `true`, only include deleted subnets. If `false`, exclude deleted subnets. If not set, all subnets will be included. - `name?: string` Query param: If set, only list subnets with the given name - `network?: string` Query param: If set, only list the subnet whose network exactly matches the given CIDR. - `page?: number` Query param: Page number of paginated results. - `per_page?: number` Query param: Number of results to display. - `sort_order?: "asc" | "desc"` Query param: 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?: "cloudflare_source" | "warp"` Query param: If set, the types of subnets to include, separated by comma. - `"cloudflare_source"` - `"warp"` ### Returns - `Subnet` - `id?: string` The UUID of the subnet. - `comment?: string` An optional description of the subnet. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `is_default_network?: boolean` If `true`, this is the default subnet for the account. There can only be one default subnet per account. - `name?: string` A user-friendly name for the subnet. - `network?: string` The private IPv4 or IPv6 range defining the subnet, in CIDR notation. - `subnet_type?: "cloudflare_source" | "warp"` The type of subnet. - `"cloudflare_source"` - `"warp"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const subnet of client.zeroTrust.networks.subnets.list({ account_id: '699d98642c564d2e855e9661899b7252', })) { console.log(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, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` # WARP ## Create WARP IP subnet `client.zeroTrust.networks.subnets.warp.create(WARPCreateParamsparams, RequestOptionsoptions?): 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 - `params: WARPCreateParams` - `account_id: string` Path param: Cloudflare account ID - `name: string` Body param: A user-friendly name for the subnet. - `network: string` Body param: The private IPv4 or IPv6 range defining the subnet, in CIDR notation. - `comment?: string` Body param: An optional description of the subnet. - `is_default_network?: boolean` Body param: If `true`, this is the default subnet for the account. There can only be one default subnet per account. ### Returns - `Subnet` - `id?: string` The UUID of the subnet. - `comment?: string` An optional description of the subnet. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `is_default_network?: boolean` If `true`, this is the default subnet for the account. There can only be one default subnet per account. - `name?: string` A user-friendly name for the subnet. - `network?: string` The private IPv4 or IPv6 range defining the subnet, in CIDR notation. - `subnet_type?: "cloudflare_source" | "warp"` The type of subnet. - `"cloudflare_source"` - `"warp"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const subnet = await client.zeroTrust.networks.subnets.warp.create({ account_id: '699d98642c564d2e855e9661899b7252', name: 'IPv4 Cloudflare Source IPs', network: '100.64.0.0/12', }); console.log(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 `client.zeroTrust.networks.subnets.warp.get(stringsubnetId, WARPGetParamsparams, RequestOptionsoptions?): Subnet` **get** `/accounts/{account_id}/zerotrust/subnets/warp/{subnet_id}` Get a WARP IP assignment subnet. ### Parameters - `subnetId: string` The UUID of the subnet. - `params: WARPGetParams` - `account_id: string` Cloudflare account ID ### Returns - `Subnet` - `id?: string` The UUID of the subnet. - `comment?: string` An optional description of the subnet. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `is_default_network?: boolean` If `true`, this is the default subnet for the account. There can only be one default subnet per account. - `name?: string` A user-friendly name for the subnet. - `network?: string` The private IPv4 or IPv6 range defining the subnet, in CIDR notation. - `subnet_type?: "cloudflare_source" | "warp"` The type of subnet. - `"cloudflare_source"` - `"warp"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const subnet = await client.zeroTrust.networks.subnets.warp.get( 'f70ff985-a4ef-4643-bbbc-4a0ed4fc8415', { account_id: '699d98642c564d2e855e9661899b7252' }, ); console.log(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 `client.zeroTrust.networks.subnets.warp.edit(stringsubnetId, WARPEditParamsparams, RequestOptionsoptions?): 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 - `subnetId: string` The UUID of the subnet. - `params: WARPEditParams` - `account_id: string` Path param: Cloudflare account ID - `comment?: string` Body param: An optional description of the subnet. - `is_default_network?: boolean` Body param: If `true`, this is the default subnet for the account. There can only be one default subnet per account. - `name?: string` Body param: A user-friendly name for the subnet. - `network?: string` Body param: The private IPv4 or IPv6 range defining the subnet, in CIDR notation. ### Returns - `Subnet` - `id?: string` The UUID of the subnet. - `comment?: string` An optional description of the subnet. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `is_default_network?: boolean` If `true`, this is the default subnet for the account. There can only be one default subnet per account. - `name?: string` A user-friendly name for the subnet. - `network?: string` The private IPv4 or IPv6 range defining the subnet, in CIDR notation. - `subnet_type?: "cloudflare_source" | "warp"` The type of subnet. - `"cloudflare_source"` - `"warp"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const subnet = await client.zeroTrust.networks.subnets.warp.edit( 'f70ff985-a4ef-4643-bbbc-4a0ed4fc8415', { account_id: '699d98642c564d2e855e9661899b7252' }, ); console.log(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 `client.zeroTrust.networks.subnets.warp.delete(stringsubnetId, WARPDeleteParamsparams, RequestOptionsoptions?): WARPDeleteResponse | null` **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 - `subnetId: string` The UUID of the subnet. - `params: WARPDeleteParams` - `account_id: string` Cloudflare account ID ### Returns - `WARPDeleteResponse` - `id?: string` The UUID of the subnet. - `comment?: string` An optional description of the subnet. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `is_default_network?: boolean` If `true`, this is the default subnet for the account. There can only be one default subnet per account. - `name?: string` A user-friendly name for the subnet. - `network?: string` The private IPv4 or IPv6 range defining the subnet, in CIDR notation. - `subnet_type?: "cloudflare_source" | "warp"` The type of subnet. - `"cloudflare_source"` - `"warp"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const warp = await client.zeroTrust.networks.subnets.warp.delete( 'f70ff985-a4ef-4643-bbbc-4a0ed4fc8415', { account_id: '699d98642c564d2e855e9661899b7252' }, ); console.log(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 - `Subnet` - `id?: string` The UUID of the subnet. - `comment?: string` An optional description of the subnet. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `is_default_network?: boolean` If `true`, this is the default subnet for the account. There can only be one default subnet per account. - `name?: string` A user-friendly name for the subnet. - `network?: string` The private IPv4 or IPv6 range defining the subnet, in CIDR notation. - `subnet_type?: "cloudflare_source" | "warp"` The type of subnet. - `"cloudflare_source"` - `"warp"` ### WARP Delete Response - `WARPDeleteResponse` - `id?: string` The UUID of the subnet. - `comment?: string` An optional description of the subnet. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `is_default_network?: boolean` If `true`, this is the default subnet for the account. There can only be one default subnet per account. - `name?: string` A user-friendly name for the subnet. - `network?: string` The private IPv4 or IPv6 range defining the subnet, in CIDR notation. - `subnet_type?: "cloudflare_source" | "warp"` The type of subnet. - `"cloudflare_source"` - `"warp"` # Cloudflare Source ## Update Cloudflare Source Subnet `client.zeroTrust.networks.subnets.cloudflareSource.update("v4" | "v6"addressFamily, CloudflareSourceUpdateParamsparams, RequestOptionsoptions?): Subnet` **patch** `/accounts/{account_id}/zerotrust/subnets/cloudflare_source/{address_family}` Updates the Cloudflare Source subnet of the given address family ### Parameters - `addressFamily: "v4" | "v6"` IP address family, either `v4` (IPv4) or `v6` (IPv6) - `"v4"` - `"v6"` - `params: CloudflareSourceUpdateParams` - `account_id: string` Path param: Cloudflare account ID - `comment?: string` Body param: An optional description of the subnet. - `name?: string` Body param: A user-friendly name for the subnet. - `network?: string` Body param: The private IPv4 or IPv6 range defining the subnet, in CIDR notation. ### Returns - `Subnet` - `id?: string` The UUID of the subnet. - `comment?: string` An optional description of the subnet. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `is_default_network?: boolean` If `true`, this is the default subnet for the account. There can only be one default subnet per account. - `name?: string` A user-friendly name for the subnet. - `network?: string` The private IPv4 or IPv6 range defining the subnet, in CIDR notation. - `subnet_type?: "cloudflare_source" | "warp"` The type of subnet. - `"cloudflare_source"` - `"warp"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const subnet = await client.zeroTrust.networks.subnets.cloudflareSource.update('v4', { account_id: '699d98642c564d2e855e9661899b7252', }); console.log(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 `client.zeroTrust.networks.hostnameRoutes.list(HostnameRouteListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/zerotrust/routes/hostname` Lists and filters hostname routes in an account. ### Parameters - `params: HostnameRouteListParams` - `account_id: string` Path param: Cloudflare account ID - `id?: string` Query param: The hostname route ID. - `comment?: string` Query param: If set, only list hostname routes with the given comment. - `existed_at?: string` Query param: If provided, include only resources that were created (and not deleted) before this time. URL encoded. - `hostname?: string` Query param: If set, only list hostname routes that contain a substring of the given value, the filter is case-insensitive. - `is_deleted?: boolean` Query param: If `true`, only return deleted hostname routes. If `false`, exclude deleted hostname routes. - `page?: number` Query param: Page number of paginated results. - `per_page?: number` Query param: Number of results to display. - `tunnel_id?: string` Query param: If set, only list hostname routes that point to a specific tunnel. ### Returns - `HostnameRoute` - `id?: string` The hostname route ID. - `comment?: string` An optional description of the hostname route. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `hostname?: string` The hostname of the route. - `tunnel_id?: string` UUID of the tunnel. - `tunnel_name?: string` A user-friendly name for a tunnel. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const hostnameRoute of client.zeroTrust.networks.hostnameRoutes.list({ account_id: '699d98642c564d2e855e9661899b7252', })) { console.log(hostnameRoute.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 `client.zeroTrust.networks.hostnameRoutes.get(stringhostnameRouteId, HostnameRouteGetParamsparams, RequestOptionsoptions?): HostnameRoute` **get** `/accounts/{account_id}/zerotrust/routes/hostname/{hostname_route_id}` Get a hostname route. ### Parameters - `hostnameRouteId: string` The hostname route ID. - `params: HostnameRouteGetParams` - `account_id: string` Cloudflare account ID ### Returns - `HostnameRoute` - `id?: string` The hostname route ID. - `comment?: string` An optional description of the hostname route. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `hostname?: string` The hostname of the route. - `tunnel_id?: string` UUID of the tunnel. - `tunnel_name?: string` A user-friendly name for a tunnel. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const hostnameRoute = await client.zeroTrust.networks.hostnameRoutes.get( 'f70ff985-a4ef-4643-bbbc-4a0ed4fc8415', { account_id: '699d98642c564d2e855e9661899b7252' }, ); console.log(hostnameRoute.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 `client.zeroTrust.networks.hostnameRoutes.create(HostnameRouteCreateParamsparams, RequestOptionsoptions?): HostnameRoute` **post** `/accounts/{account_id}/zerotrust/routes/hostname` Create a hostname route. ### Parameters - `params: HostnameRouteCreateParams` - `account_id: string` Path param: Cloudflare account ID - `comment?: string` Body param: An optional description of the hostname route. - `hostname?: string` Body param: The hostname of the route. - `tunnel_id?: string` Body param: UUID of the tunnel. ### Returns - `HostnameRoute` - `id?: string` The hostname route ID. - `comment?: string` An optional description of the hostname route. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `hostname?: string` The hostname of the route. - `tunnel_id?: string` UUID of the tunnel. - `tunnel_name?: string` A user-friendly name for a tunnel. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const hostnameRoute = await client.zeroTrust.networks.hostnameRoutes.create({ account_id: '699d98642c564d2e855e9661899b7252', }); console.log(hostnameRoute.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 `client.zeroTrust.networks.hostnameRoutes.edit(stringhostnameRouteId, HostnameRouteEditParamsparams, RequestOptionsoptions?): HostnameRoute` **patch** `/accounts/{account_id}/zerotrust/routes/hostname/{hostname_route_id}` Updates a hostname route. ### Parameters - `hostnameRouteId: string` The hostname route ID. - `params: HostnameRouteEditParams` - `account_id: string` Path param: Cloudflare account ID - `comment?: string` Body param: An optional description of the hostname route. - `hostname?: string` Body param: The hostname of the route. - `tunnel_id?: string` Body param: UUID of the tunnel. ### Returns - `HostnameRoute` - `id?: string` The hostname route ID. - `comment?: string` An optional description of the hostname route. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `hostname?: string` The hostname of the route. - `tunnel_id?: string` UUID of the tunnel. - `tunnel_name?: string` A user-friendly name for a tunnel. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const hostnameRoute = await client.zeroTrust.networks.hostnameRoutes.edit( 'f70ff985-a4ef-4643-bbbc-4a0ed4fc8415', { account_id: '699d98642c564d2e855e9661899b7252' }, ); console.log(hostnameRoute.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 `client.zeroTrust.networks.hostnameRoutes.delete(stringhostnameRouteId, HostnameRouteDeleteParamsparams, RequestOptionsoptions?): HostnameRoute` **delete** `/accounts/{account_id}/zerotrust/routes/hostname/{hostname_route_id}` Delete a hostname route. ### Parameters - `hostnameRouteId: string` The hostname route ID. - `params: HostnameRouteDeleteParams` - `account_id: string` Cloudflare account ID ### Returns - `HostnameRoute` - `id?: string` The hostname route ID. - `comment?: string` An optional description of the hostname route. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `hostname?: string` The hostname of the route. - `tunnel_id?: string` UUID of the tunnel. - `tunnel_name?: string` A user-friendly name for a tunnel. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const hostnameRoute = await client.zeroTrust.networks.hostnameRoutes.delete( 'f70ff985-a4ef-4643-bbbc-4a0ed4fc8415', { account_id: '699d98642c564d2e855e9661899b7252' }, ); console.log(hostnameRoute.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 - `HostnameRoute` - `id?: string` The hostname route ID. - `comment?: string` An optional description of the hostname route. - `created_at?: string` Timestamp of when the resource was created. - `deleted_at?: string` Timestamp of when the resource was deleted. If `null`, the resource has not been deleted. - `hostname?: string` The hostname of the route. - `tunnel_id?: string` UUID of the tunnel. - `tunnel_name?: string` A user-friendly name for a tunnel.