{
"endUserId": 20001, // Optional: Provide one user identifier only
"endUserEmail": "joe@example.com", // Optional: Alternative to endUserId and externalUserId
"externalUserId": "user-10021", // Optional: Alternative to endUserId and endUserEmail
"transactionId": "98765",
"counterparty": {
"firstName": "Acme",
"lastName": "Private Limited",
"type": "company"
},
"emailCode": "123456",
"googleAuthCode": "654321",
"timestamp": 1700000000000,
"nonce": "f67d664b-f60c-472a-9433-505f8450bb87"
}
import crypto from 'crypto';
import axios from 'axios';
const apiKey = 'your-api-key';
const apiSecret = 'your-api-secret';
const requestBody = {
endUserId: 20001, // Optional: Provide one user identifier only
endUserEmail: "joe@example.com", // Optional: Alternative to endUserId and externalUserId
externalUserId: "user-10021", // Optional: Alternative to endUserId and endUserEmail
transactionId: '2144884',
counterparty: {
firstName: 'Joe',
lastName: 'Doe',
type: 'individual'
},
emailCode: '538940',
googleAuthCode: '915461',
timestamp: Date.now(),
nonce: crypto.randomBytes(8).toString('hex')
};
const raw = JSON.stringify(requestBody);
const signature = crypto.createHmac('sha256', apiSecret).update(raw).digest('hex');
const headers = {
'x-tlp-apikey': apiKey,
'x-tlp-signature': signature,
'Content-Type': 'application/json'
};
axios.post('https://api.tylt.money/whitelabel/compliance/travelRule/addCounterparty', raw, { headers })
.then(response => console.log(response.data))
.catch(error => console.error('Error:', error.response ? error.response.data : error.message));