Variables

envless.variables.delete()

Soft delete one variable by name

def delete(
    project: str,
    environment: str,
    name: str,
    *,
    product: str | None = None,
    timeout: float | None = None,
) -> 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 delete_many when you want unknown names tolerated.

Example

from envless import envless

removed = envless.variables.delete(
    'api', 'production', 'LEGACY_API_URL'
)

print(removed['id'], removed['environmentId'])

Parameters

ParameterTypeRequiredDescription
projectstrYesProject slug the environment belongs to.
environmentstrYesEnvironment slug the variable lives in.
namestrYesVariable name, matched without regard to case.
productstrNoProduct slug, needed when the project slug is not unique in the workspace.
timeoutfloatNoSeconds each attempt of this call may take, the response body included, before it raises EnvlessNetworkError with is_timeout set. 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.