Authorization header

Needed for each API request

Step-by-step guide

On every request you have to set a header parameter "Authorization". Thus we proof that the request came from you and wasn’t changed in transit. So you sign the exact request body with a secret derived from your API key, and send that in the Authorization header. Our system do the same calculation on our side and checks that the results match.

You need below credentials from Evrotrust ([email protected]):

  • API key (secret)
  • Vendor Number (your unique company ID, which goes inside the JSON body)
Step 1: Build and serialize the JSON body

e.g: {"vendorNumber":"xxXxxX...","user":{"identificationNumber":"9000000000"}}

Send this exact string as the request body. If your HTTP library re-serializes the object differently (extra spaces, different key order), the signature won’t match.

Step 2: Hash your API key with SHA-256, keeping the raw bytes

The result is a 32-byte binary digest.

Step 3: Compute HMAC-SHA256 over the JSON body

Use the raw digest from Step 2 as the key and the UTF-8 bytes of the JSON string from Step 1 as the message.

Step 4: Hex-encode the HMAC result

Convert the output to a 64-character lowercase hex string. This is the only hex conversion in the whole process.

Step 5: Send the request with Authorization

Send the request with Authorization:

Your authorization header checklist

  • Algorithm: HMAC-SHA256
  • HMAC key: SHA-256 of the Vendor API Key, as the raw 32-byte digest (not the 64-character hex string)
  • HMAC message: the request body as raw UTF-8 JSON (do not hex-encode or Base64-encode it first).
  • Output: the HMAC result as a 64-character lowercase hex string.
  • Header: sent as Authorization:
  • Same body: the exact string you signed is the exact string you send. Serialize once and reuse it; don’t let your HTTP client re-serialize the object.
  • New signature per request: any change to the body (including whitespace or key order) requires recalculating the header.

Example (values are masked, use it only for reference):

const crypto = require("crypto");

const apiKey = "7f4b...";
const body = '{"vendorNumber":"ahZ...","user":{"identificationNumber":"90..."}}';
const expected = "5a90...";

const key = crypto.createHash("sha256").update(apiKey).digest();
const authorization = crypto.createHmac("sha256", key).update(body, "utf8").digest("hex");

console.assert(authorization === expected, "Authorization header mismatch");
import hashlib, hmac

api_key = "7f4b..."
body = '{"vendorNumber":"ahZ...","user":{"identificationNumber":"90..."}}'
expected = "5a90..."

key = hashlib.sha256(api_key.encode()).digest()
assert hmac.new(key, body.encode("utf-8"), hashlib.sha256).hexdigest() == expected