# Convert a Custom Network Security Group to Default

{% hint style="info" %}
**Note:** Only contract administrators, owners, and users with permissions to the VDC concerned can create and manage NSGs via API.
{% endhint %}

{% hint style="info" %}
**Prerequisite:** You need an IONOS Cloud account with API credentials configured with the appropriate permissions.
{% endhint %}

You can convert a Custom NSG to a Default NSG during the update of a datacenter. You can use any of the following [<mark style="color:blue;">Cloud API</mark>](https://api.ionos.com/docs/cloud/v6/) requests with the property `defaultSecurityGroupId` set to UUID of the NSG to be converted and the other required properties:

`PUT /datacenters/{datacenterId}`

`PATCH /datacenters/{datacenterId}`

### Request

```bash
curl --location 'https://api.ionos.com/cloudapi/v6/datacenters/15f67991-0f51-4efc-a8ad-ef1fb31a480c' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic YYXabCDeFmLMO0c2hyYUBpb25vcy5jb206I1Bha2lzdGFuXzE=' \
--data '{
  "properties": {
    "name": "Production Datacenter",
    "description": "My Production Datacenter",
    "location": "us/las",
    "defaultSecurityGroupId": "15f67991-0f51-4efc-a8ad-ef1fb31a480c"
  }
}'
```

### Response

**202 Accepted**

```json
{
 "id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
 "type": "datacenter",
 "href": "<RESOURCE-URI>",
 "metadata": {
  "etag": "45480eb3fbfc31f1d916c1eaa4abdcc3",
  "createdDate": "2015-12-04T14:34:09.809Z",
  "createdBy": "user@example.com",
  "createdByUserId": "user@example.com",
  "lastModifiedDate": "2015-12-04T14:34:09.809Z",
  "lastModifiedBy": "user@example.com",
  "lastModifiedByUserId": "63cef532-26fe-4a64-a4e0-de7c8a506c90",
  "state": "AVAILABLE"
 },
 "properties": {
  "name": "Production datacenter",
  "description": "My Production Datacenter",
  "location": "us/las",
  "version": 8,
  "features": [
   "SSD"
  ],
  "secAuthProtection": true,
  "cpuArchitecture": [
   {
    "cpuFamily": "INTEL_ICELAKE",
    "maxCores": 62,
    "maxRam": 245760,
    "vendor": "AuthenticAMD"
   }
  ],
  "ipv6CidrBlock": "2001:db8:b06d:8f00::/56",
  "defaultSecurityGroupId": "15f67991-0f51-4efc-a8ad-ef1fb31a480c"
 }
}
```

{% hint style="info" %}
**Note:** For CloudAPI, some resources are created asynchronously. You can check for the progress via the **Status URL** that is returned in the response header of the **POST** or **PUT** call.
{% endhint %}
