Skip to main content
GET
/
cloud
/
v1
/
subnets
/
{project_id}
/
{region_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
)
page = client.cloud.networks.subnets.list(
    project_id=1,
    region_id=1,
)
page = page.results[0]
print(page.cidr)
{
  "count": 1,
  "results": [
    {
      "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

Example:

1

region_id
integer
required

Region ID

Example:

1

Query Parameters

limit
integer
default:1000

Optional. Limit the number of returned items

Required range: x <= 1000
Example:

1000

network_id
string<uuid4>

Only list subnets of this network

Example:

"b30d0de7-bca2-4c83-9c57-9e645bd2cc92"

offset
integer
default:0

Optional. Offset value is used to exclude the first set of records from the result

Required range: x >= 0
Example:

0

order_by
enum<string>
default:cidr.asc

Ordering subnets list result by name, created_at, updated_at, available_ips, total_ips, and cidr (default) fields of the subnet and directions (name.asc).

Available options:
available_ips.asc,
available_ips.desc,
cidr.asc,
cidr.desc,
created_at.asc,
created_at.desc,
name.asc,
name.desc,
total_ips.asc,
total_ips.desc,
updated_at.asc,
updated_at.desc
Example:

"name.asc"

owned_by
enum<string>
default:project

Controls which subnets are returned. 'project' (default) returns only subnets owned by the project. 'any' returns all subnets from networks available to the project, including subnets from shared networks.

Available options:
any,
project
Example:

"project"

tag_key
string[]

Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2

Tag key. Maximum 255 characters. Cannot contain spaces, tabs, newlines, empty string or '=' character.

Required string length: 1 - 255
Pattern: ^[^\s=]+$
Example:
["key1", "key2"]
tag_key_value
string

Optional. Filter by tag key-value pairs.

Example:
{ "key": "value" }

Response

200 - application/json

OK

count
integer
required

Number of objects

Required range: x >= 0
Example:

1

results
SubnetSerializer · object[]
required

Objects