DEV Community

Cover image for Sharing Variables Across Workspaces in Requestly
Dinesh Thakur for Requestly

Posted on • Originally published at requestly.com

Sharing Variables Across Workspaces in Requestly

When you’re working on different projects at once, it can be tricky to keep track of things like secret keys, user IDs, or special links. You might have workspaces for each project. But what if you need to use the same piece of information, like a login key, across all of them?

Copying and pasting is slow and you might make mistakes. Requestly has a cool feature to help with this, called Runtime Variables.

What Are Runtime Variables?

Think of Runtime Variables as temporary sticky notes for your work in Requestly. They are simple bits of information that you can create and use anywhere.

They have two key features:

  1. They Work Everywhere: If you create a runtime variable once you can use it in any workspace right away.
  2. You Can Save Them for Later: Usually, these “sticky notes” disappear when you close Requestly. But you can toggle them to “Persist”, which saves them for the next time you open the app.

How do runtime variables work?

The most important thing to know is that Runtime Variables have the highest precendence in Requestly. If another variable has the same name, the Runtime Variable will always be used instead.

Here’s how Requestly decides which variable to use, from most powerful to least powerful:

  1. Runtime Variables
  2. Environment Variables (Info for a specific setup, like “Testing”)
  3. Collection Variables (Info for a specific folder of requests)
  4. Global Variables (General info)

For example: Let’s say you have a saved link called {{baseURL}} that points to a test website. But for a quick test, you need to use a server running on your own computer.

Instead of changing your saved settings, you can just create a Runtime Variable also named {{baseURL}} and point it to your local server (like http://localhost:3000). Now, all your workspaces will use your local server. When you’re done, just delete the runtime variable, and everything goes back to normal!

How to Use Them

Getting started is easy.

  1. In Requestly, go to the API Client. And click on Runtime Variables tab on the side.

Runtime variables - Requestly API Client

  1. In the variables table, click + Add More and enter the variable details:
    • Key – The variable name (e.g., session_id).
    • Value – The value you want to store.
    • Type – Select from String, Number, Boolean, or Secret.
    • Persistent – Toggle whether the variable should be saved across app restarts.
      • Yes → Keeps its value after restarting the app.
      • No → Clears itself automatically on restart.

Add New Variable - Requestly API Client

That’s it! Now you can use {{session_id}} in any request in any of your workspace.

Some Cool Ways to Use Them

  • Login Keys: When you get a login key that expires soon, save it as a runtime variable. All your workspaces can now use that same key.
  • Testing with Different Users: Need to see how your app works for a specific person? Just create a runtime variable like {{userID}} and pop in their ID to test across all your workspaces.
  • Switching Features On/Off: If you’re testing a new feature that can be turned on or off with a special value, put that value in a runtime variable. This makes it super easy to flip the feature on or off everywhere at once.
  • Using Multiple Workspaces at Once: Requestly lets you open several workspaces side-by-side. Runtime Variables are perfect for this! If you update a variable like {{userID}}, the change happens everywhere instantly. This is super helpful for testing how different parts of your app work together at the same time.

  • Using Multiple Workspaces at Once: Requestly lets you open several workspaces side-by-side. Runtime Variables are perfect for this! If you update a variable like {{userID}}, the change happens everywhere instantly. This is super helpful for testing how different parts of your app work together at the same time.

Top comments (0)