---
title: "Embedded Syntax | Speedscale Docs"
description: "Reference for Speedscale's embedded ${{...}} substitution syntax, including variable substitution and the special keywords for environment variables, random strings, files, user data, dataframes, and secrets."
canonical: "https://docs.speedscale.com/guides/transformation/embedded-syntax/"
---

[Documentation index](https://docs.speedscale.com/guides/llms.txt) | [Markdown](https://docs.speedscale.com/guides/transformation/embedded-syntax/index.md) | [Canonical page](https://docs.speedscale.com/guides/transformation/embedded-syntax/)

# Embedded Syntax

Most transform configuration fields support an embedded substitution syntax. Anywhere you can type a value — for example the `new` field of a [constant](https://docs.speedscale.com/guides/transformation/transforms/constant/), or the `key` and `field` of a [dataframe lookup](https://docs.speedscale.com/guides/transformation/transforms/dataframe/) — you can embed a placeholder of the form:

```text
${{ ... }}
```

Each placeholder is resolved at runtime, just before the transform runs, against the [variable cache](https://docs.speedscale.com/reference/glossary/#variable-cache) for the current [vUser](https://docs.speedscale.com/reference/glossary/#vuser). The substituted result is then used as the field value. Placeholders that cannot be resolved are simply left in place, so a typo fails open rather than erroring.

The simplest form is a plain [variable](https://docs.speedscale.com/guides/transformation/variables/) name, but several **special keywords** are also recognized. They are summarized here and described in detail below.

| Form | Resolves to | Example |
| --- | --- | --- |
| `${{name}}` | The value of variable `name` from the variable cache | `${{customer_id}}` |
| `${{env_var:NAME}}` | The value of the `NAME` environment variable | `${{env_var:HOME}}` |
| `${{rand_string:"PATTERN"}}` | A random string matching a regex-style pattern | `${{rand_string:"SPDID-[a-z0-9]{10}"}}` |
| `${{file:FILENAME}}` | The entire contents of a file (local path or `s3://` user data) | `${{file:s3://payload.json}}` |
| `${{dataframe:NAME:KEY:FIELD}}` | A single cell looked up from a loaded dataframe | `${{dataframe:people:${{id}}:Email}}` |
| `${{secret:NAME/KEY}}` | A value read from a mounted secret | `${{secret:mongo-creds/password}}` |

note

Substitution is a simple text replacement, not an expression language. There is no dot-notation, array indexing, or JSON-path access into a stored value (e.g. `${{user.email}}` is treated as a literal variable name, not a field lookup). The only nesting supported is inside the `key` and `field` parts of a `dataframe:` directive.

<a id="variable-substitution"></a>

## Variable substitution

A bare name is replaced with the value of that [variable](https://docs.speedscale.com/guides/transformation/variables/) from the variable cache. Variables are populated by transforms like [var\_store](https://docs.speedscale.com/guides/transformation/transforms/variable_store/), by [runtime variables](https://docs.speedscale.com/guides/transformation/variables/), or extracted from earlier traffic.

```text
${{customer_id}}
```

For example, to embed a stored value inside a `constant`:

```json
{
  "type": "constant",
  "config": {
    "new": "Bearer ${{access_token}}"
  }
}
```

<a id="env_var--environment-variables"></a>

## `env_var` — environment variables

Reads an environment variable from the process running the replay. Returns an empty string when the variable is unset.

The variable is read only where the replay runs: the generator and responder in your cluster, or proxymock on your machine. A transform preview in the dashboard and snapshot analysis run in Speedscale cloud, which cannot see that environment, so they show `will be loaded at runtime` in place of the value.

```text
${{env_var:NAME}}
```

```json
{
  "type": "constant",
  "config": {
    "new": "${{env_var:BUILD_VERSION}}"
  }
}
```

<a id="rand_string--generated-random-strings"></a>

## `rand_string` — generated random strings

Generates a random string that matches the supplied regex-style pattern. The pattern is given as a JSON-escaped string literal (wrapped in double quotes). This is the inline equivalent of the [rand\_string](https://docs.speedscale.com/guides/transformation/transforms/rand_string/) transform.

```text
${{rand_string:"PATTERN"}}
```

```json
{
  "type": "constant",
  "config": {
    "new": "${{rand_string:\"order-[a-z0-9]{12}\"}}"
  }
}
```

<a id="file--inline-file-contents"></a>

## `file` — inline file contents

Inserts the **entire** contents of a file. Two sources are supported:

*   a local filesystem path, e.g. `${{file:/var/secrets/token}}`
*   `s3://<name>` to pull a [user data](https://docs.speedscale.com/reference/glossary/#user-data) document from the Speedscale cloud, e.g. `${{file:s3://payload.json}}`

A local path is read only where the replay runs: the generator and responder in your cluster, or proxymock on your machine. A transform preview in the dashboard and snapshot analysis show `will be loaded at runtime` for a local path. User data resolves in both places.

This is useful when you want to embed an arbitrary blob — JSON, XML, a token, anything — without imposing any structure on it. Unlike a dataframe, the file is not parsed; its raw bytes become the value.

```json
{
  "type": "constant",
  "config": {
    "new": "${{file:s3://default-request-body.json}}"
  }
}
```

tip

Pulling from `s3://` requires a connection to the file store (available during cloud replays). For the **CSV/tabular** lookup case, and for a portable reference that also works in local proxymock replays, see the `dataframe:` keyword below and the [file extractor](https://docs.speedscale.com/guides/transformation/extractors/file/).

<a id="dataframe-lookup"></a>

## `dataframe` — keyed lookup

Looks up a single cell from a dataframe that was loaded as a runtime variable. This is the inline equivalent of the [dataframe\_lookup](https://docs.speedscale.com/guides/transformation/transforms/dataframe/) transform.

```text
${{dataframe:NAME:KEY:FIELD}}
```

*   **NAME** — the name of the dataframe runtime variable (set up with a `csv_dataframe` variable)
*   **KEY** — the primary-key value of the row to read
*   **FIELD** — the column to return

`KEY` and `FIELD` may themselves contain `${{...}}` placeholders, so the lookup can be driven dynamically by other variables:

```text
${{dataframe:people:${{customer_name}}:Email}}
```

The lookup is performed against an already-loaded, in-memory dataframe — the keyword itself does not fetch anything. The dataframe's source CSV (including pulling it from cloud [user data](https://docs.speedscale.com/reference/glossary/#user-data) via the portable `dataframe:` filename scheme) is resolved when the `csv_dataframe` runtime variable loads. See [Dataframe](https://docs.speedscale.com/guides/transformation/transforms/dataframe/) and the [file extractor](https://docs.speedscale.com/guides/transformation/extractors/file/) for how that source is located in cloud vs. local replays.

<a id="secret--mounted-secrets"></a>

## `secret` — mounted secrets

Reads a value from a secret made available to the replay (for example a Kubernetes secret mounted by the operator). The format is `name/key`:

```text
${{secret:NAME/KEY}}
```

```json
{
  "type": "constant",
  "config": {
    "new": "${{secret:mongo-creds/password}}"
  }
}
```

The `secret:` keyword is recognized by the transforms that handle credentials: [constant](https://docs.speedscale.com/guides/transformation/transforms/constant/), [jwt\_resign](https://docs.speedscale.com/guides/transformation/transforms/jwt_resign/), [aws\_auth](https://docs.speedscale.com/guides/transformation/transforms/aws_auth/), [token\_fetch](https://docs.speedscale.com/guides/transformation/transforms/token_fetch/) and its alias [oauth\_client\_credentials](https://docs.speedscale.com/guides/transformation/transforms/oauth_client_credentials/), and the SASL auth transform. [Replace credentials](https://docs.speedscale.com/guides/replay/replace-credentials/#kubernetes-secret-or-constant) writes these references for you. The value is never written to logs or dumps.
