delete(project: string, environment: string, name: string, options?: ProductScope): Promise<DeletedVariableResource>Soft 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
const removed = await envless.variables.delete('api', 'production', 'LEGACY_API_URL')
console.log(removed.id, removed.environmentId)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. |
options.product | string | No | Product slug, needed when the project slug is not unique in the workspace. |
options.signal | AbortSignal | No | Cancels the request. |
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 Python
envless.variables.delete()
The same method in envless-sdk, the Python SDK, with the same request, retries and errors.
In Ruby
Envless.variables.delete
The same method in envless-sdk, the Ruby gem, with the same request, retries and errors.
In PHP
$envless->variables->delete()
The same method in envless/sdk, the PHP SDK, with the same request, retries and errors.