Logo
OpenScaler
API DocumentationComputer Public Ports

Close port for VM

DELETE
/v1/vms/{vm_id}/public_ports

Closes an exposed port for VM. Note that this operation must be double confirmed especially for port 22, which if deleted will cause user to lose SSH connection to their VM (user needs to be aware of that).

Example: if a user want to stop exposing 80 port in their VM, they can do so by sending a DELETE request to /v2/vms/{vm_id}/public_ports with the following payload:

{  "port": 80}

Authorization

bearer_auth
AuthorizationBearer <token>

Authentication

Create an API token on Profile, or with osctl auth login. Send it in the Authorization header:

Authorization: Bearer os1_...

Do not use the Keycloak web-session JWT as an API token. Keep the secret secure and do not share it.

In: header

Path Parameters

vm_id*string

A unique identifier for a VM instance.

Formatuuid

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

body?unknown

Response Body

application/json

text/pain

application/json

application/json

curl -X DELETE "https://example.com/v1/vms/cc3ccab2-0ae2-11ef-9136-6a0922f6458b/public_ports" \  -H "Content-Type: application/json" \  -d '{}'
Empty
{  "errors": [    {      "message": "'vcpus' field must be an integer",      "field": "resource_id"    }  ]}
"Access denied"
{  "errors": [    {      "message": "User not initialized. Send POST /v1/init, then retry the request."    }  ]}
{  "errors": [    {      "message": "VM with ID 23 not found"    }  ]}