# Is there a way to tell if a request is being made from Collection Runner, or Monitor?

**URL:** <https://community.postman.com/t/is-there-a-way-to-tell-if-a-request-is-being-made-from-collection-runner-or-monitor/12081>\
**Category:** Help Hub\
**Tags:** tests, variables, collections\
**Created:** [April 20, 2020, 4:34pm UTC](https://community.postman.com/t/is-there-a-way-to-tell-if-a-request-is-being-made-from-collection-runner-or-monitor/12081 "2020-04-20T16:34:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cptvitamin](https://avatars.discourse-cdn.com/v4/letter/c/8c91f0/32.png) [@cptvitamin](https://community.postman.com/u/cptvitamin)\
**Post date:** [April 20, 2020, 4:34pm UTC](https://community.postman.com/t/is-there-a-way-to-tell-if-a-request-is-being-made-from-collection-runner-or-monitor/12081/1 "2020-04-20T16:34:13Z")

</div>

Sorry if I missed this, but I couldn’t find anything in documentation. Is there a way to tell if a request is being made directly from inside Postman, or some other direct method, or if its being run from Collection Runner, or a Monitor? Is there some variable that would indicate this? Basically, I would run different tests if I knew it was being run from within Collection Runner.

---

<div class="post-metadata">

**Author:** ![SabriH](https://avatars.discourse-cdn.com/v4/letter/s/9fc348/32.png) [@SabriH](https://community.postman.com/u/SabriH)\
**Post date:** [April 20, 2020, 8:05pm UTC](https://community.postman.com/t/is-there-a-way-to-tell-if-a-request-is-being-made-from-collection-runner-or-monitor/12081/2 "2020-04-20T20:05:14Z")

</div>

Hey @cptvitamin,

Welcome to the community!

I’ll be happy to help. I don’t believe there is an out-of-the-box variable that you’d be able to access to differentiate. However, the following should help:

You could always create a variable in your Environment, e.g. `runType` and set its initial value to `monitor` ( To sync with the server when running your monitor and make sure the value is picked up )

You would then export that Environment as a JSON and then change the value of `runType` locally to `newman` for example. You could then use Newman to run your collection with the `--environment` being the JSON file you explored with the `newman` value.

I’m assuming your familiar with writing test scripts, considering your question is that correct? If not, I’d suggest reading the following: [https://learning.postman.com/docs/postman/scripts/test-scripts/#writing-test-scripts](https://learning.postman.com/docs/postman/scripts/test-scripts/#writing-test-scripts).

You could then do something like the following in your tests:

```auto
if(pm.environment.get("runType") === "monitor"){
   
pm.test("Status code is 200", function () {
    pm.response.to.have.status(200);
});
}

```

Hopefully, this helps. And welcome again!

---

<div class="post-metadata">

**Author:** ![Dotnet\_Mob](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/dotnet_mob/32/31520_2.png) [@Dotnet\_Mob](https://community.postman.com/u/Dotnet_Mob)\
**Post date:** [February 4, 2025, 10:38am UTC](https://community.postman.com/t/is-there-a-way-to-tell-if-a-request-is-being-made-from-collection-runner-or-monitor/12081/3 "2025-02-04T10:38:38Z")

</div>

`if(pm.info.iterationCount>1){}` is helpful when you set iteration count as more than 1.

see the details : [javascript - How to know if a request is running from collection in test script? - Stack Overflow](https://stackoverflow.com/a/79411341/4133590)
