def delete(
project: str,
environment: str,
name: str,
*,
product: str | None = None,
timeout: float | None = None,
) -> DeletedVariableResourceasync def delete(
project: str,
environment: str,
name: str,
*,
product: str | None = None,
timeout: float | None = None,
) -> DeletedVariableResourceSoft 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'])import asyncio
from envless import AsyncEnvless
async def main() -> None:
async with AsyncEnvless() as envless:
removed = await envless.variables.delete(
'api', 'production', 'LEGACY_API_URL'
)
print(removed['id'], removed['environmentId'])
asyncio.run(main())Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
project | str | Yes | Project slug the environment belongs to. |
environment | str | Yes | Environment slug the variable lives in. |
name | str | Yes | Variable name, matched without regard to case. |
product | str | No | Product slug, needed when the project slug is not unique in the workspace. |
timeout | float | No | Seconds 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.