def leave(timeout: nil)def leave: (?timeout: seconds?) -> left_workspace_resourceRemoves 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
require "envless/sdk"
result = Envless.members.leave
puts "#{result[:id]} #{result[:left]}"Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
timeout: | Integer | Float | Rational | No | Seconds each attempt of this call may take, redirects and the response body included, before it raises Envless::NetworkError with timeout? set. Overrides the client's timeout for this call, and 0 turns the limit off. |
Returns
left_workspace_resource 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.removedwithleft: 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.