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

# Dynamic Parameters

> Insert dynamic values into URLs, headers, file paths, and request bodies using placeholder syntax

Interpolation replaces placeholders with actual values at runtime, enabling integrations that adapt to different contexts, time periods, and data.

| Type                                  | Syntax                         | Use Case                          |
| ------------------------------------- | ------------------------------ | --------------------------------- |
| [Simple Variables](#simple-variables) | `{{ variableName }}`           | Insert values from parameters     |
| [DateTime](#datetime-interpolation)   | `{{ now.format(YYYY-MM-DD) }}` | Current date/time with formatting |

## When to use

Use interpolation when you need to:

* Insert parameter values into API URLs or paths
* Add dynamic dates to requests (today, yesterday, last week)
* Reference dates from extraction datapoints
* Generate file names with timestamps
* Build parameterized query strings

## Simple Variables

Replace placeholders with values from your integration's parameters. The variable name must match exactly.

```javascript theme={null}
// Input
"users/{{ userId }}/orders"
// Params
{ "userId": "123" }
// Output
"users/123/orders"
```

### Using datapoints with simple variables

To interpolate a datapoint value, add a query param with the datapoint field name. The param name becomes available as a variable.

```javascript theme={null}
// Query Params
{ "userId": "{{ userId }}" }
// Path
"users/{{ userId }}/orders"
// If datapoint has userId = "456", output becomes
"users/456/orders"
```

## DateTime Interpolation

Insert current dates, calculate relative dates, and format output for API requirements. DateTime interpolation supports three prefixes:

| Prefix   | Description            | Example                                          |
| -------- | ---------------------- | ------------------------------------------------ |
| `now`    | Current date and time  | `{{ now.format(YYYY-MM-DD) }}`                   |
| `today`  | Alias for `now`        | `{{ today.format(YYYY-MM-DD) }}`                 |
| `date()` | Date from a data field | `{{ date(order.createdAt).format(YYYY-MM-DD) }}` |

### Format Patterns

Use `.format(pattern)` to control output. Patterns follow [dayjs format tokens](https://day.js.org/docs/en/display/format).

| Pattern               | Output Example      |
| --------------------- | ------------------- |
| `YYYY-MM-DD`          | 2026-01-12          |
| `DD/MM/YYYY`          | 12/01/2026          |
| `YYYY-MM-DDTHH:mm:ss` | 2026-01-12T15:30:00 |
| `HH:mm:ss`            | 15:30:00            |
| `MMMM D, YYYY`        | January 12, 2026    |

### Timezone Conversion

Use `.timezone(tz)` to convert to a specific timezone before formatting. The default timezone is `America/Sao_Paulo`.

```javascript theme={null}
{{ now.timezone(UTC).format(YYYY-MM-DDTHH:mm:ss) }}
{{ now.timezone(America/New_York).format(YYYY-MM-DD) }}
{{ now.timezone(Europe/London).format(HH:mm:ss) }}
```

### Date Arithmetic

Add or subtract time using `.add(amount, unit)` and `.subtract(amount, unit)`.

**Available units:** `days`, `weeks`, `months`, `years`, `hours`, `minutes`, `seconds`

```javascript theme={null}
{{ now.subtract(1, days).format(YYYY-MM-DD) }} // Yesterday
{{ now.subtract(7, days).format(YYYY-MM-DD) }} // One week ago
{{ now.add(1, months).format(YYYY-MM-DD) }} // Next month
{{ now.add(2, weeks).format(YYYY-MM-DD) }} // Two weeks from now
```

### Using Data Fields

Reference dates from your extraction datapoints with the `date()` function. Pass the field path as the argument.

```javascript theme={null}
{{ date(order.createdAt).format(YYYY-MM-DD) }}
{{ date(user.lastLogin).add(30, days).format(YYYY-MM-DD) }}
{{ date(invoice.dueDate).subtract(7, days).format(YYYY-MM-DD) }}
```

This is useful when you need to calculate dates relative to data values rather than the current time.

## When a parameter is missing

If a `{{ parameter }}` referenced in a URL, header, or body has no value at runtime, the request is not sent. It fails with a clear parsing error naming the missing parameter. An empty string counts as missing: sending it would produce a malformed request (e.g. `/items//details`) that the target API would misroute instead of reject.

Parameter names are case-sensitive and must match the data field exactly.
