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

# Environment Variables

> Manage organization environment variables available to Spark jobs and scripts.

Organization environment variables are available to Spark jobs and scripts at runtime. Names must start with a letter or underscore, contain only letters, numbers, and underscores, and are normalized to uppercase server-side.

## `listEnvironmentVariables()`

List all organization environment variables. Values are decrypted server-side.

```ts theme={null}
const all = await client.listEnvironmentVariables();
for (const variable of all) {
  console.log(variable.name, variable.value);
}
```

### Return type: `EnvironmentVariable[]`

| Field                | Type            | Description                      |
| -------------------- | --------------- | -------------------------------- |
| `id`                 | `string`        | Variable ID                      |
| `name`               | `string`        | Variable name (stored uppercase) |
| `value`              | `string`        | Decrypted value                  |
| `organization_id`    | `string`        | Owning organization              |
| `created_by_user_id` | nullable string | User who created the variable    |
| `created_at`         | `string`        | ISO timestamp when created       |
| `updated_at`         | `string`        | ISO timestamp when last updated  |

***

## `getEnvironmentVariable(name)`

Get a single environment variable by name. Lookup is case-insensitive since names are stored uppercase. Returns `undefined` when not set.

```ts theme={null}
const token = await client.getEnvironmentVariable("MY_TOKEN");
if (token) {
  console.log(token.value);
}
```

***

## `setEnvironmentVariable(name, value)`

Create or update an environment variable. Setting an existing name overwrites its value.

```ts theme={null}
const variable = await client.setEnvironmentVariable("MY_TOKEN", "secret-value");
console.log(variable.id, variable.name); // name is uppercased
```

***

## `deleteEnvironmentVariable(options)`

Delete an environment variable by `id` or `name`. Provide exactly one.

```ts theme={null}
await client.deleteEnvironmentVariable({ name: "MY_TOKEN" });
// or by id:
await client.deleteEnvironmentVariable({ id: "env-var-id" });
```

Throws an error if the named variable does not exist.
