---
title: "Create subnetwork"
method: POST
path: "/v1/subnetworks"
tags: ["Subnetworks"]
---

# Create subnetwork

`POST /v1/subnetworks`

## Request

- Base URL: `https://api.emma.ms/external`
- URL: `https://api.emma.ms/external/v1/subnetworks`
- Auth: HTTP bearer

This method creates a subnetwork.
To create a subnetwork, consider the following parameters:
1. Select a data center using the `/v1/data-centers` endpoint. The data center determines the provider and location of the subnetwork.
2. Specify the IP address range (optional). Subnetwork prefix values can have exceptions depending on that provider and must be in ranges: 10.0.0.0 - 10.255.255.255, 172.16.0.0 - 172.31.255.255, 192.168.0.0 - 192.168.255.255.

Specific conditions are depending on the provider:
- GCP: 2 first and 2 last addresses are reserved by the provider. Notice that VMs in different GCP subnetworks can be connected to each other.
- Azure: 4 first and the last ones are reserved by the provider.
- AWS: 3 first and the last one are reserved by the provider.

3. Specify the network size (required). Network size must be: for DigitalOcean /28-/16, for Gcore /24-/16, for Azure /29 - /2, for AWS /28 - /16

## Request body

- SubnetworkCreate
  - `name` string: Subnetwork name
  - `dataCenterId` string, required: ID of the cloud provider's data center
  - `subnetworkPrefix` string: The prefix for the subnetwork IP address range
  - `subnetworkSize` integer, required: The net mask size for the subnetwork

## Response `200`

Successful operation

- Subnetwork
  - `id` string: Subnetwork id
  - `name` string: Subnetwork name
  - `dataCenterId` string: ID of the cloud provider's data center
  - `subnetworkPrefix` string: The prefix for the subnetwork IP address range
  - `subnetworkSize` integer: The net mask size for the subnetwork
  - `resources` object[]: List of entities in the subnetwork
    - `id` integer: ID of the entity
    - `resourceType` string: Type of the entity
  - `status` string: Subnetwork status

## Other responses

- `400`: Bad request
- `401`: Unauthorized
- `403`: Forbidden - Access is denied
- `500`: Internal server error

---

[API](https://skmtc.dev/emma/apis/public-emma-api.md) - [All operations](https://skmtc.dev/emma/apis/public-emma-api/llms.txt) - [OpenAPI document](https://skmtc.dev/emma/apis/public-emma-api/revisions/9e55f0920078?raw)
