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 (Two Images)
  • Integration
  1. APIs
  2. Face Match

Face Match (Two Images)


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 (Two Images)

POST https://valifystage.com/api/v1/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.

second_img

string

A base64-encoded face image.

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 ""

first_img = base64_encode('<image path>')
second_img = base64_encode('<image path>')
token = '<token>'
data = {
        'first_img': first_img,
        'second_img': second_img,
        'bundle_key': '<bundle key>', # Place your bundle key here
        'lang': '<lang>' # optional
}

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

PreviousFace MatchNextFace Match (Image & Transaction ID)

Last updated 1 year 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
2MB
Documentation - Face Match (2 images) (v1).postman_collection
Face Match (2 images)