Skip to main content
GET
/
cloud
/
v1
/
subnets
/
{project_id}
/
{region_id}
/
{subnet_id}
Python
import os
from gcore import Gcore

client = Gcore(
    api_key=os.environ.get("GCORE_API_KEY"),  # This is the default and can be omitted
)
subnet = client.cloud.networks.subnets.get(
    subnet_id="b39792c3-3160-4356-912e-ba396c95cdcf",
    project_id=1,
    region_id=1,
)
print(subnet.cidr)
{
  "cidr": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "enable_dhcp": true,
  "ip_version": 4,
  "name": "<string>",
  "network_id": "<string>",
  "project_id": 123,
  "region": "<string>",
  "region_id": 123,
  "tags": [
    {
      "key": "<string>",
      "read_only": true,
      "value": "<string>"
    }
  ],
  "updated_at": "2023-11-07T05:31:56Z",
  "available_ips": 250,
  "creator_task_id": "5cc890da-d031-4a23-ac31-625edfa22812",
  "dns_nameservers": [
    "8.8.8.8",
    "8.8.4.4"
  ],
  "gateway_ip": "192.168.13.1",
  "has_router": false,
  "host_routes": [],
  "id": "b39792c3-3160-4356-912e-ba396c95cdcf",
  "task_id": null,
  "total_ips": 253
}

Authorizations

Authorization
string
header
required

API key for authentication. Make sure to include the word apikey, followed by a single space and then your token. Example: apikey 1234$abcdef

Path Parameters

project_id
integer
required

Project ID

region_id
integer
required

Region ID

subnet_id
string<uuid4>
required

Subnet ID

Response

200 - application/json

OK

cidr
string<ipvanynetwork>
required

CIDR

created_at
string<date-time>
required

Datetime when the subnet was created

enable_dhcp
boolean
required

True if DHCP should be enabled

ip_version
enum<integer>
required

IP version

Available options:
4,
6
name
string
required

Subnet name

network_id
string<uuid4>
required

Network ID

project_id
integer
required

Project ID

region
string
required

Region name

region_id
integer
required

Region ID

tags
TagSerializer · object[]
required

List of key-value tags associated with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for better organization and management. Some tags are read-only and cannot be modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values.

updated_at
string<date-time>
required

Datetime when the subnet was last updated

available_ips
integer | null

Number of available ips in subnet

Example:

250

creator_task_id
string<uuid4> | null

Task that created this entity

Example:

"5cc890da-d031-4a23-ac31-625edfa22812"

dns_nameservers
string<ipvanyaddress>[] | null

List IP addresses of a DNS resolver reachable from the network

Example:
["8.8.8.8", "8.8.4.4"]
gateway_ip
string<ipvanyaddress> | null

Default GW IPv4 address, advertised in DHCP routes of this subnet. If null, no gateway is advertised by this subnet.

Example:

"192.168.13.1"

has_router
boolean
default:false
deprecated

Deprecated. Always returns false.

host_routes
RouteOutSerializer · object[] | null

List of custom static routes to advertise via DHCP.

Example:
[]
id
string<uuid4> | null

Subnet id.

Example:

"b39792c3-3160-4356-912e-ba396c95cdcf"

task_id
string<uuid4> | null

The UUID of the active task that currently holds a lock on the resource. This lock prevents concurrent modifications to ensure consistency. If null, the resource is not locked.

Example:

null

total_ips
integer | null

Total number of ips in subnet

Example:

253