Important scripts required in postman to set environment variable value 1. if response is in xml and want to set value then first need to convert in JSON var responseJson = xml2Json(responseBody); pm.environment.set("osession", responseJson.oAuthResponse.access_token); 2.if response is in XML and key: value pair is in array var jsonData = pm.response.json(); postman.setEnvironmentVariable('lastModifiedDate',jsonData.entryPointConfiguration[0].lastModified.date); 3. If want to set environment variable from JSON response. var jsonData = pm.response.json(); postman.setEnvironmentVariable('conversationId',jsonData.id);