---
title: "Set App Port Forwarding"
method: POST
path: "/apps/{app_id}/forwarding"
---

# Set App Port Forwarding

`POST /apps/{app_id}/forwarding`

## Request

- Base URL: `https://api.xhostd.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.xhostd.com/apps/{app_id}/forwarding`
- Auth: none declared

Toggle the app-wide public raw-TCP endpoint opt-in.

Default-closed and per project. While it is off, no channel of the app
can be given a public endpoint and any endpoint already allocated stops
resolving — turning it off is the immediate kill switch. Cross-user
callers get 404.

Requires :attr:`Role.ADMIN`, unlike the external Postgres and
object-store toggles: it sits ABOVE the per-channel expose/unexpose
routes it gates, so a member cannot re-open every endpoint an admin
deliberately closed.

## Path parameters

- `app_id` string, uuid, required

## Headers

- `authorization` string, nullable

## Request body

- PortForwardingRequest
  - `enabled` boolean, required

## Response `200`

Successful Response

- AppResponse
  - `id` string, uuid, required
  - `name` string, required
  - `repo_url` string, required
  - `template` string, required
  - `created_at` string, date-time, required
  - `external_db_access_enabled` boolean, required
  - `external_blob_access_enabled` boolean, required
  - `port_forwarding_enabled` boolean, required
  - `port_forwarding_available` boolean, required
  - `agent_protected_actions_enabled` boolean, nullable, required
  - `agent_protected_actions_effective` boolean, required
  - `channels` ChannelResponse[], required
    - `id` string, uuid, required
    - `name` string, required
    - `hostname` string, required
    - `git_ref_binding` string, nullable, required
    - `follows_branch` boolean, required
    - `current_sha` string, nullable, required
    - `status` string, required
    - `pending_deploy` PendingDeployResponse, required: The channel's in-flight deploy, if one is queued or running.
      - `deploy_id` string, uuid, required
      - `sha` string, required
      - `status` string, required
  - `owner_username` string, required
  - `role` string, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/xhostd/apis/xhostd-public.md) · [All operations](https://skmtc.dev/xhostd/apis/xhostd-public/llms.txt) · [OpenAPI document](https://skmtc.dev/xhostd/apis/xhostd-public/revisions/bf439c4d1789?raw)
