This is a simple script that will generate an API signature for any Publitio API call via Postman


let API_KEY = "YOUR API KEY HERE"
let API_SECRET = "YOUR API SECRET HERE"

let rand = String(Math.floor(Math.random() * (99999999 - 10000000 + 1)) + 10000000)
let timestamp = String(Math.floor(Date.now() / 1000))
let signature = timestamp.concat(rand, API_SECRET) 
signature = CryptoJS.SHA1(signature).toString()
let query = "?api_key=" + API_KEY + "&api_nonce=" + rand + "&api_signature=" + signature + "&api_timestamp=" + timestamp
postman.setEnvironmentVariable("api_signature", query);


You can add this script to the "Pre-request script" tab in your Postman request,
change the API_KEY and API_SECRET values to the ones on your dashboard api settings.
And now you can make any call with the {{api_signature}} parameter like so:


https://api.publit.io/v1/files/list{{api_signature}}


This script will make a fresh API signature every time a request is sent so you will always be authenticated to Publitio API.