# Subnets

Network subnet management operations

## List subnets

> Lists subnets to which the project has access.

```json
{"openapi":"3.0.3","info":{"title":"Networking API","version":"2.0"},"tags":[{"name":"Subnets","description":"Network subnet management operations"}],"servers":[{"url":"https://{host}/neutron","description":"PCD Network API v2.0","variables":{"host":{"default":"example.platform9.com","description":"The PCD controlplane hostname"}}}],"security":[{"pcdAuth":[]}],"components":{"securitySchemes":{"pcdAuth":{"name":"X-Auth-Token","type":"apiKey","in":"header","description":"PCD Identity Service token authentication"}},"parameters":{"NetworkIdFilter":{"name":"network_id","description":"Filter the list result by the network ID.","schema":{"type":"string"},"in":"query"},"IdFilter":{"name":"id","description":"Filter the list result by the ID of the resource.","schema":{"type":"string"},"in":"query"},"NameFilter":{"name":"name","description":"Filter the list result by the human-readable name of the resource.","schema":{"type":"string"},"in":"query"},"ProjectIdFilter":{"name":"project_id","description":"Filter the list result by the ID of the project that owns the resource.","schema":{"type":"string"},"in":"query"},"TenantIdFilter":{"name":"tenant_id","description":"Filter the list result by the ID of the project that owns the resource.","schema":{"type":"string"},"in":"query"},"Fields":{"name":"fields","description":"The fields that you want the server to return. If no fields are specified, all fields are returned.","schema":{"type":"string"},"in":"query"},"SortDir":{"name":"sort_dir","description":"Sort direction. A valid value is asc (ascending) or desc (descending).","schema":{"enum":["asc","desc"],"type":"string"},"in":"query"},"SortKey":{"name":"sort_key","description":"Sorts by a resource attribute.","schema":{"type":"string"},"in":"query"},"Tags":{"name":"tags","description":"A list of tags to filter the list result by. Resources that match all tags in this list will be returned.","schema":{"type":"string"},"in":"query"},"TagsAny":{"name":"tags-any","description":"A list of tags to filter the list result by. Resources that match any tag in this list will be returned.","schema":{"type":"string"},"in":"query"},"NotTags":{"name":"not-tags","description":"A list of tags to filter the list result by. Resources that match all tags in this list will be excluded.","schema":{"type":"string"},"in":"query"},"NotTagsAny":{"name":"not-tags-any","description":"A list of tags to filter the list result by. Resources that match any tag in this list will be excluded.","schema":{"type":"string"},"in":"query"}},"schemas":{"SubnetsResponse":{"type":"object","properties":{"subnets":{"type":"array","items":{"$ref":"#/components/schemas/Subnet"}}}},"Subnet":{"type":"object","properties":{"id":{"format":"uuid","type":"string","readOnly":true},"name":{"type":"string"},"description":{"type":"string"},"network_id":{"format":"uuid","type":"string"},"ip_version":{"enum":[4,6],"type":"integer"},"cidr":{"type":"string"},"gateway_ip":{"type":"string"},"dhcp_enabled":{"type":"boolean"},"dns_nameservers":{"type":"array","items":{"type":"string"}},"allocation_pools":{"type":"array","items":{"$ref":"#/components/schemas/AllocationPool"}},"host_routes":{"type":"array","items":{"$ref":"#/components/schemas/HostRoute"}},"project_id":{"format":"uuid","type":"string"},"tenant_id":{"format":"uuid","type":"string"},"ipv6_address_mode":{"enum":["slaac","dhcpv6-stateful","dhcpv6-stateless"],"type":"string"},"ipv6_ra_mode":{"enum":["slaac","dhcpv6-stateful","dhcpv6-stateless"],"type":"string"},"subnetpool_id":{"format":"uuid","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"revision_number":{"type":"integer","readOnly":true},"created_at":{"format":"date-time","type":"string","readOnly":true},"updated_at":{"format":"date-time","type":"string","readOnly":true}}},"AllocationPool":{"type":"object","properties":{"start":{"type":"string"},"end":{"type":"string"}}},"HostRoute":{"type":"object","properties":{"destination":{"type":"string"},"nexthop":{"type":"string"}}},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"detail":{"type":"string"}}}}}},"responses":{"Unauthorized":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unauthorized"}}},"paths":{"/v2.0/subnets":{"get":{"tags":["Subnets"],"parameters":[{"$ref":"#/components/parameters/NetworkIdFilter"},{"$ref":"#/components/parameters/IdFilter"},{"$ref":"#/components/parameters/NameFilter"},{"$ref":"#/components/parameters/ProjectIdFilter"},{"$ref":"#/components/parameters/TenantIdFilter"},{"$ref":"#/components/parameters/Fields"},{"$ref":"#/components/parameters/SortDir"},{"$ref":"#/components/parameters/SortKey"},{"$ref":"#/components/parameters/Tags"},{"$ref":"#/components/parameters/TagsAny"},{"$ref":"#/components/parameters/NotTags"},{"$ref":"#/components/parameters/NotTagsAny"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubnetsResponse"}}},"description":"Successful operation"},"401":{"$ref":"#/components/responses/Unauthorized"}},"operationId":"listSubnets","summary":"List subnets","description":"Lists subnets to which the project has access."}}}}
```

## Create subnet

> Creates a subnet.

```json
{"openapi":"3.0.3","info":{"title":"Networking API","version":"2.0"},"tags":[{"name":"Subnets","description":"Network subnet management operations"}],"servers":[{"url":"https://{host}/neutron","description":"PCD Network API v2.0","variables":{"host":{"default":"example.platform9.com","description":"The PCD controlplane hostname"}}}],"security":[{"pcdAuth":[]}],"components":{"securitySchemes":{"pcdAuth":{"name":"X-Auth-Token","type":"apiKey","in":"header","description":"PCD Identity Service token authentication"}},"schemas":{"SubnetCreateRequest":{"required":["subnet"],"type":"object","properties":{"subnet":{"required":["network_id","cidr","ip_version"],"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"network_id":{"format":"uuid","type":"string"},"ip_version":{"enum":[4,6],"type":"integer"},"cidr":{"type":"string"},"gateway_ip":{"type":"string"},"dhcp_enabled":{"default":true,"type":"boolean"},"dns_nameservers":{"type":"array","items":{"type":"string"}},"allocation_pools":{"type":"array","items":{"$ref":"#/components/schemas/AllocationPool"}},"host_routes":{"type":"array","items":{"$ref":"#/components/schemas/HostRoute"}},"project_id":{"format":"uuid","type":"string"},"tenant_id":{"format":"uuid","type":"string"},"ipv6_address_mode":{"enum":["slaac","dhcpv6-stateful","dhcpv6-stateless"],"type":"string"},"ipv6_ra_mode":{"enum":["slaac","dhcpv6-stateful","dhcpv6-stateless"],"type":"string"},"subnetpool_id":{"format":"uuid","type":"string"}}}}},"AllocationPool":{"type":"object","properties":{"start":{"type":"string"},"end":{"type":"string"}}},"HostRoute":{"type":"object","properties":{"destination":{"type":"string"},"nexthop":{"type":"string"}}},"SubnetResponse":{"type":"object","properties":{"subnet":{"$ref":"#/components/schemas/Subnet"}}},"Subnet":{"type":"object","properties":{"id":{"format":"uuid","type":"string","readOnly":true},"name":{"type":"string"},"description":{"type":"string"},"network_id":{"format":"uuid","type":"string"},"ip_version":{"enum":[4,6],"type":"integer"},"cidr":{"type":"string"},"gateway_ip":{"type":"string"},"dhcp_enabled":{"type":"boolean"},"dns_nameservers":{"type":"array","items":{"type":"string"}},"allocation_pools":{"type":"array","items":{"$ref":"#/components/schemas/AllocationPool"}},"host_routes":{"type":"array","items":{"$ref":"#/components/schemas/HostRoute"}},"project_id":{"format":"uuid","type":"string"},"tenant_id":{"format":"uuid","type":"string"},"ipv6_address_mode":{"enum":["slaac","dhcpv6-stateful","dhcpv6-stateless"],"type":"string"},"ipv6_ra_mode":{"enum":["slaac","dhcpv6-stateful","dhcpv6-stateless"],"type":"string"},"subnetpool_id":{"format":"uuid","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"revision_number":{"type":"integer","readOnly":true},"created_at":{"format":"date-time","type":"string","readOnly":true},"updated_at":{"format":"date-time","type":"string","readOnly":true}}},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"detail":{"type":"string"}}}}}},"responses":{"BadRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Bad Request"},"Unauthorized":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unauthorized"}}},"paths":{"/v2.0/subnets":{"post":{"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubnetCreateRequest"}}},"required":true},"tags":["Subnets"],"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubnetResponse"}}},"description":"Subnet created successfully"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}},"operationId":"createSubnet","summary":"Create subnet","description":"Creates a subnet."}}}}
```

## Show subnet details

> Shows details for a subnet.

```json
{"openapi":"3.0.3","info":{"title":"Networking API","version":"2.0"},"tags":[{"name":"Subnets","description":"Network subnet management operations"}],"servers":[{"url":"https://{host}/neutron","description":"PCD Network API v2.0","variables":{"host":{"default":"example.platform9.com","description":"The PCD controlplane hostname"}}}],"security":[{"pcdAuth":[]}],"components":{"securitySchemes":{"pcdAuth":{"name":"X-Auth-Token","type":"apiKey","in":"header","description":"PCD Identity Service token authentication"}},"parameters":{"SubnetId":{"name":"subnet_id","description":"The ID of the subnet.","schema":{"format":"uuid","type":"string"},"in":"path","required":true},"Fields":{"name":"fields","description":"The fields that you want the server to return. If no fields are specified, all fields are returned.","schema":{"type":"string"},"in":"query"}},"schemas":{"SubnetResponse":{"type":"object","properties":{"subnet":{"$ref":"#/components/schemas/Subnet"}}},"Subnet":{"type":"object","properties":{"id":{"format":"uuid","type":"string","readOnly":true},"name":{"type":"string"},"description":{"type":"string"},"network_id":{"format":"uuid","type":"string"},"ip_version":{"enum":[4,6],"type":"integer"},"cidr":{"type":"string"},"gateway_ip":{"type":"string"},"dhcp_enabled":{"type":"boolean"},"dns_nameservers":{"type":"array","items":{"type":"string"}},"allocation_pools":{"type":"array","items":{"$ref":"#/components/schemas/AllocationPool"}},"host_routes":{"type":"array","items":{"$ref":"#/components/schemas/HostRoute"}},"project_id":{"format":"uuid","type":"string"},"tenant_id":{"format":"uuid","type":"string"},"ipv6_address_mode":{"enum":["slaac","dhcpv6-stateful","dhcpv6-stateless"],"type":"string"},"ipv6_ra_mode":{"enum":["slaac","dhcpv6-stateful","dhcpv6-stateless"],"type":"string"},"subnetpool_id":{"format":"uuid","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"revision_number":{"type":"integer","readOnly":true},"created_at":{"format":"date-time","type":"string","readOnly":true},"updated_at":{"format":"date-time","type":"string","readOnly":true}}},"AllocationPool":{"type":"object","properties":{"start":{"type":"string"},"end":{"type":"string"}}},"HostRoute":{"type":"object","properties":{"destination":{"type":"string"},"nexthop":{"type":"string"}}},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"detail":{"type":"string"}}}}}},"responses":{"Unauthorized":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unauthorized"},"NotFound":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Not Found"}}},"paths":{"/v2.0/subnets/{subnet_id}":{"get":{"tags":["Subnets"],"parameters":[{"$ref":"#/components/parameters/SubnetId"},{"$ref":"#/components/parameters/Fields"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubnetResponse"}}},"description":"Successful operation"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}},"operationId":"showSubnet","summary":"Show subnet details","description":"Shows details for a subnet."}}}}
```

## Update subnet

> Updates a subnet.

```json
{"openapi":"3.0.3","info":{"title":"Networking API","version":"2.0"},"tags":[{"name":"Subnets","description":"Network subnet management operations"}],"servers":[{"url":"https://{host}/neutron","description":"PCD Network API v2.0","variables":{"host":{"default":"example.platform9.com","description":"The PCD controlplane hostname"}}}],"security":[{"pcdAuth":[]}],"components":{"securitySchemes":{"pcdAuth":{"name":"X-Auth-Token","type":"apiKey","in":"header","description":"PCD Identity Service token authentication"}},"schemas":{"SubnetUpdateRequest":{"type":"object","properties":{"subnet":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"gateway_ip":{"type":"string"},"dhcp_enabled":{"type":"boolean"},"dns_nameservers":{"type":"array","items":{"type":"string"}},"allocation_pools":{"type":"array","items":{"$ref":"#/components/schemas/AllocationPool"}},"host_routes":{"type":"array","items":{"$ref":"#/components/schemas/HostRoute"}}}}}},"AllocationPool":{"type":"object","properties":{"start":{"type":"string"},"end":{"type":"string"}}},"HostRoute":{"type":"object","properties":{"destination":{"type":"string"},"nexthop":{"type":"string"}}},"SubnetResponse":{"type":"object","properties":{"subnet":{"$ref":"#/components/schemas/Subnet"}}},"Subnet":{"type":"object","properties":{"id":{"format":"uuid","type":"string","readOnly":true},"name":{"type":"string"},"description":{"type":"string"},"network_id":{"format":"uuid","type":"string"},"ip_version":{"enum":[4,6],"type":"integer"},"cidr":{"type":"string"},"gateway_ip":{"type":"string"},"dhcp_enabled":{"type":"boolean"},"dns_nameservers":{"type":"array","items":{"type":"string"}},"allocation_pools":{"type":"array","items":{"$ref":"#/components/schemas/AllocationPool"}},"host_routes":{"type":"array","items":{"$ref":"#/components/schemas/HostRoute"}},"project_id":{"format":"uuid","type":"string"},"tenant_id":{"format":"uuid","type":"string"},"ipv6_address_mode":{"enum":["slaac","dhcpv6-stateful","dhcpv6-stateless"],"type":"string"},"ipv6_ra_mode":{"enum":["slaac","dhcpv6-stateful","dhcpv6-stateless"],"type":"string"},"subnetpool_id":{"format":"uuid","type":"string"},"tags":{"type":"array","items":{"type":"string"}},"revision_number":{"type":"integer","readOnly":true},"created_at":{"format":"date-time","type":"string","readOnly":true},"updated_at":{"format":"date-time","type":"string","readOnly":true}}},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"detail":{"type":"string"}}}}}},"parameters":{"SubnetId":{"name":"subnet_id","description":"The ID of the subnet.","schema":{"format":"uuid","type":"string"},"in":"path","required":true}},"responses":{"BadRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Bad Request"},"Unauthorized":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unauthorized"},"Forbidden":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Forbidden"},"NotFound":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Not Found"},"PreconditionFailed":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Precondition Failed"}}},"paths":{"/v2.0/subnets/{subnet_id}":{"put":{"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubnetUpdateRequest"}}},"required":true},"tags":["Subnets"],"parameters":[{"$ref":"#/components/parameters/SubnetId"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubnetResponse"}}},"description":"Subnet updated successfully"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"412":{"$ref":"#/components/responses/PreconditionFailed"}},"operationId":"updateSubnet","summary":"Update subnet","description":"Updates a subnet."}}}}
```

## Delete subnet

> Deletes a subnet.

```json
{"openapi":"3.0.3","info":{"title":"Networking API","version":"2.0"},"tags":[{"name":"Subnets","description":"Network subnet management operations"}],"servers":[{"url":"https://{host}/neutron","description":"PCD Network API v2.0","variables":{"host":{"default":"example.platform9.com","description":"The PCD controlplane hostname"}}}],"security":[{"pcdAuth":[]}],"components":{"securitySchemes":{"pcdAuth":{"name":"X-Auth-Token","type":"apiKey","in":"header","description":"PCD Identity Service token authentication"}},"parameters":{"SubnetId":{"name":"subnet_id","description":"The ID of the subnet.","schema":{"format":"uuid","type":"string"},"in":"path","required":true}},"responses":{"Unauthorized":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unauthorized"},"NotFound":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Not Found"},"Conflict":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Conflict"},"PreconditionFailed":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Precondition Failed"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"detail":{"type":"string"}}}}}}},"paths":{"/v2.0/subnets/{subnet_id}":{"delete":{"tags":["Subnets"],"parameters":[{"$ref":"#/components/parameters/SubnetId"}],"responses":{"204":{"description":"Subnet deleted successfully"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"412":{"$ref":"#/components/responses/PreconditionFailed"}},"operationId":"deleteSubnet","summary":"Delete subnet","description":"Deletes a subnet."}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.platform9.com/api-docs/networking-service/subnets.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
