# Using variables in API request

Learn how to use variables in your test suite payloads effectively.

## Selecting Environment and Using Variables

1. From your test suite, select the appropriate environment:

![Variables Message](env-select.png)

2. Define variables through the Variables button:

![Variables Interface](add-var.png)

## Variable Setup

When setting up variables:

1. Click the Variables button.
2. Add required variables using the Add Variable button.
3. Fill in both key and value:

![Add Variable Interface](add-var-info.png)

## Variable Syntax

To use the variables in your payload, the syntax should be like this `"{{<variable_name>}}"` :

![](variable-input.png)

## Testing with Variables

- Ensure all required variables are defined before running tests.
- The system will indicate if any variables are missing.
- Tests cannot be executed until all required variables are defined.
- You can see test execution status and results in the test suite view.

## Best Practices

- Always verify that required variables are defined.
- Use consistent variable references across test cases.
- Keep variable values up to date.
- Document any special requirements or dependencies.

## Error Handling

If you see an undefined variable warning:
1. Note the variable names listed in the warning.
2. Open the Variables drawer.
3. Add any missing variables.
4. Verify that all required variables are properly defined.
