# PUT /security/firewall/ports

First published 14 Oct 2026 (release 0.2.0) · Unchanged since publication

UrbeStack release 0.2.35 API operation in the security group.

Replace the firewall's list of extra open ports

- Who may call it: administrator
- Token scope, any of: security, all
- Answers: 200 OK

UrbeStack adds new extra port openings and removes those omitted from the list in a single firewall update. An empty string or array removes all extra port openings.

The API also accepts an array of entries in ports. The 2000-character limit applies after the entries are joined with a comma and a space. The API returns 400 if ports is missing, has an unsupported type, contains unsupported characters, or exceeds the limit.

## As a command

- [urbestack-firewall-ports-set](https://urbestack.com/docs/commands/urbestack-firewall-ports-set.md): Replaces the firewall's list of extra open ports.

## Request body

JSON.

- `ports` (string, up to 2000 characters, required): Comma-separated list of ports or inclusive ranges from 1 to 65535, with the lower port first in each range. TCP is the default, and you can append /udp for UDP or /tcp for TCP, as in 8080, 9000/udp, 30000-31000.

## Example

Set $API to the base URL and $TOKEN to the token, as the [API overview](https://urbestack.com/docs/api.md) shows.

```
curl -sS -X PUT "$API/security/firewall/ports" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "ports": "text"
  }'
```

Response, 200 OK:

```
{
  "closed": [
    "text"
  ],
  "opened": [
    "text"
  ],
  "ports": [
    "text"
  ]
}
```

## Errors

- 400: A port is a number, or a range like 30000-31000, optionally followed by /udp
- 400: The list is up to 2000 characters
- 400: ports is the list of extra open ports, comma separated, empty for none
- 401: Authentication required
