def unexpose(
project: str,
environment: str,
*,
product: str | None = None,
timeout: float | None = None,
) -> EnvironmentResourceasync def unexpose(
project: str,
environment: str,
*,
product: str | None = None,
timeout: float | None = None,
) -> EnvironmentResourceTakes 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 returns the full resource, so it is safe to run across a whole project during an incident.
Example
from envless import envless
environment = envless.environments.unexpose(
'api', 'production'
)
print(environment['exposed'])import asyncio
from envless import AsyncEnvless
async def main() -> None:
async with AsyncEnvless() as envless:
environment = await envless.environments.unexpose(
'api', 'production'
)
print(environment['exposed'])
asyncio.run(main())Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
project | str | Yes | Project slug or uniqueId that owns the environment. |
environment | str | Yes | Slug of the environment to unexpose; ids are not accepted. |
product | str | No | Product slug that disambiguates an ambiguous project slug. |
timeout | float | No | Seconds each attempt of this call may take, the response body included, before it raises EnvlessNetworkError with is_timeout set. Overrides the client's timeout for this call, and 0 turns the limit off. |
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 TypeScript
envless.environments.unexpose()
The same method in @goenvless/sdk, with the same request, retries and errors.