API Integration
You can use this API to create new sessions or get existing session link
Generate hmac signature
const crypto = require('crypto');
const generateHmac = (httpMethod, url, body, contentType, xAuthClient, secretKey) => {
const requestUrl = new URL(url);
const requestPath = requestUrl.pathname;
const queryParams = requestUrl.searchParams.toString();
const dataToHash = `${httpMethod}\n${requestPath}\n${queryParams}\n${xAuthClient}\n${contentType}\n${body}`;
const hmac = crypto.createHmac('sha256', secretKey);
hmac.update(dataToHash);
return hmac.digest('hex');
};
let httpMethod = "POST";
const url = "https://start.faceverify.ai/api/v1/session";
const body = JSON.stringify({
country: country,
uniqueIdentifier,
});
const contentType = "application/json";
//xAuthClient is your apiKey
const xAuthClient = "xxx-xxx-xxx-xxx-xxx"
const secretKey = "xxx-xxx-xxx-xxx-xxx";
const hmacSignature = generateHmac(httpMethod,url,body,contentType,xAuthClient,secretKey);
console.log(hmacSignature);
Creates a new session to initiate the face verification process. The request must include an HMAC signature for security purposes.
Header parameters
x-auth-clientstringRequiredExample:
API key for client authentication. This key is provided to the client during integration setup.
xxx-xxx-xxx-xxx-xxx
x-hmac-signaturestringRequiredExample:
HMAC signature for request validation. The signature is generated using the above process.
xxx-xxx-xxx-xxx-xxx
Body
countrystringOptionalExample:
The country code for the verification session.
US
uniqueIdentifierstringOptionalExample:
A unique identifier for the user or session.
user123
Responses
200
Successful response with the session URL.
application/json
500
Internal Server Error
application/json
400 - case 1
Bad Request
application/json
400 - case 2
Bad Request
application/json
400 - case 3
Bad Request
application/json
400 - case 4
Bad Request
application/json
post
const response = await fetch('https://start.faceverify.ai/api/v1/session', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-auth-client': 'xxx-xxx-xxx-xxx-xxx',
'x-hmac-signature': 'xxx-xxx-xxx-xxx-xxx'
},
body: JSON.stringify({
country: 'US',
uniqueIdentifier: 'user123'
})
});
const data = await response.json();
console.log(data);
{
"success": true,
"data": {
"sessionId": "session123",
"baseUrl": "https://start.faceverify.ai",
"Token": "eyJhbGciOi..",
"url": "https://start.faceverify.ai/new/eyJhbGciOiJIUzI1NiIsIn..."
}
}
Last updated