def delete(
*,
timeout: float | None = None,
) -> DeletedWorkspaceResourceasync def delete(
*,
timeout: float | None = None,
) -> DeletedWorkspaceResourceDeletes the workspace the key is bound to, irreversibly. The call destroys the key that made it along with every other key, member, role, webhook and product in the workspace, so treat the returned value as the last thing this client will ever return.
Four guards run before anything is removed, and each is a hard refusal rather than a warning: the key owner must hold the owner role, the owner must already own at least one other workspace, the workspace must be at least seven days old, and every project must already be deleted.
A live subscription does not block the call. It is canceled as part of the delete, immediately and with no refund for the rest of the period.
Because the project guard refuses outright, deleting a workspace with content means deleting its projects first, which cascades to environments, variables and version history.
Example
from envless import envless
removed = envless.workspace.delete()
print(removed['slug'])import asyncio
from envless import AsyncEnvless
async def main() -> None:
async with AsyncEnvless() as envless:
removed = await envless.workspace.delete()
print(removed['slug'])
asyncio.run(main())Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
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
DeletedWorkspaceResource with the id, name and slug of the removed workspace.
Worth knowing
- The
workspace:writescope is not sufficient. A key whose owner is not the workspace owner fails withauth.permission_denied. - A workspace that still holds a project fails with
workspace.delete_has_projects. - A live subscription is canceled by this call and cannot be restored. The delete still succeeds if the billing provider refuses the cancellation, so check the customer portal if the workspace carried a plan.
- The
workspace.deletedwebhook fires before the row is removed, so the event is still delivered.
Required scopes
workspace:write
Underlying endpoint
DELETE /workspace
Request and response schema, every error code, and a live playground.
In TypeScript
envless.workspace.delete()
The same method in @goenvless/sdk, with the same request, retries and errors.