unexpose(project: string, environment: string, options?: ProductScope): Promise<EnvironmentResource>Takes an environment off its public URL by posting { exposed: false } to the same endpoint expose uses. This needs neither virtualEnvsEnabled nor a public product, so it is the safe kill switch: call it without checking any state first.
The public URL starts returning a uniform 404 the moment this lands, with no hint that the environment exists. Calling it on an environment that was never exposed is a no-op that still resolves the full resource, so it is safe to run across a whole project during an incident.
Example
const environment = await envless.environments.unexpose('api', 'production')
console.log(environment.exposed)Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
project | string | Yes | Project slug or uniqueId that owns the environment. |
environment | string | Yes | Slug of the environment to unexpose; ids are not accepted. |
options.product | string | No | Product slug that disambiguates an ambiguous project slug. |
options.signal | AbortSignal | No | Cancels the request. |
Returns
EnvironmentResource with exposed false, plus updatedAt.
Worth knowing
- Turning off the workspace
virtualEnvsEnabledflag is the blunt instrument; this route is the per-environment one. - A link that was already handed out keeps the ciphertext its holder copied, so rotate the passphrase if the feed leaked.
Required scopes
environments:write
Underlying endpoint
POST /projects/{slug}/environments/{environmentSlug}/expose
Request and response schema, every error code, and a live playground.
In Python
envless.environments.unexpose()
The same method in envless-sdk, the Python SDK, with the same request, retries and errors.
In Ruby
Envless.environments.unexpose
The same method in envless-sdk, the Ruby gem, with the same request, retries and errors.
In PHP
$envless->environments->unexpose()
The same method in envless/sdk, the PHP SDK, with the same request, retries and errors.