Environment Variables

Environment Variables in Requestly allow you to configure API requests based on different environments—such as Development, Staging, or Production. They help you manage environment-specific values like base URLs, tokens, or credentials without manually editing each request when switching contexts.

Why Use Environment Variables?

Environment variables let you:

  • Switch between Dev, Staging, and Prod configurations easily

  • Avoid editing request details manually for each environment

  • Keep secrets scoped to the environment where they’re needed

  • Enable environment-specific behavior in scripts and tests

Example use cases:

How to Create Environment Variables

Step 1: Access the Environments Tab

Click on the Environments tab in the side menu.

Step 2: Select an Environment

Select the environment you want to add variables to.

Step 3: Add Variables

Add variables in the table by specifying the following details:

  • Key: The name of the variable that you will be referencing when sending requests. Note, an environment cannot have keys with the same name.

  • Type: The type of value the variable will store. It can be a stringnumber, or boolean.

  • Initial value (synced): Initial values will be synced across the workspace. These values will be used by default if no user-defined Current value is set for the variable.

  • Current value (local): Current values are user-defined entries that are not synced across the workspace. These values will override the defined Initial values. If the current value is empty or left blank, then the initial value of the variable will be used.

Step 4: Switch Environments

To switch environments, use the dropdown on the top bar of the API Client’s sidebar. Select the desired environment to ensure that the variables associated with it are used in your API requests.

Updated on