def delete(project, environment, name, product: nil, timeout: nil)def delete: (
String project,
String environment,
String name,
?product: (String | Symbol)?,
?timeout: seconds?
) -> deleted_variable_resourceSoft 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 delete_many when you want unknown names tolerated.
Example
ruby
require "envless/sdk"
removed = Envless.variables.delete(
"api",
"production",
"LEGACY_API_URL"
)
puts "#{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. |
product: | String | Symbol | No | Product slug, needed when the project slug is not unique in the workspace. |
timeout: | Integer | Float | Rational | No | Seconds each attempt of this call may take, redirects and the response body included, before it raises Envless::NetworkError with timeout? set. Overrides the client's timeout for this call, and 0 turns the limit off. |
Returns
deleted_variable_resource 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.