---
title: "Atomically update forwarded HTTP ports on an instance"
method: PATCH
path: "/instances/{id}/ports"
tags: ["Instances"]
---

# Atomically update forwarded HTTP ports on an instance

`PATCH /instances/{id}/ports`

Atomically add and remove forwarded HTTP ports on a running instance in a single transaction. Body: `{"add_ports": [8080], "remove_ports": [3000]}`. Adds are deduplicated and removing ports that are not currently forwarded is a no-op. Each forwarded port is reachable at https://<uuid>-<port>.thundercompute.net.

## Path parameters

- `id` string, required

## Request body

- union
  - object
  - ThundertypesPortUpdateRequest
    - `add_ports` integer[]
    - `remove_ports` integer[]

## Response `200`

OK

- ThundertypesPortAddResponse
  - `http_ports` integer[]
  - `identifier` string, required
  - `instance_name` string, required

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `404` — Not Found
- `500` — Internal Server Error

---

[API](https://skmtc.net/thundercompute/apis/thunder-compute-api.md) · [All operations](https://skmtc.net/thundercompute/apis/thunder-compute-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/thundercompute/thunder-compute-api/versions/a8120edca3aa/schema)
