# Make a request

After you've created your API key, make a test request to verify that your authentication and signing setup works correctly.

## Before you begin

Before you start, make sure you have:

- An API key with the products and permissions your integration needs — see [Create an API key](/docs/guides/api-console/create-key).
- If your key has signing enabled: the private key (`private.pem`) you saved when generating signing keys.

## How it works

To make an authenticated request to the Revolut API, you need:
- The base URL for the endpoints you're calling
- Your API key
- If signing is enabled on your key, the current Unix timestamp and a signature generated from the request

The sections below explain each part, and [Make the request](#make-the-request) puts it all together into ready-to-run examples.

### Base URLs

Use the correct base URL for the endpoints you're calling and the environment you're in:

| Endpoints | Sandbox | Production |
|---|---|---|
| Business | `https://sandbox-b2b.revolut.com` | `https://b2b.revolut.com` |
| Merchant | `https://sandbox-merchant.revolut.com` | `https://merchant.revolut.com` |

<!-- TODO: Re-add Crypto Exchange and Crypto Ramp when Crypto migration is complete -->

:::tip[Sandbox vs Production]
Make sure that you test your integration in Sandbox before going live, and that you use the correct URL for each environment.
:::

### Authentication headers

Every request to the Revolut API must include an `Authorization` header with your API key.
If your [key has signing enabled](/docs/guides/api-console/create-key#how-it-works), each Production request must also include `Revolut-Api-Timestamp` and `Revolut-Api-Signature` headers.

Whether a request must be signed depends on the API key you use, not on the endpoint.
The products and permissions you select when creating the key determine whether it's created with signing keys — see [Signing requirements](/docs/guides/api-console/signing-requirements).

| Header | Required | Description |
|---|---|---|
| `Authorization` | Always | Your API key, in the format `Bearer {API_KEY}`. |
| `Revolut-Api-Timestamp` | If signing is enabled<sup>*</sup> | The current Unix timestamp in **milliseconds** (e.g., `1783616701644`). Used to prevent replay attacks. |
| `Revolut-Api-Signature` | If signing is enabled<sup>*</sup> | A Base64-encoded Ed25519 [signature](#signature-generation) of the request data. |

:::note[<sup>*</sup> Sandbox exception]
To facilitate testing, in Sandbox, requests made with a key that has signing enabled are also accepted without the `Revolut-Api-Timestamp` and `Revolut-Api-Signature` headers.
However, we strongly recommend that you test a production-like setup by including the headers.
If you include them, they must be valid.
:::

### Message construction

To generate the `Revolut-Api-Signature` header, you sign a message string constructed from your request data.
The string is a concatenation of the following values, in this specific order:

| # | Component | Notes | Example |
|---|---|---|---|
| 1 | **Timestamp** | Same value as the `Revolut-Api-Timestamp` header | `1783616701644` |
| 2 | **HTTP method** | Uppercase | `GET` |
| 3 | **Request path** | Starting from `/api`, including any path parameters | `/api/1.0/team-members` |
| 4 | **Query string** _(if present)_ | Without the `?` prefix _(empty string if none)_ | `limit=10` |
| 5 | **Request body** _(if present)_ | Minified JSON _(empty string if none)_ | `{"name":"John"}` |

:::note
Do not add any separators (spaces, newlines, or commas) between the fields.
Use an empty string for any component that's not present in your request.
:::

:::warning[URL-encode query string values in the signature]
If your request includes URL-encoded query string values (e.g., `key=hello%3Aworld`), you must use the same URL-encoded value when constructing the signature message.
Signing the raw, unencoded value (e.g., `key=hello:world`) will cause signature verification to fail.

Keep the space encoding consistent between the request and the signature message.
Some API clients encode spaces as `+` in query strings (for example, [Bruno](https://www.usebruno.com/)), others as `%20`.
Either approach is valid, provided the signature message uses the same encoding as the request.
:::

### Signature generation

To generate the `Revolut-Api-Signature` header:

1. **Construct the message string** by concatenating the present components in order, with no separators.
2. **Sign the message** using your **Ed25519 private key**.
   Ed25519 signing produces a 64-byte raw signature that is unique to both the message and the private key.
3. **Base64-encode** the raw signature bytes.

**Send the encoded value** in the `Revolut-Api-Signature` header.

::::::details[Generate the signature programmatically]

The following snippets only generate the signature and print it to the console — they don't make an API request.
Use them to verify your signature against the expected values below, or to generate a signature for a request you're building manually.
The scripts assume your private key is saved as `private.pem` in the same directory.

:::tip
For sample scripts that generate a signature and make a request, see the [Full flow](#full-flow) below.
:::

- ![$JavaScript (Node.js)]
  ```javascript {4-10} [generate-signature.js]
  const crypto = require('crypto');
  const fs = require('fs');

  // Configure your variables
  const privateKeyPath = './private.pem';
  const timestamp = '1783616701644';
  const method = 'GET';
  const path = '/api/1.0/team-members';
  const query = '';
  const body = '';

  // Generate the signature
  const privateKey = fs.readFileSync(privateKeyPath, 'utf8');
  const message = timestamp + method + path + query + body;
  const signature = crypto.sign(null, Buffer.from(message), privateKey).toString('base64');

  console.log('Message:', message);
  console.log('Revolut-Api-Timestamp:', timestamp);
  console.log('Revolut-Api-Signature:', signature);
  ```

- ![$Python]
  :::note[Prerequisites]
  [Python 3](https://www.python.org/downloads/) and the [`cryptography`](https://pypi.org/project/cryptography/) library. If you don't have it, install it with `python3 -m pip install cryptography`.
  :::

  ```python {4-10} [generate_signature.py]
  import base64
  from cryptography.hazmat.primitives import serialization

  # Configure your variables
  private_key_path = './private.pem'
  timestamp = '1783616701644'
  method = 'GET'
  path = '/api/1.0/team-members'
  query = ''
  body = ''

  # Generate the signature
  with open(private_key_path, 'rb') as f:
      private_key = serialization.load_pem_private_key(f.read(), password=None)

  message = (timestamp + method + path + query + body).encode('utf-8')
  signature = base64.b64encode(private_key.sign(message)).decode()

  print(f'Message: {timestamp + method + path + query + body}')
  print(f'Revolut-Api-Timestamp: {timestamp}')
  print(f'Revolut-Api-Signature: {signature}')
  ```

- ![$Go]
  ```go {13-19} [generate-signature.go]
  package main

  import (
      "crypto/ed25519"
      "crypto/x509"
      "encoding/base64"
      "encoding/pem"
      "fmt"
      "os"
  )

  func main() {
      // Configure your variables
      privateKeyPath := "./private.pem"
      timestamp := "1783616701644"
      method := "GET"
      path := "/api/1.0/team-members"
      query := ""
      body := ""

      // Generate the signature
      keyData, _ := os.ReadFile(privateKeyPath)
      block, _ := pem.Decode(keyData)
      key, _ := x509.ParsePKCS8PrivateKey(block.Bytes)
      ed25519Key := key.(ed25519.PrivateKey)

      message := []byte(timestamp + method + path + query + body)
      signature := base64.StdEncoding.EncodeToString(ed25519.Sign(ed25519Key, message))

      fmt.Println("Message:", string(message))
      fmt.Println("Revolut-Api-Timestamp:", timestamp)
      fmt.Println("Revolut-Api-Signature:", signature)
  }
  ```

- ![$Java]
  ```java {12-18} [GenerateSignature.java]
  import java.nio.charset.StandardCharsets;
  import java.nio.file.Files;
  import java.nio.file.Paths;
  import java.security.KeyFactory;
  import java.security.PrivateKey;
  import java.security.Signature;
  import java.security.spec.PKCS8EncodedKeySpec;
  import java.util.Base64;

  public class GenerateSignature {
      public static void main(String[] args) throws Exception {
          // Configure your variables
          String privateKeyPath = "./private.pem";
          String timestamp = "1783616701644";
          String method = "GET";
          String path = "/api/1.0/team-members";
          String query = "";
          String body = "";

          // Generate the signature
          String pem = new String(Files.readAllBytes(Paths.get(privateKeyPath)));
          String base64Key = pem
              .replace("-----BEGIN PRIVATE KEY-----", "")
              .replace("-----END PRIVATE KEY-----", "")
              .replaceAll("\\s", "");
          byte[] keyBytes = Base64.getDecoder().decode(base64Key);
          PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes);
          PrivateKey privateKey = KeyFactory.getInstance("Ed25519").generatePrivate(keySpec);

          String message = timestamp + method + path + query + body;
          Signature sig = Signature.getInstance("Ed25519");
          sig.initSign(privateKey);
          sig.update(message.getBytes(StandardCharsets.UTF_8));
          String signature = Base64.getEncoder().encodeToString(sig.sign());

          System.out.println("Message: " + message);
          System.out.println("Revolut-Api-Timestamp: " + timestamp);
          System.out.println("Revolut-Api-Signature: " + signature);
      }
  }
  ```

- ![$C#]
  :::note[Prerequisites]
  [BouncyCastle.Cryptography](https://www.nuget.org/packages/BouncyCastle.Cryptography/) NuGet package. If you don't have it, install it with `dotnet add package BouncyCastle.Cryptography`.
  :::

  ```csharp {11-17} [GenerateSignature.cs]
  using System;
  using System.IO;
  using System.Text;
  using Org.BouncyCastle.Crypto.Signers;
  using Org.BouncyCastle.Security;

  class GenerateSignature
  {
      static void Main()
      {
          // Configure your variables
          string privateKeyPath = "./private.pem";
          string timestamp = "1783616701644";
          string method = "GET";
          string path = "/api/1.0/team-members";
          string query = "";
          string body = "";

          // Generate the signature
          string pem = File.ReadAllText(privateKeyPath);
          string base64Key = pem
              .Replace("-----BEGIN PRIVATE KEY-----", "")
              .Replace("-----END PRIVATE KEY-----", "")
              .Replace("\n", "").Replace("\r", "");
          byte[] keyBytes = Convert.FromBase64String(base64Key);

          var privateKey = PrivateKeyFactory.CreateKey(keyBytes);
          var signer = new Ed25519Signer();
          signer.Init(true, privateKey);

          string message = timestamp + method + path + query + body;
          byte[] messageBytes = Encoding.UTF8.GetBytes(message);
          signer.BlockUpdate(messageBytes, 0, messageBytes.Length);
          string signature = Convert.ToBase64String(signer.GenerateSignature());

          Console.WriteLine($"Message: {message}");
          Console.WriteLine($"Revolut-Api-Timestamp: {timestamp}");
          Console.WriteLine($"Revolut-Api-Signature: {signature}");
      }
  }
  ```

::::::

### Verify your signature

You can check that your signature generation is correct by comparing your output with the expected signatures for the demo keys in this section.

::::::details[Demo keys and expected signatures]

:::warning[Demo keys — for testing only]
The following private and public keys are provided for verification purposes only.
They are not associated with any Revolut account and must not be used to authenticate real API requests.
:::

- ![$Demo private key]
  
  Use it to generate test signatures.

  ```text
  -----BEGIN PRIVATE KEY-----
  MC4CAQAwBQYDK2VwBCIEIJlVQCVDhqI3k4Z4DXDydAu7Mtzgu+EWRClctYhXn/MK
  -----END PRIVATE KEY-----
  ```

- ![$Demo public key]
  
  Use it if you want to verify the generated test signatures cryptographically. 
  See the **Verify with the public key** tip below.

  ```text
  -----BEGIN PUBLIC KEY-----
  MCowBQYDK2VwAyEAfVXbyT3go67wWlSkYAO64tC+f7bMeJ/CxrV73BnTFI8=
  -----END PUBLIC KEY-----
  ```

Using timestamp `1783616701644`, the expected signatures are:

| Request | Message | Expected signature |
|---|---|---|
| `GET /api/1.0/team-members` | `1783616701644GET/api/1.0/team-members` | `XVZerlAdz6IyfC5jidsDqJf4AO8g1dx5BwFMUwO4DmoJqXrj/Q5VPOk3pf4cJl9B9cGgBNAzao9bsv/O2ADuDg==` |
| `GET /api/1.0/team-members?limit=10` | `1783616701644GET/api/1.0/team-memberslimit=10` | `kj57qIVzIH12gfaxkxUzFOMbD/KnASmPpRx49AJdUcS+Uhpp9Iowd1fGd3kJ/iFTgADiITLUnZ1udtf7Z0LFAw==` |
| `GET /api/1.0/team-members/76969b71-a123-42dc-b874-a34688d7bba4` | `1783616701644GET/api/1.0/team-members/76969b71-a123-42dc-b874-a34688d7bba4` | `5pGo0qVGzDMXBuhf80RZs4Q04h96pxqyP5OgvUgFLO0DbLkBQrUP/M8pb1j1PNZzP7Ruj+R2iZvGBJcI5qBNAQ==` |
| `POST /api/1.0/accounting-categories` + body: `{"code":"123","name":"Office supplies"}` | `1783616701644POST/api/1.0/accounting-categories{"code":"123","name":"Office supplies"}` | `WVTwvOLip4oPPCPwyzJb/bIxAkTQoIGcPfEyDSiIj4qLYzS30kKC9du6vdV6KemGQJJ/IKFt9c/q1S1stvWvAg==` |
| `POST /api/1.0/label-groups/8b8e3a86-21c4-4b5a-9e6f-0e8f7d6c5b4a/labels` + body: `{"name":"Communications"}` | `1783616701644POST/api/1.0/label-groups/8b8e3a86-21c4-4b5a-9e6f-0e8f7d6c5b4a/labels{"name":"Communications"}` | `+EZA2SyGtIFRqm59J8qrDba1XIN4oODE5hYHNRMRQbRISNcTwCdupRLsmC13LUH/gijrDyeSNvR090HmxeZNAA==` |

If your signature matches, your implementation is correct.
If it doesn't, check that you're concatenating the components in the right order with no separators, and that your private key is in the correct format.

For complete scripts that generate the signature and make the request, see the [Full flow](#full-flow) below.

::::tip[Verify with the public key]
You can also verify a signature using the demo public key provided above and OpenSSL.

:::note[Prerequisites & troubleshooting]
This requires OpenSSL 3 or later and a bash-enabled CLI. See **Create an API key** -> [**3. Generate signing keys (if required)**](/docs/guides/api-console/create-key#3-generate-signing-keys-if-required) -> **Generate keys manually** for details and troubleshooting.
:::

1. Save the demo public key to a file named `public.pem` in your working directory.
2. Save the message string to a text file (e.g. `message.txt`) and the Base64-decoded signature to a binary file (e.g. `signature.sig`) in the same directory:

   ```bash
   echo -n "1783616701644GET/api/1.0/team-members" > message.txt
   echo -n "XVZerlAdz6IyfC5jidsDqJf4AO8g1dx5BwFMUwO4DmoJqXrj/Q5VPOk3pf4cJl9B9cGgBNAzao9bsv/O2ADuDg==" | base64 -d > signature.sig
   ```

3. Then verify the signature with OpenSSL:

   ```bash
   openssl pkeyutl -verify -pubin -inkey public.pem -rawin -in message.txt -sigfile signature.sig
   ```

Expected output: `Signature Verified Successfully`.
::::

::::::

## Make the request

Quickly verify your API key works by making a simple request from your terminal.

:::tip[Testing with Postman?]
Postman can automate request signing for you with a pre-request script, so you don't need to manually generate signatures for each request.
See [Set up Postman](/docs/guides/api-console/set-up-postman) to configure your environment.
:::

- ![Simple request - no signing]

  If your key doesn't have signing enabled, you can skip the signature and make a simple request.

  Set your environment variables:

  - ![$Business example]
    ```shell
    export API_KEY=YOUR_API_KEY
    export BASE_URL=https://sandbox-b2b.revolut.com
    ```
  
  - ![$Merchant example]
    ```shell
    export API_KEY=YOUR_API_KEY
    export BASE_URL=https://sandbox-merchant.revolut.com
    ```

  Then make the request:

  - ![$Business example]
    ```shell
    curl -X GET "${BASE_URL}/api/1.0/expenses" \
      -H "Authorization: Bearer ${API_KEY}"
    ```
  
  - ![$Merchant example]
    ```shell
    curl -X GET "${BASE_URL}/api/orders" \
      -H "Authorization: Bearer ${API_KEY}" \
      -H "Revolut-Api-Version: 2026-04-20"
    ```

    :::note
    Merchant API requests must include the current API version in the `Revolut-Api-Version` header — see the [Merchant API reference](/docs/api/merchant).
    :::

- ![Request with signing]

  If your key has signing enabled, you need to generate a signature for your request.

  Open a terminal in the directory that contains your private key and export your API key as an environment variable:

  ```shell
  export API_KEY=YOUR_API_KEY
  ```

  Then run the example that matches your environment:

  - ![$OpenSSL]

    ::::note[Prerequisites & troubleshooting]
    This requires OpenSSL 3 or later and a bash-enabled CLI. See **Create an API key** -> [**3. Generate signing keys (if required)**](/docs/guides/api-console/create-key#3-generate-signing-keys-if-required) -> **Generate keys manually** for details and troubleshooting.
    ::::

    Generate the signature and make the request:

    ```shell {1-6}
    PRIVATE_KEY=./private.pem
    BASE_URL=https://sandbox-b2b.revolut.com
    METHOD=GET
    PATH_URL=/api/1.0/team-members
    QUERY=
    BODY=

    TIMESTAMP=$(date +%s000)
    MESSAGE="${TIMESTAMP}${METHOD}${PATH_URL}${QUERY}${BODY}"
    printf '%s' "$MESSAGE" > /tmp/message.txt
    openssl pkeyutl -sign -rawin -inkey "$PRIVATE_KEY" -in /tmp/message.txt -out /tmp/signature.sig
    SIGNATURE=$(base64 < /tmp/signature.sig | tr -d '\n')
    QS=""
    [ -n "$QUERY" ] && QS="?${QUERY}"
    BODY_ARG=""
    [ -n "$BODY" ] && BODY_ARG='-H "Content-Type: application/json" -d "$BODY"'
    eval curl -s -X "$METHOD" "\"${BASE_URL}${PATH_URL}${QS}\"" \
      -H "\"Authorization: Bearer ${API_KEY}\"" \
      -H "\"Revolut-Api-Timestamp: ${TIMESTAMP}\"" \
      -H "\"Revolut-Api-Signature: ${SIGNATURE}\"" \
      $BODY_ARG
    ```

  - ![$Python]

    :::note
    For the prerequisites, see [Signature generation](#signature-generation) -> **Generate the signature programmatically**.
    :::

    Generate the signature and make the request:

    ```shell {4-12}
    python3 -c "
    import base64, os, time, subprocess
    from cryptography.hazmat.primitives import serialization
    # ── Configure your variables ──────────────────────────────────
    api_key = os.environ['API_KEY']
    private_key_path = './private.pem'
    base_url = 'https://sandbox-b2b.revolut.com'
    method = 'GET'
    path = '/api/1.0/team-members'
    query = ''
    body = ''
    # ──────────────────────────────────────────────────────────────
    with open(private_key_path, 'rb') as f:
        k = serialization.load_pem_private_key(f.read(), password=None)
    t = str(int(time.time() * 1000))
    msg = (t + method + path + query + body).encode()
    sig = base64.b64encode(k.sign(msg)).decode()
    qs = '?' + query if query else ''
    headers = ['-H', f'Authorization: Bearer {api_key}', '-H', f'Revolut-Api-Timestamp: {t}', '-H', f'Revolut-Api-Signature: {sig}']
    cmd = ['curl', '-s', '-X', method, f'{base_url}{path}{qs}'] + headers
    if body:
        cmd += ['-H', 'Content-Type: application/json', '-d', body]
    subprocess.run(cmd)
    "
    ```

## Full flow

Below are example scripts you can adapt for your integration — save, configure, and run in your preferred language.

The scripts read your API key from an environment variable.
Other request parameters are set as variables at the beginning of the script.
The scripts then construct the message, generate the signature, make the request using each language's **standard HTTP client**, and print the response.

Each script prints a summary of the request it makes — the method and URL, the body if present, and the timestamp and signature used for signing.
The cURL equivalent of the request is printed only if you uncomment the corresponding lines — useful when you want to see the exact request shape or reproduce it outside the script.

::::::details[Example scripts]
First, export your API key as an environment variable:

```shell
export API_KEY=YOUR_API_KEY
```

Then, save the script.

By default, the scripts print a summary of the request.
If you want to print what the request would look like if it were a cURL command, uncomment the corresponding lines.
The masked variant prints `API_KEY` as a **placeholder** in the `Authorization` header, so the output is safe to share and screenshare.
The variant with your real API key prints it in the `Authorization` header — only uncomment it in an environment where your credentials are safe, and don't share the output.

- ![$JavaScript (Node.js)]
  Save as `test-request.js`:

  ```javascript {4-12} [test-request.js]
  const crypto = require('crypto');
  const fs = require('fs');

  // ── Configure your variables ──────────────────────────────────
  const apiKey = process.env.API_KEY;
  const privateKeyPath = './private.pem';
  const baseUrl = 'https://sandbox-b2b.revolut.com';
  const method = 'GET';
  const path = '/api/1.0/team-members';
  const query = '';
  const body = '';
  // ──────────────────────────────────────────────────────────────

  // Generate the signature
  const privateKey = fs.readFileSync(privateKeyPath, 'utf8');
  const timestamp = Date.now().toString();
  const message = timestamp + method + path + query + body;
  const signature = crypto.sign(null, Buffer.from(message), privateKey).toString('base64');

  // Build the request
  const queryString = query ? `?${query}` : '';
  const bodyArg = body ? ` -H "Content-Type: application/json" -d '${body}'` : '';

  // Send the request
  const headers = {
    'Authorization': `Bearer ${apiKey}`,
    'Revolut-Api-Timestamp': timestamp,
    'Revolut-Api-Signature': signature,
  };
  const options = { method, headers };
  if (body) {
    headers['Content-Type'] = 'application/json';
    options.body = body;
  }

  // Build a request sample (for display only)
  const requestSample = `curl -X ${method} "${baseUrl}${path}${queryString}"` +
    ` -H "Authorization: Bearer ${apiKey}"` +
    ` -H "Revolut-Api-Timestamp: ${timestamp}"` +
    ` -H "Revolut-Api-Signature: ${signature}"${bodyArg} -s`;

  // Print a summary of the request
  console.log(`Sending: ${method} ${baseUrl}${path}${queryString}`);
  if (body) {
    console.log(`Body: ${body}`);
  }
  console.log(`Signed: timestamp=${timestamp}, signature=${signature}`);

  // Uncomment to print the request sample instead:
  // console.log(requestSample.replace(apiKey, 'API_KEY')); // API key masked — safe to share
  // console.log(requestSample); // With your real API key — run only in a safe environment.

  console.log('\n--- Response ---');
  fetch(`${baseUrl}${path}${queryString}`, options)
    .then(res => res.text())
    .then(text => console.log(text));
  ```

  Run the script:

  ```shell
  node test-request.js
  ```

- ![$Python]
  :::note[Prerequisites]
  [Python 3](https://www.python.org/downloads/) and the [`cryptography`](https://pypi.org/project/cryptography/) library. If you don't have it, install it with `python3 -m pip install cryptography`.
  :::

  Save as `test_request.py`:

  ```python {7-15} [test_request.py]
  import os
  import time
  import base64
  import urllib.request
  from cryptography.hazmat.primitives import serialization

  # ── Configure your variables ──────────────────────────────────
  api_key = os.environ['API_KEY']
  private_key_path = './private.pem'
  base_url = 'https://sandbox-b2b.revolut.com'
  method = 'GET'
  path = '/api/1.0/team-members'
  query = ''
  body = ''
  # ──────────────────────────────────────────────────────────────

  # Generate the signature
  with open(private_key_path, 'rb') as f:
      private_key = serialization.load_pem_private_key(f.read(), password=None)

  timestamp = str(int(time.time() * 1000))
  message = (timestamp + method + path + query + body).encode('utf-8')
  signature = base64.b64encode(private_key.sign(message)).decode()

  # Build the request
  query_string = f'?{query}' if query else ''
  body_arg = f' -H "Content-Type: application/json" -d \'{body}\'' if body else ''

  # Send the request
  req = urllib.request.Request(
      f'{base_url}{path}{query_string}',
      method=method,
      headers={
          'Authorization': f'Bearer {api_key}',
          'Revolut-Api-Timestamp': timestamp,
          'Revolut-Api-Signature': signature,
      },
      data=body.encode('utf-8') if body else None,
  )
  if body:
      req.add_header('Content-Type', 'application/json')

  # Build a request sample (for display only)
  request_sample = (
      f'curl -X {method} "{base_url}{path}{query_string}"'
      f' -H "Authorization: Bearer {api_key}"'
      f' -H "Revolut-Api-Timestamp: {timestamp}"'
      f' -H "Revolut-Api-Signature: {signature}"'
      f'{body_arg} -s'
  )

  # Print a summary of the request
  print(f'Sending: {method} {base_url}{path}{query_string}')
  if body:
      print(f'Body: {body}')
  print(f'Signed: timestamp={timestamp}, signature={signature}')

  # Uncomment to print the request sample instead:
  # print(request_sample.replace(api_key, 'API_KEY'))  # API key masked — safe to share
  # print(request_sample)  # With your real API key — run only in a safe environment.

  print('\n--- Response ---')
  with urllib.request.urlopen(req) as response:
      print(response.read().decode())
  ```

  Run the script:

  ```shell
  python3 test_request.py
  ```

- ![$Go]
  Save as `test-request.go`:

  ```go {17-25} [test-request.go]
  package main

  import (
      "crypto/ed25519"
      "crypto/x509"
      "encoding/base64"
      "encoding/pem"
      "fmt"
      "net/http"
      "os"
      "strconv"
      "strings"
      "time"
  )

  func main() {
      // ── Configure your variables ──────────────────────────────
      apiKey := os.Getenv("API_KEY")
      privateKeyPath := "./private.pem"
      baseUrl := "https://sandbox-b2b.revolut.com"
      method := "GET"
      path := "/api/1.0/team-members"
      query := ""
      body := ""
      // ──────────────────────────────────────────────────────────

      // Generate the signature
      keyData, _ := os.ReadFile(privateKeyPath)
      block, _ := pem.Decode(keyData)
      key, _ := x509.ParsePKCS8PrivateKey(block.Bytes)
      ed25519Key := key.(ed25519.PrivateKey)

      timestamp := strconv.FormatInt(time.Now().UnixMilli(), 10)
      message := []byte(timestamp + method + path + query + body)
      signature := base64.StdEncoding.EncodeToString(ed25519.Sign(ed25519Key, message))

      // Build the request
      queryString := ""
      if query != "" { queryString = "?" + query }
      bodyArg := ""
      if body != "" { bodyArg = ` -H "Content-Type: application/json" -d '` + body + `'` }

      // Send the request
      req, _ := http.NewRequest(method, baseUrl+path+queryString, nil)
      req.Header.Set("Authorization", "Bearer "+apiKey)
      req.Header.Set("Revolut-Api-Timestamp", timestamp)
      req.Header.Set("Revolut-Api-Signature", signature)

      // Build a request sample (for display only)
      requestSample := `curl -X ` + method + ` "` + baseUrl + path + queryString + `"` +
          ` -H "Authorization: Bearer ` + apiKey + `"` +
          ` -H "Revolut-Api-Timestamp: ` + timestamp + `"` +
          ` -H "Revolut-Api-Signature: ` + signature + `"` + bodyArg + ` -s`

      // Print a summary of the request
      fmt.Println("Sending: " + method + " " + baseUrl + path + queryString)
      if body != "" {
          fmt.Println("Body: " + body)
      }
      fmt.Println("Signed: timestamp=" + timestamp + ", signature=" + signature)

      // Uncomment to print the request sample instead:
      // fmt.Println(strings.Replace(requestSample, apiKey, "API_KEY", 1)) // API key masked — safe to share
      // fmt.Println(requestSample) // With your real API key — run only in a safe environment.

      fmt.Println("\n--- Response ---")
      resp, _ := http.DefaultClient.Do(req)
      defer resp.Body.Close()
      buf := make([]byte, 4096)
      for {
          n, _ := resp.Body.Read(buf)
          if n == 0 { break }
          fmt.Print(string(buf[:n]))
      }
      fmt.Println()
  }
  ```

  Run the script:

  ```shell
  go run test-request.go
  ```

- ![$Java]
  Save as `TestRequest.java`:

  ```java {16-24} [TestRequest.java]
  import java.nio.charset.StandardCharsets;
  import java.nio.file.Files;
  import java.nio.file.Paths;
  import java.security.KeyFactory;
  import java.security.PrivateKey;
  import java.security.Signature;
  import java.security.spec.PKCS8EncodedKeySpec;
  import java.net.URI;
  import java.net.http.HttpClient;
  import java.net.http.HttpRequest;
  import java.net.http.HttpResponse;
  import java.util.Base64;

  public class TestRequest {
      public static void main(String[] args) throws Exception {
          // ── Configure your variables ──────────────────────────
          String apiKey = System.getenv("API_KEY");
          String privateKeyPath = "./private.pem";
          String baseUrl = "https://sandbox-b2b.revolut.com";
          String method = "GET";
          String path = "/api/1.0/team-members";
          String query = "";
          String body = "";
          // ──────────────────────────────────────────────────────

          // Generate the signature
          String pem = new String(Files.readAllBytes(Paths.get(privateKeyPath)));
          String base64Key = pem
              .replace("-----BEGIN PRIVATE KEY-----", "")
              .replace("-----END PRIVATE KEY-----", "")
              .replaceAll("\\s", "");
          byte[] keyBytes = Base64.getDecoder().decode(base64Key);
          PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes);
          PrivateKey privateKey = KeyFactory.getInstance("Ed25519").generatePrivate(keySpec);

          long timestamp = System.currentTimeMillis();
          String message = timestamp + method + path + query + body;
          Signature sig = Signature.getInstance("Ed25519");
          sig.initSign(privateKey);
          sig.update(message.getBytes(StandardCharsets.UTF_8));
          String signature = Base64.getEncoder().encodeToString(sig.sign());

          // Build the request
          String queryString = query.isEmpty() ? "" : "?" + query;
          String bodyArg = body.isEmpty() ? "" : " -H \"Content-Type: application/json\" -d '" + body + "'";

          // Send the request
          HttpClient client = HttpClient.newHttpClient();
          HttpRequest.Builder reqBuilder = HttpRequest.newBuilder()
              .uri(URI.create(baseUrl + path + queryString))
              .header("Authorization", "Bearer " + apiKey)
              .header("Revolut-Api-Timestamp", String.valueOf(timestamp))
              .header("Revolut-Api-Signature", signature);

          if (method.equals("GET")) {
              reqBuilder.GET();
          } else if (body != null && !body.isEmpty()) {
              reqBuilder.method(method, HttpRequest.BodyPublishers.ofString(body));
              reqBuilder.header("Content-Type", "application/json");
          } else {
              reqBuilder.method(method, HttpRequest.BodyPublishers.noBody());
          }

          // Build a request sample (for display only)
          String requestSample = "curl -X " + method + " \"" + baseUrl + path + queryString + "\"" +
              " -H \"Authorization: Bearer " + apiKey + "\"" +
              " -H \"Revolut-Api-Timestamp: " + timestamp + "\"" +
              " -H \"Revolut-Api-Signature: " + signature + "\"" + bodyArg + " -s";

          // Print a summary of the request
          System.out.println("Sending: " + method + " " + baseUrl + path + queryString);
          if (body != null && !body.isEmpty()) {
              System.out.println("Body: " + body);
          }
          System.out.println("Signed: timestamp=" + timestamp + ", signature=" + signature);

          // Uncomment to print the request sample instead:
          // System.out.println(requestSample.replace(apiKey, "API_KEY")); // API key masked — safe to share
          // System.out.println(requestSample); // With your real API key — run only in a safe environment.

          System.out.println("\n--- Response ---");
          HttpResponse<String> response = client.send(reqBuilder.build(), HttpResponse.BodyHandlers.ofString());
          System.out.println(response.body());
      }
  }
  ```

  Run the script:

  ```shell
  javac TestRequest.java && java TestRequest
  ```

- ![$C#]
  :::note[Prerequisites]
  [BouncyCastle.Cryptography](https://www.nuget.org/packages/BouncyCastle.Cryptography/) NuGet package. If you don't have it, install it with `dotnet add package BouncyCastle.Cryptography`.
  :::

  Save as `TestRequest.cs`:

  ```csharp {12-20} [TestRequest.cs]
  using System;
  using System.IO;
  using System.Net.Http;
  using System.Text;
  using Org.BouncyCastle.Crypto.Signers;
  using Org.BouncyCastle.Security;

  class TestRequest
  {
      static async Task Main()
      {
          // ── Configure your variables ──────────────────────────
          string apiKey = Environment.GetEnvironmentVariable("API_KEY");
          string privateKeyPath = "./private.pem";
          string baseUrl = "https://sandbox-b2b.revolut.com";
          string method = "GET";
          string path = "/api/1.0/team-members";
          string query = "";
          string body = "";
          // ──────────────────────────────────────────────────────

          // Generate the signature
          string pem = File.ReadAllText(privateKeyPath);
          string base64Key = pem
              .Replace("-----BEGIN PRIVATE KEY-----", "")
              .Replace("-----END PRIVATE KEY-----", "")
              .Replace("\n", "").Replace("\r", "");
          byte[] keyBytes = Convert.FromBase64String(base64Key);

          var privateKey = PrivateKeyFactory.CreateKey(keyBytes);
          var signer = new Ed25519Signer();
          signer.Init(true, privateKey);

          string timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
          string message = timestamp + method + path + query + body;
          byte[] messageBytes = Encoding.UTF8.GetBytes(message);
          signer.BlockUpdate(messageBytes, 0, messageBytes.Length);
          string signature = Convert.ToBase64String(signer.GenerateSignature());

          // Build the request
          string queryString = string.IsNullOrEmpty(query) ? "" : "?" + query;
          string bodyArg = string.IsNullOrEmpty(body) ? "" : $" -H \"Content-Type: application/json\" -d '{body}'";

          // Send the request
          using var client = new HttpClient();
          var request = new HttpRequestMessage(new HttpMethod(method), baseUrl + path + queryString);
          request.Headers.Add("Authorization", "Bearer " + apiKey);
          request.Headers.Add("Revolut-Api-Timestamp", timestamp);
          request.Headers.Add("Revolut-Api-Signature", signature);
          if (!string.IsNullOrEmpty(body))
          {
              request.Content = new StringContent(body, Encoding.UTF8, "application/json");
          }

          // Build a request sample (for display only)
          string requestSample = $"curl -X {method} \"{baseUrl}{path}{queryString}\"" +
              $" -H \"Authorization: Bearer {apiKey}\"" +
              $" -H \"Revolut-Api-Timestamp: {timestamp}\"" +
              $" -H \"Revolut-Api-Signature: {signature}\"{bodyArg} -s";

          // Print a summary of the request
          Console.WriteLine($"Sending: {method} {baseUrl}{path}{queryString}");
          if (!string.IsNullOrEmpty(body))
          {
              Console.WriteLine($"Body: {body}");
          }
          Console.WriteLine($"Signed: timestamp={timestamp}, signature={signature}");

          // Uncomment to print the request sample instead:
          // Console.WriteLine(requestSample.Replace(apiKey, "API_KEY")); // API key masked — safe to share
          // Console.WriteLine(requestSample); // With your real API key — run only in a safe environment.

          Console.WriteLine("\n--- Response ---");
          var response = await client.SendAsync(request);
          Console.WriteLine(await response.Content.ReadAsStringAsync());
      }
  }
  ```

  Run the script:

  ```shell
  dotnet run
  ```

Example output:

```text
Sending: GET https://sandbox-b2b.revolut.com/api/1.0/team-members
Signed: timestamp=1783616701644, signature=XVZerlAdz6IyfC5jidsDqJf4AO8g1dx5BwFMUwO4DmoJqXrj/Q5VPOk3pf4cJl9B9cGgBNAzao9bsv/O2ADuDg==

--- Response ---
[
  {
    "id": "76969b71-a123-42dc-b874-a34688d7bba4",
    "first_name": "John",
    "last_name": "Doe",
    "email": "john.doe@example.com",
    "role_id": "owner",
    "state": "active",
    "created_at": "2022-09-07T09:19:31.592368Z",
    "updated_at": "2022-09-07T09:21:24.346670Z"
  }
]
```

:::tip[Change the request]
Update the `method`, `path`, `query`, and `body` variables at the top of the script to test different endpoints.
For example, to test a POST request with a body, change:

- ![$JavaScript (Node.js)]
  ```javascript
  const method = 'POST';
  const path = '/api/1.0/accounting-categories';
  const query = '';
  const body = '{"code":"123","name":"Office supplies"}';
  ```

- ![$Python]
  ```python
  method = 'POST'
  path = '/api/1.0/accounting-categories'
  query = ''
  body = '{"code":"123","name":"Office supplies"}'
  ```

- ![$Go]
  ```go
  method := "POST"
  path := "/api/1.0/accounting-categories"
  query := ""
  body := `{"code":"123","name":"Office supplies"}`
  ```

- ![$Java]
  ```java
  String method = "POST";
  String path = "/api/1.0/accounting-categories";
  String query = "";
  String body = "{\"code\":\"123\",\"name\":\"Office supplies\"}";
  ```

- ![$C#]
  ```csharp
  string method = "POST";
  string path = "/api/1.0/accounting-categories";
  string query = "";
  string body = @"{""code"":""123"",""name"":""Office supplies""}";
  ```

You can also change the [`baseUrl`](#base-urls) and `privateKeyPath` values to test with a different environment, group of endpoints, or a different signing key.
To use a different API key, set the `API_KEY` environment variable again before you run the script.
:::

::::::

## Troubleshooting

If a request is rejected, the cause is usually in the authentication or signing setup this guide covers:

| Problem | What to do |
|---|---|
| 401 Unauthorized | The API key is wrong, expired, or revoked. Check the key's status in the [API Console](https://developer.revolut.com/console). |
| Signature verification failure | The `Revolut-Api-Signature` doesn't match what the server computes. Construct the message exactly as shown in [Message construction](#message-construction) and sign it with the private key matching the key's registered public key. |
| Timestamp rejected | Requests are rejected when the `Revolut-Api-Timestamp` is too far from the current time. Make sure your system clock is accurate and synchronised (e.g., via NTP), and that the timestamp is in milliseconds. |
| IP rejected | The request comes from an IP address that's not on the key's IP allowlist. See [Configure an IP allowlist](/docs/guides/api-console/manage-key-permissions#configure-an-ip-allowlist). |

Use the :Menu: **API logs** view in the API Console to inspect the requests you sent, their status, and failure reasons.
For endpoint-specific errors (invalid parameters, missing permissions, and similar), see the error handling documentation of the respective API reference.

## Verify your requests in the Business Sandbox

Go to [Test your integration with Revolut Sandbox](/docs/guides/api-console/test-with-sandbox) to check the results of your Business or Merchant requests in the [Revolut Business Sandbox](https://sandbox-business.revolut.com) app.

## What's next

- [Manage API key settings](/docs/guides/api-console/manage-key-permissions): Update key permissions, configure IP allowlisting, and manage signing keys.
- [Rotate an API key](/docs/guides/api-console/rotate-api-key): Replace an API key without downtime.
- [Set up Postman](/docs/guides/api-console/set-up-postman): Automate request signing with a pre-request script.
- See the API reference for:
  - [Merchant endpoints](/docs/api/merchant)
  - [Business endpoints](/docs/api/business)
  <!-- TODO: Re-add Crypto Exchange and Crypto Ramp when Crypto migration is complete
  - [Crypto Exchange endpoints](/docs/api/revolut-x-crypto-exchange)
  - [Crypto Ramp endpoints](/docs/api/crypto-ramp)
  -->
- For step-by-step tutorials on specific features and workflows, browse the guides:
  - [Merchant: Accept payments](/docs/guides/merchant/introduction)
  - [Business: Manage accounts](/docs/guides/manage-accounts/introduction)