> ## Documentation Index
> Fetch the complete documentation index at: https://docs.paradime.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Admin client: environment variables

> List, set, rename, delete and reveal the environment variables of a workspace or one of its environments from Python with paradime.admin.environment_variables.

`paradime.admin.environment_variables` manages the environment variables of a workspace, or of one of its Bolt or agent environments when you pass `environment_slug`. Values are write-only: only `reveal` reads one. For the GraphQL operations, see [Environment variables](https://docs.paradime.io/developers/graphql-api/admin-api/environment-variables).

> [!NOTE]
>
> **Prerequisites**
>
> * These operations are part of the Enterprise plan. On other plans, they raise `AdminPlanUpgradeRequiredException`.
> * Your API key needs the **Environment variables admin** capability group. To read a value with `reveal`, the key needs **Environment variable values viewer**.
> * The admin client of the `paradime-io` package. See [Admin client](https://docs.paradime.io/developers/python-sdk/modules/admin/index).

The examples on this page use this client:

```python theme={"system"}
from paradime import Paradime

paradime = Paradime(api_endpoint="API_ENDPOINT", api_secret="prdm_cmp_...", workspace_uid="WORKSPACE_UID")
```

Every method takes `environment_slug`. Leave it out for the workspace's own variables. Pass an environment's slug for that environment's variables. An empty slug raises `ValueError`.

## List variables

Iterates over the variables' names, ordered by name. Values are never returned.

**environment\_slug** `Optional[str]` (default: None)

An environment's slug, for its variables. Leave it out for the workspace's own variables.

**workspace\_uid** `Optional[str]` (default: None)

The workspace to read, for a company API key.

**page\_size** `int` (default: 100)

How many variables to read per request, at most 500.

**Returns** `Iterator[EnvironmentVariable]`

The variables, read one page at a time.

```python theme={"system"}
for variable in paradime.admin.environment_variables.list(environment_slug="staging"):
    print(variable.name, variable.is_set, variable.updated_at)
```

## Set variables

Sets variables in one call. Sending the same variables again changes nothing. A change to the workspace's variables or a Bolt environment's variables redeploys the Bolt schedules. A change to the workspace's variables also rewrites the workspace's editor settings.

**variables** `Mapping[str, str]` *required*

Names and values. A value can't be empty: delete a variable with [`delete`](#delete-variables).

**environment\_slug** `Optional[str]` (default: None)

An environment's slug, to set its variables.

**replace** `bool` (default: False)

Make these the scope's only variables, and delete the others.

**workspace\_uid** `Optional[str]` (default: None)

The workspace to change, for a company API key.

**Returns** `SetEnvironmentVariablesResult`

The names that were added, changed or deleted (`changed_names`), and how many variables the scope holds now (`total_count`).

```python theme={"system"}
result = paradime.admin.environment_variables.set(
    {"DBT_TARGET_SCHEMA": "analytics_staging", "DBT_SEND_ANONYMOUS_USAGE_STATS": "false"},
    environment_slug="staging",
)
print(result.changed_names, result.total_count)
```

> [!WARNING]
>
> With `replace=True`, every variable of the scope that is not in `variables` is deleted.

## Delete variables

Deletes variables, with the same redeploys as `set`. Names that don't exist are ignored.

**names** `List[str]` *required*

The names to delete.

**environment\_slug** `Optional[str]` (default: None)

An environment's slug, to delete its variables.

**workspace\_uid** `Optional[str]` (default: None)

The workspace to change, for a company API key.

**Returns** `List[str]`

The names that existed and were deleted.

```python theme={"system"}
deleted = paradime.admin.environment_variables.delete(["OLD_TOKEN"], environment_slug="staging")
```

## Rename a variable

Renames a variable and keeps its value, with the same redeploys as `set`. Retrying a rename that already finished succeeds.

**name** `str` *required*

The variable's current name.

**new\_name** `str` *required*

Its new name. No other variable of the scope may have it.

**environment\_slug** `Optional[str]` (default: None)

An environment's slug, for its variables.

**workspace\_uid** `Optional[str]` (default: None)

The workspace to change, for a company API key.

**Returns** `EnvironmentVariable`

The variable, with its new name.

```python theme={"system"}
paradime.admin.environment_variables.rename("SNOWFLAKE_USER", "DBT_SNOWFLAKE_USER")
```

## Reveal a variable

Reads a variable's value. Needs the **Environment variable values viewer** capability group. Paradime writes every reveal to the audit log.

**name** `str` *required*

The variable's name.

**environment\_slug** `Optional[str]` (default: None)

An environment's slug, for its variables.

**workspace\_uid** `Optional[str]` (default: None)

The workspace to read, for a company API key.

**Returns** `str`

The value.

```python theme={"system"}
value = paradime.admin.environment_variables.reveal("DBT_TARGET_SCHEMA", environment_slug="staging")
```

## Types

Import the models from `paradime.apis.admin.environment_variables.types`.

**EnvironmentVariable** `model`

**fields**

**name** `str`

The variable's name.

**is\_set** `bool`

Whether the variable has a value. Always `True`, because values can't be empty.

**updated\_at** `Optional[datetime]`

When the variables of this scope were last written. A scope's variables are stored together, so they all show the same time.

**SetEnvironmentVariablesResult** `model`

**fields**

**changed\_names** `List[str]`

The names that were added, changed or deleted.

**total\_count** `int`

How many variables the scope holds now.


## Related topics

- [Admin client: environments](https://docs.paradime.io/developers/python-sdk/modules/admin/environments.md)
- [Admin client](https://docs.paradime.io/developers/python-sdk/modules/admin/index.md)
- [Bolt Environment Variables](https://docs.paradime.io/products/settings/environment-variables/bolt-schedule-env-variables.md)
- [Agent Environment Variables](https://docs.paradime.io/products/settings/environment-variables/dinoai-background-agent-environment-variables.md)
- [Code IDE Environment Variables](https://docs.paradime.io/products/settings/environment-variables/code-ide-env-variables.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.