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
  • 1) Prerequisites
  • 2) Setting up
  • 2.1) Generate a token
  • 3) Hit your first API request!

Quick Guide

Welcome to the Valify API integration guide. This section provides a step-by-step guide to integrating Valify services into your application using our API.

PreviousIntroductionNextAPIs

Last updated 1 year ago


1) Prerequisites

  • Authentication token: This can be generated through our auth API.

  • Bundle Key: This will be found in the email you received upon signup.

2) Setting up

2.1) Generate a token

for more details about OAuth Token go to:OAuth Token

  1. Download the JSON file from here.

  1. Open Postman and click on Import.

  1. Drop the JSON file.

  1. Choose "Access Token" as shown below and update the "Body" with your credentials then click "Send".

  2. The access token will be shown in the response.

Please note that the token can be used within 10 minutes and needs to be generated again.

Copy this code and put your credentials to easily generate the access token.

r = requests.post("https://www.valifystage.com/api/o/token/",
        data={
            'username': '<username>', 
            'password': '<password>', 
            'client_id': '<client id>',  
            'client_secret': '<client secret>', 
            'grant_type': 'password' #default value no need to change
        }
    )

token=r.json()['access_token']

3) Hit your first API request!

  1. Download the JSON file from here.

  1. Open Postman and click on Import.

  1. Drop the JSON file.

  1. Click on "Egy NID OCR" then click on "Authorization" and replace the <access token> field with your access token and then click on "Body".

  1. After clicking on "Body", fill in the required fields then click Send.

NID OCR
import requests
import base64
import json

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

front_image = base64_encode('<image path>')#Put your front image path here
back_image = base64_encode('<image path>') #Put your back image path here
token = "<token>"

r = requests.post("https://www.valifystage.com/api/o/token/",
        data={
            'username': '<username>', #Put all your credentials in those fields
            'password': '<password', 
            'client_id': '<client_id>',  
            'client_secret': '<client_secret>', 
            'grant_type': 'password'
        }
    )

token=r.json()['access_token']

data = {
    'document_type': 'egy_nid', 
    'data':
    {   
        'front_img': front_image,
        'back_img': back_image,
        'verify_document':'false',
        'bundle_key': '<bundle key>', # Put your bundle key here
        'lang': '<lang>' 
    }
}

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

result = r.json()
print(result)

Please check all the comments in the code and replace with the required data.

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
1KB
Valify - EGY NID OCR v1.4.postman_collection
1KB
Access Token.postman_collection