> ## 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.

# Administration API: Environment variables

> Set, rename, delete, and list the variables of a workspace and its environments, and read one value with its own capability, with the Administration API.

Manage environment variables from code: set them in bulk on the workspace or on one environment, rename and delete them, list their names, and read one value when a key is allowed to.

> [!NOTE]
>
> **Prerequisites:**
>
> * These operations are part of the Enterprise plan. On other plans, they fail with `PLAN_UPGRADE_REQUIRED`.
> * An account API key with the `X-Paradime-Workspace` header, or a workspace API key.
> * The **Environment variables admin** capability group. To read a value with `revealEnvironmentVariable`, the key needs **Environment variable values viewer**, which **Environment variables admin** does not include.
>
> Keys, errors, pagination, and write-only secrets work the same in every area. See [Conventions](https://docs.paradime.io/developers/graphql-api/admin-api/conventions.md).

## Operations

| Operation | Type | What it does | Capability group |
| - | - | - | - |
| [`Workspace.environmentVariables`](https://docs.paradime.io/graphql-reference/types/Workspace) | Field | Lists the names of the workspace's or one environment's variables, never the values. | Environment variables admin |
| [`setEnvironmentVariables`](https://docs.paradime.io/graphql-reference/mutations/setEnvironmentVariables) | Mutation | Sets variables of one scope in one write, and keeps or deletes the others. | Environment variables admin |
| [`deleteEnvironmentVariables`](https://docs.paradime.io/graphql-reference/mutations/deleteEnvironmentVariables) | Mutation | Deletes variables of one scope. | Environment variables admin |
| [`renameEnvironmentVariable`](https://docs.paradime.io/graphql-reference/mutations/renameEnvironmentVariable) | Mutation | Renames a variable and keeps its value. | Environment variables admin |
| [`revealEnvironmentVariable`](https://docs.paradime.io/graphql-reference/mutations/revealEnvironmentVariable) | Mutation | Reads one variable's value, and writes the read to the audit log. | Environment variable values viewer |

## Scopes

Every operation names one scope:

| `scope` | Variables | `environmentSlug` |
| - | - | - |
| `WORKSPACE` | The workspace's own variables. Every environment, Bolt schedule, agent, and editor of the workspace inherits them. | Leave it out. |
| `ENVIRONMENT` | One environment's variables, Bolt or agent. They override the workspace's variables of the same name. | Required: the environment's slug. |

A user's own Code IDE variables are not part of the API. Each user manages them in the app.

A variable name starts with a letter or `_`, then has letters, digits, and `_`. Names are case-sensitive. A value can't be empty and can't contain a NUL character.

## Set variables

`setEnvironmentVariables` writes every variable you send in one write. `mode` decides what happens to the scope's other variables:

* `MERGE`, the default, keeps every other variable of the scope.
* `REPLACE` makes the variables you send the scope's only variables, and deletes the others. It needs at least one variable.

`changedNames` lists the names that the call added, gave a new value, or deleted. It is empty when nothing changed: sending the same input again changes nothing and adds no audit entry.

When the workspace's variables or a Bolt environment's variables change, Paradime redeploys the workspace's Bolt schedules. When the workspace's variables change, Paradime also rewrites the workspace's editor settings.

> [!NOTE]
>
> An empty value does not delete a variable: it fails with `VALIDATION_FAILED`. To delete variables, use `deleteEnvironmentVariables`.

```graphql theme={"system"}
mutation SetVariables($input: SetEnvironmentVariablesInput!) {
  setEnvironmentVariables(input: $input) {
    changedNames
    variables(first: 100) {
      totalCount
      edges {
        node {
          name
          isSet
          updatedAt
        }
      }
    }
  }
}
```

```json theme={"system"}
{
  "input": {
    "scope": "ENVIRONMENT",
    "environmentSlug": "staging",
    "mode": "MERGE",
    "variables": [
      { "name": "DBT_TARGET_SCHEMA", "value": "analytics_staging" },
      { "name": "SNOWFLAKE_PASSWORD", "value": "arn:aws:secretsmanager:us-east-1:123456789012:secret:prod/snowflake-AbCdEf#password" }
    ]
  }
}
```

> [accordion] Example response
>
> ```json theme={"system"}
> {
>   "data": {
>     "setEnvironmentVariables": {
>       "changedNames": ["DBT_TARGET_SCHEMA", "SNOWFLAKE_PASSWORD"],
>       "variables": {
>         "totalCount": 2,
>         "edges": [
>           { "node": { "name": "DBT_TARGET_SCHEMA", "isSet": true, "updatedAt": "2026-11-27T10:30:12+00:00" } },
>           { "node": { "name": "SNOWFLAKE_PASSWORD", "isSet": true, "updatedAt": "2026-11-27T10:30:12+00:00" } }
>         ]
>       }
>     }
>   }
> }
> ```

A value can be a reference to a secret in AWS Secrets Manager, Azure Key Vault, or GCP Secret Manager, as in the example. Paradime reads the secret when the variable is used. See [AWS Secret Manager](https://docs.paradime.io/integrations/aws-secret-manager.md).

## List variables

`environmentVariables` lists the names of one scope's variables, ordered by name, and never their values. A scope's variables are stored together, so they all show the same `updatedAt`.

```graphql theme={"system"}
query ListVariables($scope: EnvironmentVariableScope, $environmentSlug: String) {
  workspace {
    environmentVariables(scope: $scope, environmentSlug: $environmentSlug) {
      totalCount
      edges {
        node {
          name
          updatedAt
        }
      }
    }
  }
}
```

```json theme={"system"}
{ "scope": "WORKSPACE" }
```

To read only the names of every environment's variables in one query, select `variableNames` on [`environments`](https://docs.paradime.io/developers/graphql-api/admin-api/environments#list-environments).

## Rename or delete variables

`renameEnvironmentVariable` renames a variable and keeps its value. No other variable of the scope can have the new name. A retry is safe: when `name` is missing and `newName` exists, the call succeeds and changes nothing. A success therefore does not prove that `name` existed.

```graphql theme={"system"}
mutation RenameVariable($input: RenameEnvironmentVariableInput!) {
  renameEnvironmentVariable(input: $input) {
    variable {
      name
      updatedAt
    }
  }
}
```

```json theme={"system"}
{
  "input": {
    "scope": "WORKSPACE",
    "name": "SF_PASSWORD",
    "newName": "SNOWFLAKE_PASSWORD"
  }
}
```

`deleteEnvironmentVariables` deletes the names you send. It ignores names that do not exist, and `deletedNames` lists the ones it deleted. Rename and delete redeploy the Bolt schedules the same way as `setEnvironmentVariables`.

```graphql theme={"system"}
mutation DeleteVariables($input: DeleteEnvironmentVariablesInput!) {
  deleteEnvironmentVariables(input: $input) {
    deletedNames
  }
}
```

```json theme={"system"}
{
  "input": {
    "scope": "ENVIRONMENT",
    "environmentSlug": "staging",
    "names": ["DBT_TARGET_SCHEMA"]
  }
}
```

## Read a value

`revealEnvironmentVariable` returns one variable's value. It needs **Environment variable values viewer**, and every read adds an entry to the audit log. Give this group only to keys that must read values: a key that sets variables does not need it.

```graphql theme={"system"}
mutation RevealVariable($input: RevealEnvironmentVariableInput!) {
  revealEnvironmentVariable(input: $input) {
    name
    value
  }
}
```

```json theme={"system"}
{ "input": { "scope": "WORKSPACE", "name": "DBT_TARGET_SCHEMA" } }
```

## Errors

These are the cases specific to environment variables. For the error format and the codes every area shares, see [Errors](https://docs.paradime.io/developers/graphql-api/admin-api/conventions.md#errors).

| Code | When |
| - | - |
| `CONFLICT` | Another change to the same scope is in progress, or someone changed the scope's variables while the call ran. Nothing was written: send the call again. `newName` already exists, on rename. A Bolt and an agent environment have the same slug. |
| `NOT_FOUND` | The workspace has no environment with the `environmentSlug`. No variable has the `name`, on rename or reveal. |
| `VALIDATION_FAILED` | A name breaks the naming rule. A name is sent more than once. A value is empty or holds a NUL character. `environmentSlug` is missing for `ENVIRONMENT`, or sent for `WORKSPACE`. `REPLACE` with no variables. |

## Related

* [Python SDK: Environment variables](https://docs.paradime.io/developers/python-sdk/modules/admin/environment-variables.md): the same operations in `paradime.admin.environment_variables`.
* [Paradime CLI: `paradime admin`](https://docs.paradime.io/developers/paradime-cli/admin-cli): `paradime admin env-vars` lists, sets, renames, deletes, and reveals variables.
* [Environment variables](https://docs.paradime.io/products/settings/environment-variables/index.md): the same variables in the app.
* [Bolt schedule environment variables](https://docs.paradime.io/products/settings/environment-variables/bolt-schedule-env-variables.md) and [Agent environment variables](https://docs.paradime.io/products/settings/environment-variables/dinoai-background-agent-environment-variables.md): how runs use them.


## Related topics

- [Administration API: Environments](https://docs.paradime.io/developers/graphql-api/admin-api/environments.md)
- [Administration API](https://docs.paradime.io/developers/graphql-api/admin-api/index.md)
- [Administration](https://docs.paradime.io/products/settings/index.md)
- [Administration API: Conventions](https://docs.paradime.io/developers/graphql-api/admin-api/conventions.md)
- [Administration API: Setup status](https://docs.paradime.io/developers/graphql-api/admin-api/setup-status.md)


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