> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gcore.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a port

> Create and manage a port that connects a cloud resource to a public or private network.

## Customer Portal

Create a port when a resource needs a network attachment in one region.

## The Ports page

1\. Log in to the [Gcore Customer Portal](https://portal.gcore.com) and open **Cloud**.

2\. In the left sidebar, select **Networking**, then **Ports**.

![Ports page with the network groups, filters, and Create port](https://mintcdn.com/gcore/KcLJOgb4Y9HJAr3C/images/docs/cloud/networking/ip-address/create-a-port/ports-page.png?fit=max\&auto=format\&n=KcLJOgb4Y9HJAr3C\&q=85\&s=fe7b4371070105415e9e78d04451195a)

## Create a port

1\. Click **Create port**.

2\. Select the region. The port can attach only to a resource in that region.

![Create port dialog with Luxembourg-3 selected](https://mintcdn.com/gcore/KcLJOgb4Y9HJAr3C/images/docs/cloud/networking/ip-address/create-a-port/create-port-region.png?fit=max\&auto=format\&n=KcLJOgb4Y9HJAr3C\&q=85\&s=8d3e2819243daa70108ffbdd1f21f43c)

3\. Select the network type.

* **Public**: the network is the Gcore public pool. The subnet and the address come from that pool. **IP addresses** sets how many IPv4 addresses the port receives. The dialog shows the monthly price.
* **Private**: select a [private network](https://docs.gcore.com/cloud/networking/create-and-manage-a-network.md), or click **Create new**, and tick the subnets. The port gets one IP on each subnet. **Specify** sets that address. **Create new** next to the subnets opens [subnetwork](https://docs.gcore.com/cloud/networking/create-and-manage-a-subnetwork.md) creation. The dialog shows Free.

![Create port dialog with Public selected and the monthly price](https://mintcdn.com/gcore/KcLJOgb4Y9HJAr3C/images/docs/cloud/networking/ip-address/create-a-port/create-port-public.png?fit=max\&auto=format\&n=KcLJOgb4Y9HJAr3C\&q=85\&s=f13a07360d59dd944e08c9c6c358ccd9)

![Create port dialog with a private network and subnet](https://mintcdn.com/gcore/KcLJOgb4Y9HJAr3C/images/docs/cloud/networking/ip-address/create-a-port/create-port-private.png?fit=max\&auto=format\&n=KcLJOgb4Y9HJAr3C\&q=85\&s=cb196d7ff3305998d0d63e8f03098468)

4\. Add a tag when the port needs a label. A port has no name. The field takes `role=web`.

![Tag field on the Create port dialog](https://mintcdn.com/gcore/KcLJOgb4Y9HJAr3C/images/docs/cloud/networking/ip-address/create-a-port/create-port-tags.png?fit=max\&auto=format\&n=KcLJOgb4Y9HJAr3C\&q=85\&s=38437dbb58aecc7bed4fb86af8686a3a)

5\. Open **Advanced** and keep the security group that is already selected. Port security starts on, so the port checks the source address and filters traffic with that group. Turn **Port security** off only when the port must forward traffic from addresses it does not hold. Anti-spoofing checks then stop, and security groups no longer filter traffic.

**Allowed address pairs** permit extra source addresses. They do not configure those addresses inside the instance. These settings apply to a virtual instance or to GPU Bare Metal with a DPU. A port that uses them cannot attach to regular Bare Metal or a load balancer.

![Advanced settings with port security, a security group, and allowed address pairs](https://mintcdn.com/gcore/KcLJOgb4Y9HJAr3C/images/docs/cloud/networking/ip-address/create-a-port/create-port-advanced.png?fit=max\&auto=format\&n=KcLJOgb4Y9HJAr3C\&q=85\&s=6f67d9bcf9b911ee4b3e19d0d6967cd7)

6\. Click **Create**.

## Edit a port

1\. Open the row menu and select **Edit port**.

2\. Change the tag, port security, the security group, or the allowed address pairs, and click **Save**.

On a private port, change **Allowed address pairs** in this dialog. Adding and removing a pair is in [allowed address pairs](https://docs.gcore.com/cloud/networking/ip-address/configure-an-allowed-address-pair.md).

## Delete a port

1\. Open the row menu and click **Delete**.

2\. Type `Delete` and click **Delete port**.

![Delete port dialog with the confirmation word typed](https://mintcdn.com/gcore/KcLJOgb4Y9HJAr3C/images/docs/cloud/networking/ip-address/create-a-port/delete-port.png?fit=max\&auto=format\&n=KcLJOgb4Y9HJAr3C\&q=85\&s=07c32d14924c2bab4aac827b9023a414)

## REST API

Create the port on a public or a private network, then change it or delete it.

> [!NOTE]
>
> An [API token](https://docs.gcore.com/account-settings/api-tokens.md) is required, along with a [project ID](https://docs.gcore.com/api-reference/cloud/projects/list-projects.md) and a [region ID](https://docs.gcore.com/api-reference/cloud/regions/list-regions.md).

Open a terminal and export the required variables:

```bash theme={null}
export GCORE_API_KEY="{YOUR_API_KEY}"
export GCORE_CLOUD_PROJECT_ID="{YOUR_PROJECT_ID}"
export GCORE_CLOUD_REGION_ID="{YOUR_REGION_ID}"
export PORT_ID="{PORT_ID}"
export NETWORK_ID="{NETWORK_ID}"
export SUBNET_ID="{SUBNET_ID}"
export SECURITY_GROUP_ID="{SECURITY_GROUP_ID}"
```

## List ports

The list includes every region until you set `region_ids`. Copy `results[].id` into `PORT_ID` before you change or delete that port.

> [tab] Python SDK
>
> ```python theme={null}
> import os
> from gcore import Gcore
>
> client = Gcore()
> region_id = int(os.environ["GCORE_CLOUD_REGION_ID"])
> for port in client.cloud.ports.list(region_ids=[region_id]):
>     print(port.id)
> ```

> [tab] Go SDK
>
> ```go theme={null}
> package main
>
> import (
>     "context"
>     "fmt"
>     "os"
>     "strconv"
>
>     gcore "github.com/G-Core/gcore-go"
>     "github.com/G-Core/gcore-go/cloud"
> )
>
> func main() {
>     client := gcore.NewClient()
>     ctx := context.Background()
>     regionID, err := strconv.ParseInt(os.Getenv("GCORE_CLOUD_REGION_ID"), 10, 64)
>     if err != nil {
>         panic(err)
>     }
>
>     page, err := client.Cloud.Ports.List(ctx, cloud.PortListParams{
>         RegionIDs: []int64{regionID},
>     })
>     if err != nil {
>         panic(err)
>     }
>     for _, port := range page.Results {
>         fmt.Println(port.ID)
>     }
> }
> ```

> [tab] curl
>
> ```bash theme={null}
> curl -G "https://api.gcore.com/cloud/v1/projects/$GCORE_CLOUD_PROJECT_ID/ports" \
>   -H "Authorization: APIKey $GCORE_API_KEY" \
>   --data-urlencode "region_ids=$GCORE_CLOUD_REGION_ID"
> ```
>
> The API returns:
>
> ```json theme={null}
> {
>   "count": 1,
>   "results": [
>     {
>       "id": "a1b2c3d4-5d22-4c23-8e09-f7a3e1c1a999",
>       "region_id": 1,
>       "network_id": "b1b2c3d4-5d22-4c23-8e09-f7a3e1c1a999",
>       "ip_assignments": [
>         {
>           "subnet_id": "c1b2c3d4-5d22-4c23-8e09-f7a3e1c1a999",
>           "ip_address": "203.0.113.10"
>         }
>       ],
>       "tags": {"role": "web"},
>       "port_security_enabled": true,
>       "managed_by": null,
>       "attached_to": null
>     }
>   ]
> }
> ```

## Create a public port

Send `region_id` to allocate one IPv4 address from the public network of that region. A port has no name, so `tags` is the label. Omit `port_security_enabled` and the port keeps the port security of the public network.

Do not send allowed address pairs. The public network rejects them, and a floating IP cannot use a port on that network.

| Parameter | Required | Description |
| - | - | - |
| `region_id` | Yes | Region of the port. The port attaches only to a resource in this region. |
| `tags` | No | Key-value labels. |

> [tab] Python SDK
>
> ```python theme={null}
> import os
> from gcore import Gcore
>
> client = Gcore()
> port = client.cloud.ports.create_and_poll(
>     region_id=int(os.environ["GCORE_CLOUD_REGION_ID"]),
>     tags={"role": "web"},
> )
> print(port.id)
> ```

> [tab] Go SDK
>
> ```go theme={null}
> package main
>
> import (
>     "context"
>     "fmt"
>     "os"
>     "strconv"
>
>     gcore "github.com/G-Core/gcore-go"
>     "github.com/G-Core/gcore-go/cloud"
> )
>
> func main() {
>     client := gcore.NewClient()
>     ctx := context.Background()
>     regionID, err := strconv.ParseInt(os.Getenv("GCORE_CLOUD_REGION_ID"), 10, 64)
>     if err != nil {
>         panic(err)
>     }
>
>     port, err := client.Cloud.Ports.NewAndPoll(ctx, cloud.PortNewParams{
>         RegionID: regionID,
>         Tags:     map[string]string{"role": "web"},
>     })
>     if err != nil {
>         panic(err)
>     }
>     fmt.Println(port.ID)
> }
> ```

> [tab] curl
>
> ```bash theme={null}
> curl -X POST "https://api.gcore.com/cloud/v1/projects/$GCORE_CLOUD_PROJECT_ID/ports" \
>   -H "Authorization: APIKey $GCORE_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{"region_id": '"$GCORE_CLOUD_REGION_ID"', "tags": {"role": "web"}}'
> ```
>
> The API returns:
>
> ```json theme={null}
> {"tasks": ["d4a4b10e-5d22-4c23-8e09-f7a3e1c1a999"]}
> ```
>
> Poll `GET /cloud/v1/tasks/` every 5 seconds until `state` is `FINISHED`. The port ID is the first item of `created_resources.ports`.
>
> When complete:
>
> ```json theme={null}
> {
>   "state": "FINISHED",
>   "created_resources": {
>     "ports": ["a1b2c3d4-5d22-4c23-8e09-f7a3e1c1a999"]
>   }
> }
> ```

## Create a private port

Set `NETWORK_ID` to the private network, `SUBNET_ID` to one of its subnets, and `SECURITY_GROUP_ID` to the security group. Send `network_id` in the request. Without it, the port is created on the public network of the region. The port receives one address on that subnet. Omit `ip_address` to allocate a free address, or set a free address in the subnet.

With port security on, the port checks the source address and applies the groups in `security_group_ids`.

Add `allowed_address_pairs` only after another port on this network already holds that address. Create the port that holds the address first. Ports that share one address are configured as a [virtual IP](https://docs.gcore.com/cloud/networking/ip-address/create-and-configure-a-virtual-ip-vip-address.md).

| Parameter | Required | Description |
| - | - | - |
| `region_id` | Yes | Region of the network. |
| `network_id` | Yes | Private network. |
| `ip_assignments` | Yes | One entry per address. `subnet_id` selects the subnet. `ip_address` sets the address. |
| `port_security_enabled` | No | `true` applies anti-spoofing and the security groups. |
| `security_group_ids` | No | Security groups to attach. |
| `tags` | No | Key-value labels. |

> [tab] Python SDK
>
> ```python theme={null}
> import os
> from gcore import Gcore
>
> client = Gcore()
> port = client.cloud.ports.create_and_poll(
>     region_id=int(os.environ["GCORE_CLOUD_REGION_ID"]),
>     network_id=os.environ["NETWORK_ID"],
>     ip_assignments=[{"subnet_id": os.environ["SUBNET_ID"]}],
>     port_security_enabled=True,
>     security_group_ids=[os.environ["SECURITY_GROUP_ID"]],
>     tags={"role": "web"},
> )
> print(port.id)
> ```

> [tab] Go SDK
>
> ```go theme={null}
> package main
>
> import (
>     "context"
>     "fmt"
>     "os"
>     "strconv"
>
>     gcore "github.com/G-Core/gcore-go"
>     "github.com/G-Core/gcore-go/cloud"
> )
>
> func main() {
>     client := gcore.NewClient()
>     ctx := context.Background()
>     regionID, err := strconv.ParseInt(os.Getenv("GCORE_CLOUD_REGION_ID"), 10, 64)
>     if err != nil {
>         panic(err)
>     }
>     networkID := os.Getenv("NETWORK_ID")
>     subnetID := os.Getenv("SUBNET_ID")
>     groupID := os.Getenv("SECURITY_GROUP_ID")
>     if networkID == "" || subnetID == "" || groupID == "" {
>         panic("set NETWORK_ID, SUBNET_ID, and SECURITY_GROUP_ID")
>     }
>
>     port, err := client.Cloud.Ports.NewAndPoll(ctx, cloud.PortNewParams{
>         RegionID:            regionID,
>         NetworkID:           gcore.String(networkID),
>         IPAssignments:       []cloud.IPAssignmentRequestParam{{SubnetID: subnetID}},
>         PortSecurityEnabled: gcore.Bool(true),
>         SecurityGroupIDs:    []string{groupID},
>         Tags:                map[string]string{"role": "web"},
>     })
>     if err != nil {
>         panic(err)
>     }
>     fmt.Println(port.ID)
> }
> ```

> [tab] curl
>
> ```bash theme={null}
> curl "https://api.gcore.com/cloud/v1/networks/$GCORE_CLOUD_PROJECT_ID/$GCORE_CLOUD_REGION_ID" \
>   -H "Authorization: APIKey $GCORE_API_KEY"
> ```
>
> ```bash theme={null}
> curl "https://api.gcore.com/cloud/v1/subnets/$GCORE_CLOUD_PROJECT_ID/$GCORE_CLOUD_REGION_ID" \
>   -H "Authorization: APIKey $GCORE_API_KEY"
> ```
>
> ```bash theme={null}
> curl "https://api.gcore.com/cloud/v1/securitygroups/$GCORE_CLOUD_PROJECT_ID/$GCORE_CLOUD_REGION_ID" \
>   -H "Authorization: APIKey $GCORE_API_KEY"
> ```
>
> Copy `NETWORK_ID`, `SUBNET_ID`, and `SECURITY_GROUP_ID` from the network, subnet, and security group this port should use.
>
> ```bash theme={null}
> curl -X POST "https://api.gcore.com/cloud/v1/projects/$GCORE_CLOUD_PROJECT_ID/ports" \
>   -H "Authorization: APIKey $GCORE_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{"region_id": '"$GCORE_CLOUD_REGION_ID"', "network_id": "'"$NETWORK_ID"'", "ip_assignments": [{"subnet_id": "'"$SUBNET_ID"'", "ip_address": "192.168.123.10"}], "port_security_enabled": true, "security_group_ids": ["'"$SECURITY_GROUP_ID"'"], "tags": {"role": "web"}}'
> ```
>
> The API returns a task. Read the port ID from `created_resources.ports` when `state` is `FINISHED`.

## Change a port

Set `PORT_ID` from the list or from the create task. Each block below is a separate request. `ip_assignments`, `security_group_ids`, and `allowed_address_pairs` replace the whole list, so the body contains every entry the port should keep. `tags` changes only the keys in the body. A change returns a task. When the port already has that value, `tasks` is empty. Poll `GET /cloud/v1/tasks/` every 5 seconds until `state` is `FINISHED`.

**Add an address.** Read the port and copy every assignment together with its `ip_address`. Append one entry for the new address. An entry without `ip_address` allocates a free address from `SUBNET_ID`. An address left out of the list is released. A port attached to an instance keeps its addresses in one subnet for each IP version, so a second subnet of that version is rejected.

> [tab] Python SDK
>
> ```python theme={null}
> import os
> from gcore import Gcore
>
> client = Gcore()
> port_id = os.environ["PORT_ID"]
> current = client.cloud.ports.get(port_id)
> assignments = [
>     {"subnet_id": item.subnet_id, "ip_address": item.ip_address}
>     for item in current.ip_assignments
> ]
> assignments.append({"subnet_id": os.environ["SUBNET_ID"]})
> updated = client.cloud.ports.update_and_poll(port_id, ip_assignments=assignments)
> for item in updated.ip_assignments:
>     print(item.ip_address)
> ```

> [tab] Go SDK
>
> ```go theme={null}
> package main
>
> import (
>     "context"
>     "fmt"
>     "os"
>
>     gcore "github.com/G-Core/gcore-go"
>     "github.com/G-Core/gcore-go/cloud"
> )
>
> func main() {
>     client := gcore.NewClient()
>     ctx := context.Background()
>     portID := os.Getenv("PORT_ID")
>     subnetID := os.Getenv("SUBNET_ID")
>     if subnetID == "" {
>         panic("set SUBNET_ID")
>     }
>
>     current, err := client.Cloud.Ports.Get(ctx, portID, cloud.PortGetParams{})
>     if err != nil {
>         panic(err)
>     }
>     assignments := make([]cloud.IPAssignmentRequestParam, 0, len(current.IPAssignments)+1)
>     for _, item := range current.IPAssignments {
>         assignments = append(assignments, cloud.IPAssignmentRequestParam{
>             SubnetID:  item.SubnetID,
>             IPAddress: gcore.String(item.IPAddress),
>         })
>     }
>     assignments = append(assignments, cloud.IPAssignmentRequestParam{SubnetID: subnetID})
>
>     updated, err := client.Cloud.Ports.UpdateAndPoll(ctx, portID, cloud.PortUpdateParams{
>         IPAssignments: assignments,
>     })
>     if err != nil {
>         panic(err)
>     }
>     for _, item := range updated.IPAssignments {
>         fmt.Println(item.IPAddress)
>     }
> }
> ```

> [tab] curl
>
> ```bash theme={null}
> curl "https://api.gcore.com/cloud/v1/projects/$GCORE_CLOUD_PROJECT_ID/ports/$PORT_ID" \
>   -H "Authorization: APIKey $GCORE_API_KEY"
> ```
>
> Copy every `ip_assignments` object from that response and keep its `ip_address`. Add one object that has only `subnet_id`.
>
> ```bash theme={null}
> curl -X PATCH "https://api.gcore.com/cloud/v1/projects/$GCORE_CLOUD_PROJECT_ID/ports/$PORT_ID" \
>   -H "Authorization: APIKey $GCORE_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{"ip_assignments": [{"subnet_id": "c1b2c3d4-5d22-4c23-8e09-f7a3e1c1a999", "ip_address": "192.168.123.10"}, {"subnet_id": "'"$SUBNET_ID"'"}]}'
> ```
>
> ```json theme={null}
> {"tasks": ["e5b5c21f-5d22-4c23-8e09-f7a3e1c1a999"]}
> ```

**Change a tag.** The request changes the `role` tag. Addresses and port security stay as they are.

> [tab] Python SDK
>
> ```python theme={null}
> import os
> from gcore import Gcore
>
> client = Gcore()
> client.cloud.ports.update_and_poll(os.environ["PORT_ID"], tags={"role": "web"})
> ```

> [tab] Go SDK
>
> ```go theme={null}
> package main
>
> import (
>     "context"
>     "os"
>
>     gcore "github.com/G-Core/gcore-go"
>     "github.com/G-Core/gcore-go/cloud"
> )
>
> func main() {
>     client := gcore.NewClient()
>     ctx := context.Background()
>     role := "web"
>     _, err := client.Cloud.Ports.UpdateAndPoll(ctx, os.Getenv("PORT_ID"), cloud.PortUpdateParams{
>         Tags: cloud.TagUpdateMap{"role": &role},
>     })
>     if err != nil {
>         panic(err)
>     }
> }
> ```

> [tab] curl
>
> ```bash theme={null}
> curl -X PATCH "https://api.gcore.com/cloud/v1/projects/$GCORE_CLOUD_PROJECT_ID/ports/$PORT_ID" \
>   -H "Authorization: APIKey $GCORE_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{"tags": {"role": "web"}}'
> ```

**Turn port security off.** Do this when the port must forward traffic from addresses it does not hold. Anti-spoofing checks stop, and security groups no longer filter traffic. The same request clears the security groups. A request that turns port security off while groups are still attached is rejected.

> [tab] Python SDK
>
> ```python theme={null}
> import os
> from gcore import Gcore
>
> client = Gcore()
> client.cloud.ports.update_and_poll(
>     os.environ["PORT_ID"],
>     port_security_enabled=False,
>     security_group_ids=[],
> )
> ```

> [tab] Go SDK
>
> ```go theme={null}
> package main
>
> import (
>     "context"
>     "os"
>
>     gcore "github.com/G-Core/gcore-go"
>     "github.com/G-Core/gcore-go/cloud"
> )
>
> func main() {
>     client := gcore.NewClient()
>     ctx := context.Background()
>     _, err := client.Cloud.Ports.UpdateAndPoll(ctx, os.Getenv("PORT_ID"), cloud.PortUpdateParams{
>         PortSecurityEnabled: gcore.Bool(false),
>         SecurityGroupIDs:    []string{},
>     })
>     if err != nil {
>         panic(err)
>     }
> }
> ```

> [tab] curl
>
> ```bash theme={null}
> curl -X PATCH "https://api.gcore.com/cloud/v1/projects/$GCORE_CLOUD_PROJECT_ID/ports/$PORT_ID" \
>   -H "Authorization: APIKey $GCORE_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{"port_security_enabled": false, "security_group_ids": []}'
> ```

**Permit an extra source address.** On a private port, the list permits traffic from an address the port does not hold. It does not configure that address inside the instance. The list replaces the pairs already on the port, so send every pair the port should keep. An empty list clears them. Each address must already belong to a port on the same network. The value is an address or a subnet. On a network shared with another client, the value is one address. A port on the public network rejects the field.

> [tab] Python SDK
>
> ```python theme={null}
> import os
> from gcore import Gcore
>
> client = Gcore()
> port_id = os.environ["PORT_ID"]
> current = client.cloud.ports.get(port_id)
> pairs = [{"ip_address": item.ip_address} for item in current.allowed_address_pairs]
> pairs.append({"ip_address": "192.168.123.20"})
> client.cloud.ports.update_and_poll(port_id, allowed_address_pairs=pairs)
> ```

> [tab] Go SDK
>
> ```go theme={null}
> package main
>
> import (
>     "context"
>     "os"
>
>     gcore "github.com/G-Core/gcore-go"
>     "github.com/G-Core/gcore-go/cloud"
> )
>
> func main() {
>     client := gcore.NewClient()
>     ctx := context.Background()
>     portID := os.Getenv("PORT_ID")
>     current, err := client.Cloud.Ports.Get(ctx, portID, cloud.PortGetParams{})
>     if err != nil {
>         panic(err)
>     }
>     pairs := make([]cloud.PortUpdateParamsAllowedAddressPair, 0, len(current.AllowedAddressPairs)+1)
>     for _, item := range current.AllowedAddressPairs {
>         pairs = append(pairs, cloud.PortUpdateParamsAllowedAddressPair{IPAddress: item.IPAddress})
>     }
>     pairs = append(pairs, cloud.PortUpdateParamsAllowedAddressPair{IPAddress: "192.168.123.20"})
>     _, err = client.Cloud.Ports.UpdateAndPoll(ctx, portID, cloud.PortUpdateParams{
>         AllowedAddressPairs: pairs,
>     })
>     if err != nil {
>         panic(err)
>     }
> }
> ```

> [tab] curl
>
> ```bash theme={null}
> curl "https://api.gcore.com/cloud/v1/projects/$GCORE_CLOUD_PROJECT_ID/ports/$PORT_ID" \
>   -H "Authorization: APIKey $GCORE_API_KEY"
> ```
>
> Copy every current pair into the request, then add the new address.
>
> ```bash theme={null}
> curl -X PATCH "https://api.gcore.com/cloud/v1/projects/$GCORE_CLOUD_PROJECT_ID/ports/$PORT_ID" \
>   -H "Authorization: APIKey $GCORE_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{"allowed_address_pairs": [{"ip_address": "192.168.123.10"}, {"ip_address": "192.168.123.20"}]}'
> ```

## Delete a port

Delete a port that is not attached to a resource. When the task finishes, a request for that port returns 404.

> [tab] Python SDK
>
> ```python theme={null}
> import os
> from gcore import Gcore
>
> client = Gcore()
> client.cloud.ports.delete_and_poll(os.environ["PORT_ID"])
> ```

> [tab] Go SDK
>
> ```go theme={null}
> package main
>
> import (
>     "context"
>     "os"
>
>     gcore "github.com/G-Core/gcore-go"
>     "github.com/G-Core/gcore-go/cloud"
> )
>
> func main() {
>     client := gcore.NewClient()
>     ctx := context.Background()
>     err := client.Cloud.Ports.DeleteAndPoll(ctx, os.Getenv("PORT_ID"), cloud.PortDeleteParams{})
>     if err != nil {
>         panic(err)
>     }
> }
> ```

> [tab] curl
>
> ```bash theme={null}
> curl -X DELETE "https://api.gcore.com/cloud/v1/projects/$GCORE_CLOUD_PROJECT_ID/ports/$PORT_ID" \
>   -H "Authorization: APIKey $GCORE_API_KEY"
> ```
>
> The API returns:
>
> ```json theme={null}
> {"tasks": ["c7d8e9f0-5d22-4c23-8e09-f7a3e1c1a999"]}
> ```
>
> Poll `GET /cloud/v1/tasks/` every 5 seconds until `state` is `FINISHED`.
