---
url: https://docs.ogmabox.com/app/environment.md
description: >-
  Manage Ogma environment variables for Replay, Automate, Workflows, and testing
  context.
---

# Environment

Environment variables store reusable values you can reference in requests across Replay, Automate, and Workflows.

## Creating and Editing Variables

1. Open **Environment** from the left navigation.
2. Click **Add variable**.
3. Enter a name starting with a letter or underscore, followed by letters, numbers, underscores, or hyphens (maximum 64 characters).
4. Enter the value.
5. Toggle **Secret** if the value is sensitive (API keys, tokens, passwords). Secret values are masked in the UI and excluded from AI context.
6. Click **Save**.

To edit an existing variable, click its row and update the name or value.

## Using Variables in Requests

Reference an environment variable using the `env.` prefix:

```
{{env.VARIABLE_NAME}}
```

Examples:

* Host field: {{env.TARGET\_HOST}} (store a hostname, not a complete URL).
* Authorization header: Bearer {{env.AUTH\_TOKEN}}.
* Request body: {"tenant": "{{env.TENANT\_ID}}"}; enable body templating in Replay when you want substitutions inside the body.

Ogma resolves valid environment placeholders at send time. A missing variable produces an error rather than silently sending an unresolved value. Raw and Hex Replay sends preserve exact bytes and do not expand placeholders.

## Variable Scope

Choose **Global** for values shared by projects in this Ogma workspace, or **Project** for values belonging to the active project. Project values override global values with the same name. Replay also supports collection and session overrides; priority is session, collection, project, then global.

## Transforms and Dynamic Values

Append transforms with a pipe, for example {{env.AUTH\_TOKEN|base64\_encode}} or {{env.SEARCH|url\_encode}}. The chain applies left to right. Check the output with a test request: unrecognized transform names are skipped, not reported as errors.

Built-in values do not need a saved variable:

| Placeholder | Value |
| --- | --- |
| {{$timestamp}} | Current Unix time in milliseconds. |
| {{$timestamp\_s}} | Current Unix time in seconds. |
| {{$uuid}} | A new UUID. |
| {{$random(16)}} | 16 random bytes represented as hexadecimal. |
| {{$date(%Y-%m-%d)}} | Current UTC date using a date-format pattern. |

Stored values are not recursively expanded. If a value contains another placeholder, that nested text stays literal.

## AI Assistant Access

The AI assistant can read non-secret variable names and values to provide context when you ask it to analyze a request or draft a test plan. Secret variables are never included in AI context.

## Common Uses

| Variable | Example value |
| --- | --- |
| `BASE_URL` | `https://api.example.com` |
| `AUTH_TOKEN` | `eyJhbGci...` (mark as secret) |
| `TARGET_HOST` | `app.example.com` |
| `API_KEY` | `sk-...` (mark as secret) |
| `USER_ID` | `12345` |

## Related Pages

* [Replay](./replay.md)
* [Automate](./automate.md)
* [Workflows](./workflows.md)
