Members

envless.members.leave()

Leave the workspace as the key owner

ts
leave(options?: RequestScope): Promise<LeftWorkspaceResource>

Removes 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

ts
const result = await envless.members.leave()

console.log(result.id, result.left)

Parameters

ParameterTypeRequiredDescription
options.signalAbortSignalNoCancels the request.

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.removed with left: true, the marker for a voluntary departure.
  • A key whose owner is somehow not a member gets 404 member.not_found rather 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 Python

envless.members.leave()

The same method in envless-sdk, the Python SDK, with the same request, retries and errors.

In Ruby

Envless.members.leave

The same method in envless-sdk, the Ruby gem, with the same request, retries and errors.

In PHP

$envless->members->leave()

The same method in envless/sdk, the PHP SDK, with the same request, retries and errors.