remove(id: string, options?: RequestScope): Promise<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 resolved 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
const page = await envless.members.list({ limit: 100 })
const target = page.items.find((member) => member.user?.email === 'contractor@example.com')
if (target) {
const removed = await envless.members.remove(target.id)
console.log(removed.id)
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Workspace member id from the list methods, not the user id. |
options.signal | AbortSignal | No | Cancels the request. |
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.removedwithoutleft, 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 Python
envless.members.remove()
The same method in envless-sdk, the Python SDK, with the same request, retries and errors.
In Ruby
Envless.members.remove
The same method in envless-sdk, the Ruby gem, with the same request, retries and errors.
In PHP
$envless->members->remove()
The same method in envless/sdk, the PHP SDK, with the same request, retries and errors.