def delete(timeout: nil)def delete: (?timeout: seconds?) -> deleted_workspace_resourceDeletes 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
require "envless/sdk"
removed = Envless.workspace.delete
puts removed[:slug]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
deleted_workspace_resource with the id, name and slug of the removed workspace.
Worth knowing
- The
workspace:writescope is not sufficient. A key whose owner is not the workspace owner fails withauth.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.deletedwebhook 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.