What is {{$guid}} used for in Postman?

GUID is the acronym for "Globally Unique Identifier". A GUID is mainly used to produce hexadecimal digits with groups separated by hyphens for uniqueness purposes, for example:

b3d27f9b-d21d-327c-164e-7fb6776f87b0

In postman you can use this to generate and send a random GUID to your api as required:

{
    "id": "{{$guid}}",
}

On Send would produce(with the random example above):

{
    "id": "b3d27f9b-d21d-327c-164e-7fb6776f87b0",
}

For random generator use the below code in pre-Request

var text="shipment";
var charset = "abcdefghijklmnopqrstuvwxyz0123456789";
    for( var i=0; i < 8; i++ )
        text += charset.charAt(Math.floor(Math.random() * charset.length));    
postman.setEnvironmentVariable("awb", text);

for detailed explanation follow below link

http://jmeterblogb.blogspot.in/2016/10/how-to-automate-rest-api-in-postman.html


In case you are looking to generate a V4 guid which you want to set as an environment variable, which can then be used across your collection, you may do something like this in your pre-request script:

var uuid = require('uuid');
postman.setEnvironmentVariable('guid', uuid.v4());

You may then use the environment variable guid across multiple calls in your collection. This becomes useful when you want to generate a guid once for an entire collection and need it to be constant across multiple requests.

If you want the guid to be generated for every request, you may directly use {{$guid}} in your payload like the other answers have explained.

Based on this interesting answer by Osloan in github: https://github.com/postmanlabs/postman-app-support/issues/886