Network Endpoints

Endpoints are under /v1/resource/networks and require authentication.

Base URL: https://api.gpcn.com/v1

See the API Reference → for examples in TypeScript, Python, Go, and C#.

List Networks

GET /resource/networks

Returns a paginated list of networks.

Query Parameters

Parameter Type Default Description
page integer 1 Page number
limit integer 10 Items per page (max 100)
sort string createdAt:desc Sort field and direction
search string — Search by name or CIDR
filter[regionId] integer — Filter by region
filter[datacenterId] UUID — Filter by data center
filter[networkType] string — Filter by type: "standard" or "custom"
filter[resourceGroupId] UUID — Filter by resource group. Naming a group you aren't a member of returns no rows, not an error.

Response

Paginated array of network objects with data center info, SNAT status, and connected VM count.

curl https://api.gpcn.com/v1/resource/networks \
  -H "X-API-Key: gpcn_your_api_key_here"

Create Network

POST /resource/networks

Request Body

{
  "name": "backend-network",
  "datacenterId": "dc-uuid",
  "networkType": "standard",
  "description": "Internal services",
  "cidrBlock": "10.0.1.0/24",
  "snatEnabled": true,
  "dhcpServerEnabled": true,
  "dhcpStartAddress": "10.0.1.100",
  "dhcpEndAddress": "10.0.1.200",
  "defaultRouteEnabled": true,
  "defaultRoute": "10.0.1.1",
  "serveDNSServersEnabled": true,
  "dnsServers": ["8.8.8.8", "8.8.4.4"],
  "resourceGroupId": "880e8400-e29b-41d4-a716-446655440001"
}
Field Type Required Description
name string Yes Unique network name
datacenterId UUID Yes Target data center
networkType string Yes "standard" or "custom"
description string No Description
cidrBlock string No IP range in CIDR notation
snatEnabled boolean No SNAT for outbound (standard only)
dhcpServerEnabled boolean No Enable DHCP
dhcpStartAddress string No DHCP range start
dhcpEndAddress string No DHCP range end
defaultRouteEnabled boolean No Enable default routing
defaultRoute string No Default gateway
serveDNSServersEnabled boolean No Serve DNS to VMs
dnsServers string[] No Nameserver addresses
resourceGroupId UUID No Resource group to create into. Omitted: the network is placed in the tenant's Default resource group.
curl -X POST https://api.gpcn.com/v1/resource/networks \
  -H "X-API-Key: gpcn_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "backend-network",
    "datacenterId": "dc-uuid",
    "networkType": "standard",
    "cidrBlock": "10.0.1.0/24",
    "snatEnabled": true
  }'

Response (202 Accepted)

Job tracking object.

Error: 409 Conflict

Network name already exists.

Get Network Details

GET /resource/networks/{id}

Response

Full network object with CIDR, DHCP config, DNS servers, gateway, allocation pools, and connectivity info.

Update Network

PUT /resource/networks/{id}

Request Body

All fields are optional. Only provided fields are updated. Send resourceGroupId on its own to move the network into another resource group.

{
  "name": "new-name",
  "description": "Updated description",
  "cidrBlock": "10.0.2.0/24",
  "dhcpServerEnabled": true,
  "dhcpStartAddress": "10.0.2.50",
  "dhcpEndAddress": "10.0.2.250",
  "defaultRouteEnabled": true,
  "defaultRoute": "10.0.2.1",
  "serveDNSServersEnabled": true,
  "dnsServers": ["1.1.1.1"],
  "resourceGroupId": "880e8400-e29b-41d4-a716-446655440002"
}

Sending resourceGroupId: null is refused (422) — move the network into your tenant's Default resource group instead to take it out of a group. A move requires network:update in both the current and the destination group.

Response (200 OK)

Error: 403 Forbidden

You don't hold network:update in the network's current resource group, or (when resourceGroupId is sent) in the destination group (code Insufficient Permissions); or the destination isn't a resource group you're a member of (code Entity Access Denied, message "You do not have access to the specified resource group").

Delete Network

DELETE /resource/networks/{id}

Network must have no connected VMs.

Response (200 OK)

List VMs on Network

GET /resource/networks/{id}/virtual-machines

Returns VMs with interfaces connected to this network.

Response

Array of VM objects.

CIDR Details

GET /resource/networks/cidr-details

Validate a CIDR block and get calculated details.

Query Parameters

Pass CIDR block details as query parameters.

Response

CIDR validation results including usable address count and boundaries.

Bulk Delete

POST /resource/networks/bulk/delete

Request Body

{ "ids": ["net-uuid-1", "net-uuid-2"] }

1–50 IDs.

Next Steps