Storing Variables and Using them in API Requests

Updated by Adnan Pandjou

In many cases, it might be useful to make several API requests in succession where we use data obtained from one request & feed it into another request. Such examples may include registering a new user & obtaining an authentication token for subsequent requests, or placing an order and retrieving the order details for further processing, and so on.  

With Sofy’s API Step you can store data obtained from one step and use it across multiple API steps by passing it the variable in the body, header, query parameter or as a path variable. Here’s how you can do it. 

Using variables in the Body of an API request

  1. Send an API request & evaluate the Response obtained. Here, we send a POST request to for registering a new user: 
  2. From the Response obtained store the variable which you wish to use across API steps by clicking on the “+” icon next to it & defining a name for it. For our example, we will store the “token” obtained in the response and call it “userToken”: 
  3. Next, we will try to use this stored variable across the next API step. Here, we will try to create a profile for this user. For this, we send a POST request to and send the token obtained from previous API request in the Request Body: 
  4. Once we send the request & add the API Step, we will observe that a successful Response may be received indicating that the stored variable was used successfully: