# Publish a port

URL: https://heaven.dev/docs/reference/computers/port-add
Updated: 2026-11-21

Publish a Computer's TCP service on an assigned public port. Public ports are included in the plan's allowance and use Heaven's shared public address, or a static IPv4 address attached to the pool or account. Publishing requires permission under the organization's external sharing policy and room in the port allowance. The response gives a public address and port that anyone on the internet can reach. The service controls its own authentication.

`POST /v1/computer/modify`

## Parameters

- `computer` (string, required): Computer name or ID.
- `guest_port` (string, required): TCP port the service listens on inside the Computer, from 1 to 65535 except the reserved desktop port 6080. A pool can take up to 10 new public port numbers per rolling 24-hour window.

## Returns

- `data` (object, always present): A public port forwarding traffic to a Computer.
  - `address` (string, always present): Public connection address.
  - `computer_id` (string, always present): Computer ID.
  - `guest_port` (integer, always present): Destination port inside the Computer.
  - `name` (string, always present): Computer name.
  - `organization` (string): Computer's organization, when applicable. May be omitted.
  - `port` (integer, always present): Public port to connect to.
  - `published_at` (string (date-time), always present): When the port was published.

## Errors

Each code is explained in full at https://heaven.dev/docs/reference/errors.

| Code | Status | What happened |
|---|---:|---|
| `invalid` | 400 | An input is missing or invalid. |
| `unauthenticated` | 401 | The credential is missing, invalid, expired or revoked. |
| `denied` | 403 | The caller lacks permission for this action. |
| `not_found` | 404 | The resource is absent or inaccessible to this caller. |
| `conflict` | 409 | The request conflicts with the current resource state or an earlier request. |
| `over_capacity` | 409 | The request exceeds a resource or credential allowance. |
| `access_list_full` | 409 | The change would exceed the access-list allowance. |
| `payment_required` | 402 | Payment or credit is required. |
| `rate_limited` | 429 | The caller's request rate exceeds its limit. |
| `busy` | 429 | Too much work is in progress to accept this request. |
| `unknown` | 503 | The outcome is unconfirmed; a change may have happened. |
| `unavailable` | 503 | The service or requested feature is unavailable. |

## Notes

- CLI: `heaven login` with `HEAVEN_API_KEY` unset. MCP: Heaven sign-in. cURL: `HEAVEN_SIGN_IN_KEY` from approved device sign-in (`POST /v1/auth/create`).
- A key limited to a command list cannot run this command.

## Examples

```sh tab="heaven CLI"
heaven port add COMPUTER GUEST-PORT
```

```sh tab="SSH"
ssh cli@heaven.dev port add COMPUTER GUEST-PORT
```

```sh tab="cURL"
curl https://heaven.dev/v1/computer/modify \
  -H "Authorization: Bearer $HEAVEN_SIGN_IN_KEY" \
  --json '{"action": "port add", "computer": "my-site", "guest_port": "8080"}'
```

```json tab="MCP"
{ "tool": "port_add",
  "arguments": { "computer": "my-site", "guest_port": "8080" } }
```

Response:

```json title="Response excerpt"
{
  "version": 1,
  "data": {
    "address": "my-site.heaven.dev:26497",
    "computer_id": "3f1c9e2a-7b4d-4c8e-9a6f-2d5b8e1c7a90",
    "guest_port": 8080,
    "name": "my-site",
    "port": 26497,
    "published_at": "2026-11-16T12:00:00Z"
  }
}
```
