Projects

$envless->projects->delete()

Soft delete a project and everything under it

php
/** @return DeletedProjectResource */
public function delete(
    string $slug,
    ?string $product = null,
    int|float|null $timeout = null,
): array

Soft deletes the project together with its environments and every variable in them, in one transaction, which takes the version history of those environments out of reach with it. There is no has children guard, so a project full of secrets goes away without complaint. Confirm with the caller before firing this.

The returned value is a tombstone with id, name and slug, plus deletedEnvironments and deletedVariables counting what went with it, not the full project shape, so capture anything else you need before deleting. A 409 means the slug was ambiguous and nothing was touched, not that the delete half happened.

Example

php
use Envless\Envless;

$envless = new Envless();

$removed = $envless->projects->delete('api-gateway', product: 'billing');

echo $removed['id'], PHP_EOL;

Parameters

ParameterTypeRequiredDescription
$slugstringYesProject slug, or the project uniqueId.
$productstringNoProduct slug used to disambiguate an ambiguous project slug.
$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

DeletedProjectResource carrying id, name, slug, deletedEnvironments and deletedVariables.

Worth knowing

  • deletedVariables counts live variables only. Version snapshots are not deleted and are not counted, they simply stop resolving once their environment is gone.
  • A 409 project.ambiguous_product is safe to retry with product: set.
  • The tombstone omits product, so read the project first if you need to log where it lived.

Required scopes

projects:write

Underlying endpoint

DELETE /projects/{slug}

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

In TypeScript

envless.projects.delete()

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