def leave(
*,
timeout: float | None = None,
) -> LeftWorkspaceResourceasync def leave(
*,
timeout: float | None = None,
) -> LeftWorkspaceResourceRemoves the API key owner from the current workspace. This is the self service counterpart to remove, which refuses self removal.
It revokes the calling key along with the membership, because every key in the workspace belongs to a member. The request that succeeds is the last one this key can make, so never place it in the middle of a script that still has work to do.
The workspace owner cannot leave, since a workspace with no owner is unrecoverable: that call fails with 409 member.owner_cannot_leave. Transfer ownership first, or delete the workspace outright with envless.workspace.delete.
Example
from envless import envless
result = envless.members.leave()
print(result['id'], result['left'])import asyncio
from envless import AsyncEnvless
async def main() -> None:
async with AsyncEnvless() as envless:
result = await envless.members.leave()
print(result['id'], result['left'])
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
LeftWorkspaceResource with the former membership id and left set to True.
Worth knowing
- Every later call on the same client fails with 401. Build a fresh client from a different key if the process must continue.
- Emits
member.removedwith'left': True, the marker for a voluntary departure. - A key whose owner is somehow not a member gets 404
member.not_foundrather than a silent success.
Required scopes
members:write
Underlying endpoint
DELETE /members/me
Request and response schema, every error code, and a live playground.
In TypeScript
envless.members.leave()
The same method in @goenvless/sdk, with the same request, retries and errors.