Workspace

Envless.workspace.delete

Permanently delete the bound workspace

def delete(timeout: nil)

Deletes the workspace the key is bound to, irreversibly. The call destroys the key that made it along with every other key, member, role, webhook and product in the workspace, so treat the returned value as the last thing this client will ever return.

Four guards run before anything is removed, and each is a hard refusal rather than a warning: the key owner must hold the owner role, the owner must already own at least one other workspace, the workspace must be at least seven days old, and every project must already be deleted.

A live subscription does not block the call. It is canceled as part of the delete, immediately and with no refund for the rest of the period.

Because the project guard refuses outright, deleting a workspace with content means deleting its projects first, which cascades to environments, variables and version history.

Example

ruby
require "envless/sdk"

removed = Envless.workspace.delete

puts removed[:slug]

Parameters

ParameterTypeRequiredDescription
timeout:Integer | Float | RationalNoSeconds 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

deleted_workspace_resource with the id, name and slug of the removed workspace.

Worth knowing

  • The workspace:write scope is not sufficient. A key whose owner is not the workspace owner fails with auth.permission_denied.
  • A workspace that still holds a project fails with workspace.delete_has_projects.
  • A live subscription is canceled by this call and cannot be restored. The delete still succeeds if the billing provider refuses the cancellation, so check the customer portal if the workspace carried a plan.
  • The workspace.deleted webhook fires before the row is removed, so the event is still delivered.

Required scopes

workspace:write

Underlying endpoint

DELETE /workspace

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

In TypeScript

envless.workspace.delete()

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