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

# Ephemeral parameters

> [!NOTE]
>
> This feature is in **preview**. The API may change before general availability. To try it out, contact [support@intunedhq.com](mailto:support@intunedhq.com) and we'll enable it for your workspace.

Read values that were passed to a Run as `ephemeralParameters`. Unlike `parameters`, ephemeral parameters are never stored on the Run record, never sent to sinks, and never appear in logs or traces. They exist only for the lifetime of the Run.

Use them for a secret that belongs to a single Run—a portal password supplied by an end user, a one-time code, or a government ID you must not retain.

```typescript theme={null}
import {
  getEphemeralParameter,
  invalidateEphemeralParameter,
  resumeTracing,
} from "@intuned/runtime";

const password = await getEphemeralParameter("portalPassword");
await page.getByLabel("Password").fill(String(password));
await invalidateEphemeralParameter("portalPassword");
resumeTracing();
```

For how to pass them in and how the platform stores them, see [Ephemeral parameters](https://intunedhq.com/docs/main/02-features/ephemeral-parameters.md).

## Available helpers

* [`getEphemeralParameter`](#getephemeralparameter) — Read an ephemeral parameter
* [`invalidateEphemeralParameter`](#invalidateephemeralparameter) — Delete an ephemeral parameter

## Function reference

### getEphemeralParameter

```typescript theme={null}
import { getEphemeralParameter } from "@intuned/runtime";

function getEphemeralParameter(
  key: string
): Promise<string | number | boolean | undefined>;
```

Reads an ephemeral parameter for the current Run. Returns `undefined` if the key wasn't passed to the Run, or if it has already been invalidated.

> [!WARNING]
>
> **This function pauses tracing.** Before returning, it calls [`pauseTracing`](https://intunedhq.com/docs/main/05-references/runtime-sdk-typescript/pause-tracing#pausetracing) so the value can't be captured by the browser trace, a screenshot, or an automation log. It does **not** resume tracing for you—call [`resumeTracing`](https://intunedhq.com/docs/main/05-references/runtime-sdk-typescript/pause-tracing#resumetracing) once you're done with the value, or the rest of the attempt goes unrecorded.

**Parameters**

**key** `string` *required*

The top-level key of the ephemeral parameter, as passed in the Run's `ephemeralParameters` map.

**Returns**

Returns the value for that key, or `undefined` if it isn't available. Values are JSON scalars—`string`, `number`, or `boolean`.

**Example**

Scope the whole sensitive section so tracing resumes on its own, even if a step fails:

```typescript theme={null}
import {
  getEphemeralParameter,
  invalidateEphemeralParameter,
  withTracingPaused,
  NonRetryableError,
} from "@intuned/runtime";
import type { Page } from "playwright";

export default async function login(params: { username: string }, page: Page) {
  await page.goto("https://portal.example.com/login");
  await page.getByLabel("Username").fill(params.username);

  await withTracingPaused(async () => {
    const password = await getEphemeralParameter("portalPassword");
    if (password === undefined) {
      throw new NonRetryableError("portalPassword ephemeral parameter is required");
    }

    await page.getByLabel("Password").fill(String(password));
    await invalidateEphemeralParameter("portalPassword");
  });

  await page.getByRole("button", { name: "Sign in" }).click();
  await page.waitForURL("**/dashboard");
}
```

### invalidateEphemeralParameter

```typescript theme={null}
import { invalidateEphemeralParameter } from "@intuned/runtime";

function invalidateEphemeralParameter(key: string): Promise<void>;
```

Deletes an ephemeral parameter from storage immediately. Call it as soon as the value has done its job. Invalidating a key that doesn't exist, or that was already invalidated, does nothing.

> [!WARNING]
>
> Invalidation is scoped to the **Run**, not the attempt, and it cannot be undone. If an attempt invalidates a key and then fails, the retry gets `undefined` for that key. See [Invalidation and retries](#invalidation-and-retries).

**Parameters**

**key** `string` *required*

The top-level key of the ephemeral parameter to delete.

**Returns**

Returns `void`.

## Invalidation and retries

Ephemeral parameters are stored per Run and shared by every attempt of that Run. That makes invalidation a tradeoff:

* **Invalidate early** and the value is gone the moment you're done with it—but a retry can no longer read it, so the retry fails.
* **Don't invalidate** and every attempt can read the value. It's still deleted automatically when the Run reaches a terminal state, or by its 24-hour TTL if the Run never starts.

Pick based on how the automation is configured:

| Your setup | Recommendation |
| - | - |
| `maximumAttempts: 1` | Invalidate as soon as you've used the value. |
| Retries enabled, and a retry would need the value again | Don't invalidate. Rely on automatic deletion at the end of the Run. |
| Retries enabled, and re-use would be unsafe | Invalidate, and throw [`NonRetryableError`](https://intunedhq.com/docs/main/05-references/runtime-sdk-typescript/non-retryable-error) if a later attempt finds the value missing. |

## Related

* [Ephemeral parameters](https://intunedhq.com/docs/main/02-features/ephemeral-parameters.md) — Passing them to a Run, storage, and lifetime.
* [Pause tracing](https://intunedhq.com/docs/main/05-references/runtime-sdk-typescript/pause-tracing.md) — Control what gets recorded around a sensitive step.
* [Environment variables and secrets](https://intunedhq.com/docs/main/02-features/environment-variables-secrets.md) — For secrets that are the same on every Run.
* [Non-retryable errors](https://intunedhq.com/docs/main/05-references/runtime-sdk-typescript/non-retryable-error.md) — Stop a Run that can't succeed without new input.


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