Workspace

envless.workspace.delete()

Permanently delete the bound workspace

ts
delete(options?: RequestScope): Promise<DeletedWorkspaceResource>

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 resolved 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

ts
const removed = await envless.workspace.delete()

console.log(removed.slug)

Parameters

ParameterTypeRequiredDescription
options.signalAbortSignalNoCancels the request.

Returns

DeletedWorkspaceResource 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 Python

envless.workspace.delete()

The same method in envless-sdk, the Python SDK, with the same request, retries and errors.

In Ruby

Envless.workspace.delete

The same method in envless-sdk, the Ruby gem, with the same request, retries and errors.

In PHP

$envless->workspace->delete()

The same method in envless/sdk, the PHP SDK, with the same request, retries and errors.