---
title: "Turn a tunnel's environment hosts on or off."
method: PUT
path: "/ingress/connectors/{id}/environment-hosts"
tags: ["Reachability"]
---

# Turn a tunnel's environment hosts on or off.

`PUT /ingress/connectors/{id}/environment-hosts`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/ingress/connectors/{id}/environment-hosts`
- Auth: HTTP bearer

On publishes every listed environment as `<label>.<domain>`; off
withdraws every host it generated. Both need `confirm`: the
`confirm_token` of the list from the `GET` that was shown. Turning it on
is a sensitive action (it widens every environment to public). At most
one tunnel has it on.

## Path parameters

- `id` integer, required

## Request body

- SetEnvironmentHostsRequest: `PUT /ingress/connectors/{id}/environment-hosts`.
  - `confirm` string, nullable: The `confirm_token` of the list that was shown and accepted: turning on publishes every host in it, turning off withdraws them.
  - `enabled` boolean, required

## Response `200`

- EnvironmentHostsResponse: `GET`/`PUT /ingress/connectors/{id}/environment-hosts`.
  - `confirm_token` string, required: Send back as `confirm` to turn it on or off. It names exactly the hosts listed here, so a list that changed since it was shown is not accepted.
  - `connector_id` integer, required
  - `connector_name` string, required
  - `domain` string, required
  - `enabled` boolean, required
  - `enabled_elsewhere` string, nullable: The tunnel that has environment hosts on instead, if another does: at most one may.
  - `host_suffix` string, nullable: The tunnel's hostname suffix: environments are published as `<label>-<suffix>.<domain>` with one, `<label>.<domain>` without.
  - `hosts` EnvironmentHostView[], required: The hosts it publishes, or would publish once turned on.
    - `environment_id` integer, required
    - `environment_name` string, required
    - `hostname` string, required: The host, or the one it would get.
    - `last_error` string, nullable
    - `note` string, nullable: Why the host is not `<label>.<domain>`, when it is the short-hash name.
    - `project_slug` string, required
    - `state` string, required: `published`, `pending`, `error`, or `planned` before the opt-in.
  - `preview_domain_usable` boolean, required: The preview domain is usable: existing hosts stay, no new ones are generated.
  - `refused` EnvironmentHostRefusal[], required
    - `environment_id` integer, required
    - `environment_name` string, required
    - `project_slug` string, required
    - `reason` string, required
  - `warning` string, required

## Other responses

- `400`: Not confirmed
- `401`: Unauthorized
- `403`: Insufficient permissions
- `404`: No such tunnel
- `409`: Another tunnel publishes environment hosts, or the list changed since it was shown
- `428`: Turning it on needs a recent MFA verification
- `500`: Internal server error

## Changes

- **2026-11-06** `1d647563dab0`: 1 info
  - added the optional property `host_suffix` to the response with the `200` status
- **2026-10-26** `b628d915a962`: 1 breaking, 3 info
  - the `confirm` request property type changed from `boolean` to `string, null`
  - the request property `confirm` became nullable
  - added the non-success response with the status `428`
  - added the required property `confirm_token` to the response with the `200` status
- **2026-10-26** `a62e8f318100`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/ingress/connectors/:id/environment-hosts/put.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
