Variables

Envless.variables.delete_by_id

Soft delete one variable by id

def delete_by_id(id, timeout: nil)

Soft deletes one variable by id. Version snapshots taken earlier keep their copy of the value, so a rollback can restore it.

An id that never existed and an id that was already deleted both answer 404 rather than succeeding quietly, so a retry after a delete that actually landed will raise. Treat that 404 as success if your caller is meant to be idempotent.

Example

ruby
require "envless/sdk"

id = "a7f2c1e0-8b4d-4c11-9f3a-2d5e6b7c8d90"
removed = Envless.variables.delete_by_id(id)

puts "#{removed[:name]} #{removed[:environmentId]}"

Parameters

ParameterTypeRequiredDescription
idStringYesVariable id from a list response or a webhook payload.
timeout:Integer | Float | RationalNoSeconds 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

  • This is the only delete route that tells you the name of a variable you addressed purely by id.

Required scopes

variables:write

Underlying endpoint

DELETE /variables/{id}

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

In TypeScript

envless.variables.deleteById()

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