Example of how to send data to the API by reading from HTML inputs
const formData = new FormData();
formData.append('fullname', document.getElementById('fullname').value);
formData.append('governmentIdImg', document.getElementById('governmentIdImg').files[0]);
formData.append('selfie', document.getElementById('selfie').files[0]);
fetch('/verify-identity', {
method: 'POST',
body: formData
})
.then(response => response.json())
.then(data => {
console.log(data);
})
.catch(error => {
console.error(error);
});
The API endpoint returns a JSON response with the following structure:
{
"success": true,
"message": "Identity verified!"
}
If the API fails to match the person’s face or full name on the ID card, it will return success being false
.