Skip to main content

Using Postman with our API


Before you start, make sure that you have:

  • Changelly API keys
  • A Postman account

1. Get jsrsasign library used for signing

  1. Create a new GET request.
  2. Copy to the URL field.
  3. Go to the Scripts tab, select Post-response section and enter::
    postman.setGlobalVariable("jsrsasign-js", responseBody);
  4. Send the request.

This step is essential for sending authorized requests to our API. Once completed, the outcome of the GET request is stored in a global variable, which is subsequently employed in the pre-request scripts used for authorization.

2. Add a pre-request script

  1. Create a new POST request.
  2. Go to the Pre-request Script tab.
  3. Insert the following script and replace the placeholders (yourPrivateKey, yourApiKey) with your actual keys:
    const navigator = {}; //fake a navigator object for the lib
    const window = {}; //fake a window object for the lib

    const privateKeyString = 'yourPrivateKey';

    const key = new RSAKey();

    const sig = new KJUR.crypto.Signature({"alg": "SHA256withRSA"});
    const signature = hextob64(sig.signString(pm.request.body.raw));

    key: 'x-api-key',
    value: 'yourApiKey'

    key: 'x-api-signature',
    value: signature

    postman.setEnvironmentVariable('x-api-key', 'yourApiKey')
    postman.setEnvironmentVariable('x-api-signature', signature)
  4. Set the API URL in the URL field and specify the body data in the Body tab using the raw mode.
  5. Send the request to make sure that Postman is now able to send requests to our API.