def expose(
project: str,
environment: str,
*,
product: str | None = None,
timeout: float | None = None,
) -> EnvironmentResourceasync def expose(
project: str,
environment: str,
*,
product: str | None = None,
timeout: float | None = None,
) -> EnvironmentResourceTurns on public exposure by posting {'exposed': True} for you. A branded public URL then serves the variables of that environment as ciphertext, so anyone with the link still needs the workspace passphrase or key to read a value. Nothing is decrypted server-side.
Two independent flags have to line up or the call is refused. The workspace needs virtualEnvsEnabled, which you set with workspace.update, and the product that owns the project must not be private. A private product fails with environment.expose_private_product and can never be exposed, so move the project or unset privacy first.
Example
from envless import envless
envless.workspace.update({'virtualEnvsEnabled': True})
environment = envless.environments.expose('api', 'production')
print(environment['exposed'])import asyncio
from envless import AsyncEnvless
async def main() -> None:
async with AsyncEnvless() as envless:
await envless.workspace.update({'virtualEnvsEnabled': True})
environment = await envless.environments.expose('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 expose; 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 True, plus updatedAt.
Worth knowing
- The two-flag opt-in is deliberate, so a single accidental toggle cannot publish a feed.
- Anything you would not hand out as ciphertext does not belong in an exposed environment.
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.expose()
The same method in @goenvless/sdk, with the same request, retries and errors.