Documentation
  • Introduction
  • ⚡Quick Guide
  • APIs
    • 🇦🇪UAE Resident ID OCR
    • 🔑OAuth Token
    • 🆔National ID OCR
      • 🔁API Response
    • 🧑‍💼Face Match
      • Face Match (Two Images)
      • Face Match (Image & Transaction ID)
    • ✈️Passport
    • ✈️Libyan passport
    • 🚗Car License
    • ↔️Transliteration
      • National ID Transliteration
      • Commercial Register Translation
      • Names Transliteration
    • 🏫Know Your Business (eKYB)
      • 📖Data Extraction & Verifications
        • Egyptian Commercial Register ID OCR
          • ✅With Verification
        • Egyptian Tax Card OCR
    • 📄Valify Sanction Shield
      • Sanction Shield v2.1.0
    • Sanction Shield v2.0.0
    • 🛡️Supported lists
    • ❓Transaction Inquiry
    • 📷Fetch Images
    • 🔒OTP
      • 📲Send Phone OTP
      • ✅Verify Phone OTP
      • 📥Send Email OTP
      • ✅Verfiy Email OTP
    • Response Data Validation
  • Error Codes
    • Valify Error Codes
    • HTTP Codes
  • References
Powered by GitBook
On this page
  • Face Match (Image & Transaction ID)
  • Integration
  1. APIs
  2. Face Match

Face Match (Image & Transaction ID)


Instead of sending two images, you can provide one face image and the Transaction ID of a valid Data Extraction service transaction, so we can compare the face from this transaction's document with the face image provided. The transaction ID can be found in the data extraction API response.

You can use the Face Match service by providing two face images to be compared. The result will be "True" if similar or "False" if not.

Face Match (Image & Transaction ID)

POST https://valifystage.com/api/v1.1/face/match/

Headers

Name
Type
Description

Content-Type

string

application/json

Authentication

string

Bearer <access-token>

Request Body

Name
Type
Description

first_img

string

A base64-encoded face image.

transaction_id

string

An ID of a successful Data Extraction transaction

bundle_key

string

A bundle key provided to you by Valify.

lang

string

The preferred language for the error messages.

{
    'result': {
        'is_similar': '<bool>', 
         'confidence': '<float>'
     }, 
     'transaction_id': '<str>', 
     'trials_remaining': '<int>'
 }
{
    "message": "Bad Request – invalid request received (e.g. missing Bundle key, required parameters or invalid json) | Make sure all the required parameters are included"
}
{
    "message": "Unauthorized – your Bundle key is invalid"
}
{
    "message": "Forbidden – specified access_token could not be found"
}
{
    "message": "Not Found"
}
{
    "message": "Unsupported Media Type"
}
{
    "message": "<error-description>",
    "error_code": <valify-error-code>
}
{
    "message": "Internal Server Error"
}

Integration

  1. Download the JSON file.

  1. Open Postman and click on Import.

  1. Drop the JSON file.

  1. Click on "Face Match" then click on "Authorization" and replace the <access token> field with your access token and then click on "Body".

  1. Click on "Face Match" then "Body" and fill in the required fields then click on "Send".

import requests
import base64

def base64_encode(file_name):
    with open(file_name, "rb") as image_file:
        encoded_string = base64.b64encode(image_file.read()).decode()
        return encoded_string
    return ""

face_img = base64_encode('<image path>')
token = '<token>'
data = {
        'first_img': face_img,
        'transaction_id': '<transaction id>', # Place the transaction ID here
        'bundle_key': '<bundle key>', # Place your bundle key here
        'lang': 'en'
}

r = requests.post("https://valifystage.com/api/v1/face/match/",
        json=data,
        headers={'Authorization': 'Bearer %s' % token}
    )
                      
print(r.json())

PreviousFace Match (Two Images)NextPassport

Last updated 1 month ago

Please note that the front and back images should be converted to base 64 format. This can be done via an online tool;

🧑‍💼
https://base64.guru/converter/encode/image/jpg
975B
Documentation - Face Match (image & transaction ID) (v1).postman_collection
Face Match (2 images)