⚡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.
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
Download the JSON file from here.
Open Postman and click on Import.

Drop the JSON file.

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

The access token will be shown in the response.

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!
Download the JSON file from here.
Open Postman and click on Import.

Drop the JSON file.

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

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

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)Last updated