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"

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"]
}
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
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.

{
  "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"]
}

Response (200 OK)

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