Skip to main content
A sample code in JavaScript to authenticate your API request:
import hmac
import hashlib
import base64
import json
from datetime import datetime, timezone

method = 'POST'
timestamp = datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%S.') + '000Z'
client_id = 'YOUR_CLIENT_ID'
hmac_secret = 'YOUR_HMAC_SECRET'
api_key = 'YOUR_API_KEY'

body = json.dumps({
    'fullName': 'Jane Smith',
    'email': 'jane.smith@yourcompany.com',
    'currency': 'USD',
    'initialFunds': 50.00
}, separators=(',', ':'))

body_hash = base64.b64encode(hashlib.sha256(body.encode()).digest()).decode()
data_to_sign = f"{method}\n{timestamp}\n{client_id}\n{body_hash}"
signature = base64.b64encode(
    hmac.new(hmac_secret.encode(), data_to_sign.encode(), hashlib.sha256).digest()
).decode()

headers = {
    'Content-Type': 'application/json',
    'x-api-key': api_key,
    'x-client-id': client_id,
    'x-timestamp': timestamp,
    'x-body-hash': body_hash,
    'x-signature': signature
}