
# Postman


> Instructions for importing API collections into Postman and authenticating requests.
### How to set up the authentication in [Postman](https://www.postman.com/downloads/)?

1. You need to set two variables to your environment `clientKey`and `clientSecret`containing the two API Keys ([How to create the API Keys?](/docs/rest-api/authentication.md#api-keys))
   
   ![](/images/uploads/environments.png)
2. Set the following header to the request:
   
   The variables hmacTimestamp and hmacSignature are generated on the fly by the following Pre-request script.
   
   ![](/images/uploads/headers.png)
3. Copy this script to the “Pre-request Script” Tab of the request (or of the [collection](https://learning.postman.com/docs/writing-scripts/pre-request-scripts/#re-using-pre-request-scripts)):
   
   ```
   const crypto = require('crypto-js');
   
   // Helper
   function interpolate (str) {
       return str.replace(/{{([^}]+)}}/g, function (match, $1) {
           return pm.variables.get($1);
       });
   }
   
   var url = interpolate(pm.request.url.toString()),
       clientKey = pm.variables.get("clientKey"),
       clientSecret = pm.variables.get("clientSecret"),
       timestamp = Math.floor(Date.now() / 1000),
       method = pm.request.method
       body = pm.request.body ? pm.request.body.toString() : "";
   
   var signPayload = [method, url, body, timestamp],
       signature = crypto.HmacSHA256(signPayload.join("\n"), clientSecret).toString()
   
   pm.variables.set("hmacTimestamp", timestamp);
   pm.variables.set("hmacSignature", signature);
   ```
