# Account Interpolation

Source: https://docs.formance.com/v4.0/modules/numscript/reference/account-interpolation

Stack: v4.0

Requires flag: `experimental-account-interpolation`

This is a feature of the experimental Numscript interpreter. To run it through the API, set `runtime: experimental-interpreter` in the transaction request body (the default is `machine`) and enable the relevant feature flag. See [Selecting an Interpreter](https://docs.formance.com/v4.0/modules/numscript/interpreter) for per-feature availability.

Build account addresses dynamically by inserting variables into the address:

```numscript
#![feature("experimental-account-interpolation")]
vars {
  string $user_id
  string $type
}

send [USD/2 1000] (
  source = @world
  destination = @users:$user_id:wallets:$type
)
```

With `$user_id = "42"` and `$type = "main"`, the destination resolves to `@users:42:wallets:main`.

## Supported variable types

Account, string, and number variables can be interpolated. Each is coerced to a string and inserted into the address.

```numscript
#![feature("experimental-account-interpolation")]
vars {
  number $id
  account $org
}

send [USD/2 500] (
  source = @world
  destination = @orgs:$org:members:$id:balance
)
```

## Use cases

- Route to user-specific accounts without hardcoding addresses
- Build hierarchical account structures from transaction parameters
- Create dynamic chart-of-accounts patterns like `@orders:$order_id:payments:$payment_id`
