php
/** @return DeletedVariableResource */
public function delete(
string $project,
string $environment,
string $name,
?string $product = null,
int|float|null $timeout = null,
): arraySoft deletes one live variable by name, matched without regard to case, so api_key removes a live API_KEY. It stops appearing in reads immediately, but version snapshots taken before the delete keep their copy, so a rollback can bring the variable back.
Deleting a name that is not there is a 404, not a no-op, which makes a blind retry after a successful delete fail. Use deleteMany when you want unknown names tolerated.
Example
php
use Envless\Envless;
$envless = new Envless();
$removed = $envless->variables->delete(
'api',
'production',
'LEGACY_API_URL',
);
echo "{$removed['id']} {$removed['environmentId']}", PHP_EOL;Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
$project | string | Yes | Project slug the environment belongs to. |
$environment | string | Yes | Environment slug the variable lives in. |
$name | string | Yes | Variable name, matched without regard to case. |
$product | string | No | Product slug, needed when the project slug is not unique in the workspace. |
$timeout | int|float | No | Seconds 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
DeletedVariableResource with the id, name and environmentId of the removed row.
Worth knowing
- The name is freed for reuse right away, in any casing, but a new variable of that name gets a new id and an empty history.
Required scopes
variables:write
Underlying endpoint
DELETE /projects/{slug}/environments/{environmentSlug}/variables/{name}
Request and response schema, every error code, and a live playground.
In TypeScript
envless.variables.delete()
The same method in @goenvless/sdk, with the same request, retries and errors.