Workspace

$envless->workspace->delete()

Permanently delete the bound workspace

php
/** @return DeletedWorkspaceResource */
public function delete(int|float|null $timeout = null): array

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

php
use Envless\Envless;

$envless = new Envless();

$removed = $envless->workspace->delete();

echo $removed['slug'], PHP_EOL;

Parameters

ParameterTypeRequiredDescription
$timeoutint|floatNoSeconds each attempt of this call may take, the response body included, before it throws Envless\Exception\NetworkException with isTimeout() true. Overrides the client's timeout for this call, and 0 turns the limit off.

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 TypeScript

envless.workspace.delete()

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