---
title: "Open a TCP tunnel to a machine port."
method: GET
path: "/v1/machines/{id}/tunnel/{port}"
tags: ["machines"]
---

# Open a TCP tunnel to a machine port.

`GET /v1/machines/{id}/tunnel/{port}`

## Request

- Base URL: `https://api.smolmachines.com`
- URL: `https://api.smolmachines.com/v1/machines/{id}/tunnel/{port}`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/smolmachines/apis/smolfleet-api/docs/v1/machines/:id/tunnel/:port/get.ts> (a function with typed inputs; its response is checked against the schema)

Upgrades to a WebSocket carrying raw TCP to a port inside the machine. Requires the `machine:exec` scope.

## Path parameters

- `id` string, required
- `port` integer, required

## Other responses

- `101`: Binary WebSocket frames carry raw TCP bytes; requires machine:exec scope
- `401`: Missing or invalid API key
- `403`: Missing machine:exec scope
- `404`: Machine or published port not found
- `429`: Rate limited; retry after the Retry-After header
- `500`: Internal error
- `503`: Machine is not running

## Changes

- **2026-10-16** `bc31fc04a568`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/smolmachines/apis/smolfleet-api/changes/v1/machines/:id/tunnel/:port/get.md)

---

[API](https://skmtc.dev/smolmachines/apis/smolfleet-api.md) - [All operations](https://skmtc.dev/smolmachines/apis/smolfleet-api/llms.txt) - [OpenAPI document](https://skmtc.dev/smolmachines/apis/smolfleet-api/revisions/bc31fc04a568?raw)
