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

# Parameters

> Passing data in, extracting data out, and using dynamic values in automations

Parameters control data flow in Optexity automations. They enable you to run the same automation with different inputs and capture outputs for use in subsequent steps.

## Parameter Types

| Type                   | Purpose                            | When Set             | Example Use                     |
| ---------------------- | ---------------------------------- | -------------------- | ------------------------------- |
| `input_parameters`     | Data you provide                   | Before execution     | Username, search queries        |
| `generated_parameters` | Data extracted during execution    | During automation    | Order IDs, confirmation numbers |
| `secure_parameters`    | Sensitive data from secure storage | Retrieved at runtime | Passwords, API keys, TOTP codes |

## Defining Parameters

All parameters must be declared in the automation's `parameters` object:

```json theme={null}
{
  "parameters": {
    "input_parameters": {
      "username": ["example_username"],
      "search_queries": ["query1", "query2"]
    },
    "secure_parameters": {
      "password": [{
        "onepassword": {
          "vault_name": "vault",
          "item_name": "login",
          "field_name": "password"
        }
      }]
    },
    "generated_parameters": {
      "order_ids": []
    }
  }
}
```

<Warning>
  Values must always be lists: `["value"]` not `"value"`.
</Warning>

## Accessing Parameters

Use `{variable_name[index]}` syntax to reference values:

| Syntax               | Use Case               | Example              |
| -------------------- | ---------------------- | -------------------- |
| `{username[0]}`      | First (or only) value  | Single email address |
| `{items[1]}`         | Second value           | Specific list item   |
| `{order_ids[index]}` | Current loop iteration | In `for_loop_node`   |

### Where Substitution Works

| Field                 | Example                       |
| --------------------- | ----------------------------- |
| `input_text`          | `"{email[0]}"`                |
| `prompt_instructions` | `"Click order {order_id[0]}"` |
| `command`             | `get_by_text("{item[0]}")`    |
| `xpath`               | `//td[text()='{id[0]}']`      |
| `select_values`       | `["{country[0]}"]`            |
| `task` (agentic)      | `"Search for {query[0]}"`     |

## Input Parameters

Values provided before execution. Declare placeholder values in the automation; actual values are passed in the inference request.

**In automation:**

```json theme={null}
"input_parameters": {
  "family_name": ["placeholder"],
  "first_name": ["placeholder"]
}
```

**In inference request:**

```json theme={null}
"input_parameters": {
  "family_name": ["Smith"],
  "first_name": ["John"]
}
```

## Generated Parameters

Values extracted during execution. Initialize as empty lists; they're populated by extraction actions.

```json theme={null}
"generated_parameters": {
  "order_ids": [],
  "confirmation": []
}
```

Populate using `output_variable_names` in extraction actions:

```json theme={null}
{
  "extraction_action": {
    "llm": {
      "extraction_format": { "order_ids": "List[str]" },
      "extraction_instructions": "Extract all order IDs from the table",
      "output_variable_names": ["order_ids"]
    }
  }
}
```

After extraction, use `{order_ids[index]}` in subsequent actions or iterate with `for_loop_node`.

<Info>
  Only `str` and `List[str]` types can be stored as variables. Other types can be extracted but won't be available for substitution.
</Info>

## Secure Parameters

Sensitive values retrieved from secure storage at runtime. Never hardcode passwords in automations.

### 1Password Integration

```json theme={null}
"secure_parameters": {
  "password": [{
    "onepassword": {
      "type": "raw",
      "vault_name": "my_vault",
      "item_name": "my_login",
      "field_name": "password"
    }
  }]
}
```

### TOTP Codes

Generate 2FA codes from a TOTP secret:

```json theme={null}
"secure_parameters": {
  "auth_code": [{
    "totp": {
      "totp_secret": "BASE32SECRET"
    }
  }]
}
```

Or retrieve TOTP secret from 1Password:

```json theme={null}
"secure_parameters": {
  "auth_code": [{
    "onepassword": {
      "type": "totp_secret",
      "vault_name": "vault",
      "item_name": "login",
      "field_name": "totp_secret",
      "digits": 6
    }
  }]
}
```

<Tip>
  See [1Password Integration](/docs/advanced/onepassword) and [TOTP Integration](/docs/advanced/totp-integration) for setup instructions.
</Tip>

## Loop Index Variable

In `for_loop_node`, use `{variable[index]}` for the current iteration value:

```json theme={null}
{
  "type": "for_loop_node",
  "variable_name": "product_ids",
  "nodes": [{
    "type": "action_node",
    "interaction_action": {
      "click_element": {
        "command": "get_by_text(\"{product_ids[index]}\")",
        "prompt_instructions": "Click product {product_ids[index]}"
      }
    }
  }]
}
```

If `product_ids = ["PROD-1", "PROD-2", "PROD-3"]`:

* Iteration 1: `{product_ids[index]}` → `"PROD-1"`
* Iteration 2: `{product_ids[index]}` → `"PROD-2"`
* Iteration 3: `{product_ids[index]}` → `"PROD-3"`

## Complete Example

This automation logs in, extracts order IDs, and processes each order:

```json theme={null}
{
  "url": "https://orders.example.com",
  "parameters": {
    "input_parameters": {
      "username": ["admin@example.com"]
    },
    "secure_parameters": {
      "password": [{
        "onepassword": {
          "type": "raw",
          "vault_name": "vault",
          "item_name": "orders",
          "field_name": "password"
        }
      }]
    },
    "generated_parameters": {
      "order_ids": []
    }
  },
  "nodes": [
    {
      "type": "action_node",
      "interaction_action": {
        "input_text": {
          "command": "get_by_label(\"Email\")",
          "input_text": "{username[0]}"
        }
      }
    },
    {
      "type": "action_node",
      "interaction_action": {
        "input_text": {
          "command": "get_by_label(\"Password\")",
          "input_text": "{password[0]}"
        }
      }
    },
    {
      "type": "action_node",
      "interaction_action": {
        "click_element": {
          "command": "get_by_role(\"button\", name=\"Sign In\")"
        }
      }
    },
    {
      "type": "action_node",
      "extraction_action": {
        "llm": {
          "extraction_format": { "order_ids": "List[str]" },
          "extraction_instructions": "Extract all order IDs",
          "output_variable_names": ["order_ids"]
        }
      }
    },
    {
      "type": "for_loop_node",
      "variable_name": "order_ids",
      "nodes": [{
        "type": "action_node",
        "interaction_action": {
          "click_element": {
            "command": "get_by_text(\"{order_ids[index]}\")",
            "prompt_instructions": "Click order {order_ids[index]}"
          }
        }
      }]
    }
  ]
}
```

## Best Practices

| Practice                              | Example                           |
| ------------------------------------- | --------------------------------- |
| Use descriptive names                 | `patient_date_of_birth` not `dob` |
| Use placeholder values in automation  | `["placeholder@test.com"]`        |
| Pass real values in inference request | Actual user credentials           |
| Initialize generated params as empty  | `"order_ids": []`                 |
| Always use lists                      | `["value"]` not `"value"`         |
