title: Accessing Collection Variables in Postman
body: <p><strong>Feature</strong></p>
  <p>Postman added support for variables, authorization, pre-request and test scripts to collections.<br />
  (As of version 5.4.1 this exists at both the collection AND the folder level.)</p>
  <p><strong>Use case</strong></p>
  <p>Let's say I want to store a refresh token when the login endpoint is hit. My test script needs to create/update a COLLECTION variable, NOT a global or environment variable.</p>
  <p>Once that refresh token is available to the collection, other tests and pre-request scripts, I would think there is a way to access them through an API similar to <em>pm.environment</em> or <em>pm.globals</em>. (pm.collection, for instance)</p>
  <p><strong>Question</strong></p>
  <p>I cannot find any documentation on how to access or modify those via pre-request scripts, or tests... Does anyone know how to do this? Maybe this hasn't been thought out completely, or not fully implemented, but I thought I would check with others for some help.</p>
  <p><strong>Temporary Solution</strong></p>
  <p>As a complete hack, I am storing the things I need as namespaced environment variables. It's not ideal (makes things kind of messy when working in other collections) but it works just fine.</p>