Variables

Manage and reuse values across API testing workflows with Static, Dynamic, and Extracted Variables. Securely store sensitive values, generate test data automatically, and pass values between dependent requests in Request Builder and Request Chain.

Variables allow you to manage and reuse values across your API testing workflows. Optraflow supports Static, Dynamic, and Extracted Variables to simplify API testing and automation across workspaces. Variables can be used in Request Builder and Request Chain, allowing you to avoid repeatedly entering the same values and making it easier to build reusable API workflows.

Key capabilities

  • Create and manage static variables.
  • Generate dynamic test data automatically.
  • Extract values from API responses and reuse them in subsequent requests.
  • Reuse variables across Request Builder and Request Chain.
  • Securely store sensitive values such as passwords and API keys.
  • Use variables without installing additional plugins or extensions.
  • Maintain reusable test data at the workspace level.

Types of variables

Optraflow supports three types of variables:

Variable TypePrefixPurpose
Static VariableS_Stores a fixed value that can be reused across requests.
Dynamic VariableD_Generates values dynamically using predefined functions.
Extracted VariableE_Stores a value extracted from an API response for reuse in subsequent requests.

1. Static Variables

Static variables are used when you need to reuse a fixed value across multiple API requests.

  1. 1

    Open Variables

    Open the Variables panel.

  2. 2

    Click Add Variable

    Start creating a new variable.

  3. 3

    Enter the variable name

    Give the variable a descriptive name.

  4. 4

    Enter the variable value

    Provide the fixed value to store.

  5. 5

    Optionally provide a description

    Add context for other users on the workspace.

  6. 6

    Click Save

    Static variables use the S_ prefix.

If you create a variable named S_username, you can use it in a Request Builder or Request Chain as {{S_username}}. This allows the same value to be reused across multiple requests without entering it manually each time.

Secure storage of secrets

Sensitive values such as passwords, API keys, and secret tokens can be stored securely as variables. Once a secret is stored:

  • The secret value cannot be viewed or retrieved from the browser.
  • The value can be updated when required, but the existing secret cannot be displayed.
  • Secrets are stored securely in the database using encryption.
  • The secret is decrypted only on the server when it is required for request execution.

This helps protect sensitive authentication and API credentials while still allowing them to be used during API testing.

Your secrets remain protected while still being available to the automation engine when required.

2. Dynamic Variables

Dynamic variables allow you to generate test data automatically instead of maintaining fixed values. This is especially useful when APIs require unique or changing data for every test execution.

  1. 1

    Open Variables

    Open the Variables panel.

  2. 2

    Click Add Variable

    Start creating a new variable.

  3. 3

    Enter the variable name

    Give the variable a descriptive name.

  4. 4

    Select the required dynamic function

    Choose the function that should generate the value.

  5. 5

    Optionally provide a description

    Add context for other users on the workspace.

  6. 6

    Click Save

    Dynamic variables use the D_ prefix.

Depending on the supported functions, dynamic variables can generate values such as a random email, first name, address, or other dynamically generated test data. For example, D_randomEmail can be used in a request as {{D_randomEmail}} — each execution can generate a new value based on the selected dynamic function.

Why use dynamic variables?

Dynamic variables are particularly useful when testing APIs that require unique data. For example, when testing a registration API, using the same email address repeatedly may cause the API to return a duplicate email error. Instead, you can use a dynamic email variable — {{D_randomEmail}} — to repeatedly test the registration flow with dynamically generated test data, without manually creating a new email address for every test.

No plugin or additional installation is required. Simply create the dynamic variable and use it in your API requests.

3. Extracted Variables

Extracted variables are values captured from an API response and reused in subsequent requests. They are primarily used in Request Chains to pass data from one API request to another. Extracted variables use the E_ prefix.

A login API returns:

json·login response
{
  "token": "abc123",
  "userId": "1001"
}

You can extract the token and use it in a subsequent request as {{E_token}}. For example:

text
Login API
    ↓
Extract token
    ↓
E_token
    ↓
Get User API

This eliminates the need to manually copy values from one API response into another request.


Using variables in requests

Variables can be referenced in both Request Builder and Request Chain.

text
{{S_variableName}}

Variables can be used wherever supported, including request data such as:

  • URL
  • Query parameters
  • Headers
  • Request body
  • Authentication
  • Other request parameters

Example: API registration testing

Suppose you want to repeatedly test a user registration API. Instead of manually changing the email for every execution, you can use a dynamic variable:

json
{
  "name": "John",
  "email": "john@example.com"
}

During execution, Optraflow generates the required value automatically. This makes it easy to run the same test repeatedly with different test data.

Example: login and authenticated API

Variables can also be used to build an authenticated API workflow:

text
Login API
    ↓
Extract authentication token
    ↓
E_token
    ↓
Use E_token in Authorization
    ↓
Get User API
    ↓
Create Order API

This allows authentication data to flow automatically between dependent requests.


Variables across the workspace

Variables provide a reusable way to manage test data across your API testing workflows. The same variables can be used across supported Request Builder and Request Chain workflows, reducing duplication and making API automation easier to maintain.

No-code test data and variable management

Variables eliminate the need to manually maintain or copy values between requests. You can:

Create → Reuse → Generate → Extract → Pass → Execute

without writing custom scripts.


Core value proposition

Optraflow Variables make API automation easier by allowing you to securely manage reusable values, generate dynamic test data, and automatically pass extracted values between API requests — all without plugins or custom scripting.