# How to create a variable automatically increment by 1 after every request in postman

**URL:** <https://community.postman.com/t/how-to-create-a-variable-automatically-increment-by-1-after-every-request-in-postman/44245>\
**Category:** Help Hub\
**Tags:** variables\
**Created:** [February 21, 2023, 3:29am UTC](https://community.postman.com/t/how-to-create-a-variable-automatically-increment-by-1-after-every-request-in-postman/44245 "2023-02-21T03:29:53Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [February 21, 2023, 9:35am UTC](https://community.postman.com/t/how-to-create-a-variable-automatically-increment-by-1-after-every-request-in-postman/44245/2 "2023-02-21T09:35:57Z")

</div>

You’ll need to store the value in variable. (Collection or Environment).

You then update your request to use the variable value. {{variableName}}, similar to how you’ve got the random variable set.

In the Tests tab for the request, you will then retrieve the variable, increment it by one and then resave it.

```auto
let myVar = pm.collectionVariables.get("variableName");
myVar ++ // increment by 1
pm.collectionVariables.set("variableName", myVar);

```

[Using variables | Postman Learning Center](https://learning.postman.com/docs/sending-requests/variables/)

---

_[View the full topic](https://community.postman.com/t/how-to-create-a-variable-automatically-increment-by-1-after-every-request-in-postman/44245)._
