Postman is a third-party product not owned by Revolut. This guide is provided for convenience only, and Revolut doesn't guarantee that the Postman features described will continue to work in the same way or at all. For detailed instructions, see the Postman documentation.
Postman is one of the industry-standard tools for testing APIs. To make testing easier, Revolut provides Postman collections for the Business and Merchant APIs.
This guide explains how to configure a collection with Bearer Token auth and an optional pre-request script that handles request signing automatically, so you don't need to generate signatures for each request. You can either import a Revolut collection or create your own from the Revolut API schemas.
For security reasons, use a dedicated API key for testing instead of your Production key.
How it works
Postman signs each request automatically using a pre-request script attached to your collection.
The script reads your private key from an environment variable, constructs the signing message, generates the signature, and injects the Revolut-Api-Timestamp and Revolut-Api-Signature headers.
For API keys without signing, you only need Bearer Token auth – no script required.
Before you begin
Before you start, make sure you have:
- An API key created in the API Console. If you don't have one yet, see Create an API key.
- Postman installed.
- If your API key has signing enabled: your
private.pemfile saved on your machine. - A Revolut Postman collection added to your Postman client.
Set up Postman
1. Create an environment
Create a new Postman environment with the following variables.
The url value depends on which endpoints you're calling and whether you're using Sandbox or Production.
If you use both the Business and Merchant endpoints, create separate environments for each.
| Variable | Type | Value |
|---|---|---|
url | default |
|
api_key | secret | Your API key copied from the API Console. |
private_key | secret | Required only if you've added a signing key. The entire contents of your private.pem file, including the -----BEGIN PRIVATE KEY----- and -----END PRIVATE KEY----- lines. Do not add any new lines. |
If you don't have auto-save enabled, click Save.
2. Set up authentication
- Open your Postman collection settings.
- In the Authorization tab, set the Auth Type to Bearer Token and set the token to
{{api_key}}. - For each endpoint in your collection, in the Authorization tab, make sure that it inherits the Bearer Token from the parent collection. See the Postman documentation for more details.
3. Add the signing script
Whether you need request signing depends on your API key, not on the endpoints you call — see Signing requirements.
If your API key has a signing key attached, add a pre-request script to your collection as follows.
- The script only signs requests when a
private_keyvariable is present, so you can add it regardless of your key type. - The script reads the variables with
pm.variables.get(), so it resolves them from any scope – environment, collection, or global. - If a variable is defined in multiple scopes, the environment value takes precedence.
- The same collection works with both signing and non-signing keys.
In the Scripts tab, select Before request (or Pre-request, depending on your version) and paste the following script:
function interpolate(value) {
const { Property } = require('postman-collection');
return Property.replaceSubstitutions(value, pm.variables.toObject());
}
async function signEd25519(message, pemPrivateKey) {
const pemContents = pemPrivateKey
.replace(/-----BEGIN PRIVATE KEY-----/g, '')
.replace(/-----END PRIVATE KEY-----/g, '')
.replace(/\\n/g, '')
.replace(/\s+/g, '');
const binaryDerString = atob(pemContents);
const binaryDer = new Uint8Array(binaryDerString.length);
for (let i = 0; i < binaryDerString.length; i++) {
binaryDer[i] = binaryDerString.charCodeAt(i);
}
const importedKey = await crypto.subtle.importKey(
"pkcs8",
binaryDer.buffer,
{ name: "Ed25519" },
false,
["sign"]
);
const signatureBuffer = await crypto.subtle.sign(
{ name: "Ed25519" },
importedKey,
new TextEncoder().encode(message)
);
return btoa(String.fromCharCode(...new Uint8Array(signatureBuffer)));
}
const apiKey = pm.variables.get("api_key")?.trim();
const privateKey = pm.variables.get("private_key")?.trim();
if (apiKey && privateKey) {
const timestamp = Date.now().toString();
const method = pm.request.method.toUpperCase();
const url = new URL(interpolate(pm.request.url.toString()));
const path = url.pathname || "/";
const query = url.searchParams.toString();
let body = "";
if (method !== "GET" && pm.request.body && pm.request.body.raw) {
const rawBody = interpolate(pm.request.body.raw);
try {
body = JSON.stringify(JSON.parse(rawBody));
} catch {
body = rawBody;
}
}
const message = timestamp + method + path + query + body;
const signature = await signEd25519(message, privateKey);
// Override the URL and body so the values sent match the values signed
pm.request.url.update(url.origin + path + (query ? "?" + query : ""));
if (body) {
pm.request.body.update({
mode: "raw",
raw: body,
options: { raw: { language: "json" } }
});
}
pm.request.headers.upsert({ key: "Revolut-Api-Timestamp", value: timestamp });
pm.request.headers.upsert({ key: "Revolut-Api-Signature", value: signature });
}If you don't have auto-save enabled, click Save.
You're all set! Your collection is now configured to make authenticated requests to the Revolut API.
Tips and troubleshooting
For security reasons, use a dedicated API key for testing in Postman instead of your Production API key.
If your Postman environment is shared or compromised, the private_key variable can be extracted and used to sign requests on your behalf.
Make sure that individual endpoints inherit the Bearer Token from the parent collection instead of overriding it.
See the Postman documentation for more details.
The collection-level Bearer Token auth handles the Authorization header automatically.
If you're using the signing script, it also handles the Revolut-Api-Timestamp and Revolut-Api-Signature headers.
Overriding auth settings on individual endpoints can cause authentication errors.
Newer Postman versions save changes automatically, but in older versions, changes must be saved manually. If your Postman doesn't auto-save, make sure to save after pasting the script — unsaved settings show an orange dot on the tab next to the collection name, and unsaved changes are not applied.
When using POST or PUT requests, format the body as raw JSON.
Avoid adding code comments (// or /* */) in the request body – they break JSON parsing.
The script automatically minifies the body before signing, so the signature matches the actual payload sent.
What's next
- Manage API key settings: Update key permissions, configure IP allowlisting, and manage signing keys.
- Rotate an API key: Replace an API key without downtime.
- See the API reference for: