> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# interpolateEnvVars

> Interpolate ${VAR|default} patterns in a raw string.

[ref-substitutevars]: /docs/server-sdks/reference/typescript/agents/configuration/config-loader/substitute-vars

Interpolate `${VAR|default}` environment-variable references in a raw string.
Unlike [`substituteVars()`][ref-substitutevars], this method does not apply
type coercion -- the result is always a string. Missing env vars with no
default resolve to an empty string.

<Note>
  This is a TS-specific helper (no Python SDK equivalent). Use it when building
  URLs, log messages, or any string output where numeric/boolean coercion would
  corrupt the value.
</Note>

## **Parameters**

<ParamField path="input" type="string" required={true} toc={true}>
  The string containing `${VAR}` or `${VAR|default}` references.
</ParamField>

## **Returns**

`string` -- the input with all env var references resolved.

## **Example**

```typescript {4}
import { ConfigLoader } from '@signalwire/sdk';

const loader = new ConfigLoader();
const url = loader.interpolateEnvVars(
  'https://${HOST|api.example.com}/v1/${VERSION|latest}',
);
console.log(url);
// "https://api.example.com/v1/latest" (defaults used when env vars unset)
```