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

# Variables

> Read named values defined on the Python asset, and overwrite them per run with execute parameters.

Store API keys, connection details, or other configuration on the Python asset's **Variables** step. Values are stored encrypted. Anyone with edit access to this asset can retrieve them in the script. Your script reads them with the SDK.

```python theme={null}
api_key = less.get_variable("API_KEY")
```

`less.get_variable(name)` returns the value for that name. If the variable is not defined on this asset (and was not passed as an execute parameter), it raises `less.LessException` and stops the script.

```python theme={null}
variables = less.get_variables()
api_key = variables["API_KEY"]
```

`less.get_variables()` returns a dict of every variable on this asset.

Add variables in Less when you create or edit the Python asset: **Variables** step → **Add variable**. Names must be unique and use letters, numbers, and underscores (for example `API_KEY`).

## Overwrite with parameters

When you start a run with the [public API](/api-reference/endpoint/executeAsset), you can send `parameters` in the request body. Those values overwrite matching Variables for that run — the same as sources and models. Extra parameter keys that are not on the Variables step are included.

```python theme={null}
# Variables step has start_date = "2025-01-01"
# Execute request passed parameters: {"start_date": "2026-01-01"}
start_date = less.get_variable("start_date")  # "2026-01-01"
```

Use `less.get_variable()` / `less.get_variables()` for the overlayed values used for the run.

To inspect only the execute payload — without Variables-step values — use `less.get_parameter()` / `less.get_parameters()`.

```python theme={null}
parameters = less.get_parameters()
start_date = less.get_parameter("start_date")
```

`less.get_parameter(name)` raises `less.LessException` if that name was not in the execute request. Local runs have no job, so `get_parameters()` returns an empty dict until the script runs on Less as part of a job.

```bash theme={null}
curl -X POST "$LESS_API_URL/public/v1/assets/$ASSET_ID/execute" \
  -H "Authorization: Bearer $API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"jobSource":"API","parameters":{"start_date":"2026-01-01"}}'
```
