Members

envless.members.remove()

Remove another member from the workspace

def remove(
    id: str,
    *,
    timeout: float | None = None,
) -> DeletedMemberResource

Soft deletes a membership. The user account is untouched and the same person can be invited again later, which is why this frees a seat rather than destroying anything.

It refuses to remove the caller with 409 member.self_mutation, so use leave for that, and it refuses the workspace owner with 409 member.owner_immutable. Ownership has to be transferred in the dashboard first.

The returned value is a tombstone carrying id alone. It gives you back no email, no role and no user, so read the member before removing if you need those for an audit trail.

Example

from envless import envless

members = envless.members.list_all()

users = {member['id']: member['user'] for member in members}
target = next(
    (
        member_id
        for member_id, user in users.items()
        if user and user['email'] == 'contractor@example.com'
    ),
    None,
)

if target:
    removed = envless.members.remove(target)

    print(removed['id'])

Parameters

ParameterTypeRequiredDescription
idstrYesWorkspace member id from the list methods, not the user id.
timeoutfloatNoSeconds 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

DeletedMemberResource carrying only the removed member id.

Worth knowing

  • Every API key belongs to a member, so the removed person keys stop authenticating with 401 as soon as this succeeds.
  • Emits member.removed without left, which is how a webhook consumer tells an admin removal from a voluntary departure.

Required scopes

members:write

Underlying endpoint

DELETE /members/{id}

Request and response schema, every error code, and a live playground.

In TypeScript

envless.members.remove()

The same method in @goenvless/sdk, with the same request, retries and errors.