PHP SDK Reference

CoreAPI

Table of Contents

$apiendpoint  : mixed
$apikey  : mixed
$config  : mixed
$defaultconfig  : mixed
enableAuthentication()  : null
Validate the document to check whether the document is authentic and has not been tampered, and set authentication module
enableBarcodeMode()  : null
Disable Visual OCR and read data from AAMVA Barcodes only
enableDualsideCheck()  : null
Check if the names, document number and document type matches between the front and the back of the document when performing dual-side scan. If any information mismatches error 14 will be thrown.
enableImageOutput()  : null
Generate cropped image of document and/or face, and set output format [url, base64]
enableVault()  : null
Save document image and parsed information in your secured vault. You can list, search and update document entries in your vault through Vault API or web portal.
init()  : null
Initialize Core API with an API key and optional region (US, EU)
resetConfig()  : null
Reset all API configurations except API key and region.
restrictCountry()  : null
Check if the document was issued by specified countries, if not error code 10 will be thrown. Separate multiple values with comma. For example "US,CA" would accept documents from United States and Canada.
restrictState()  : null
Check if the document was issued by specified state, if not error code 11 will be thrown. Separate multiple values with comma. For example "CA,TX" would accept documents from California and Texas.
restrictType()  : null
Check if the document was one of the specified types, if not error code 12 will be thrown. For example, "PD" would accept both passport and drivers license.
scan()  : array<string|int, mixed>
Scan an ID document with Core API, optionally specify document back image, face verification image, face verification video and video passcode
setAccuracy()  : null
Set OCR Accuracy
setBiometricThreshold()  : null
Set the minimum confidence score to consider faces being identical
setOCRImageResize()  : null
Scale down the uploaded image before sending to OCR engine. Adjust this value to fine tune recognition accuracy on large full-resolution images. Set 0 to disable image resizing.
setVaultData()  : null
Add up to 5 custom strings that will be associated with the vault entry, this can be useful for filtering and searching entries.
verifyAddress()  : null
Check if supplied address matches with document.
verifyAge()  : null
Check if the document holder is aged between the given range.
verifyDOB()  : null
Check if supplied date of birth matches with document.
verifyDocumentNumber()  : null
Check if supplied document or personal number matches with document.
verifyExpiry()  : null
Check if the document is still valid based on its expiry date.
verifyName()  : null
Check if supplied name matches with document.
verifyPostcode()  : null
Check if supplied postcode matches with document.

Properties

$apiendpoint

private mixed $apiendpoint = ""

$defaultconfig

private mixed $defaultconfig = array("accuracy" => 2, "authenticate" => false, "authenticate_module" => 1, "ocr_scaledown" => 1500, "outputimage" => false, "outputface" => false, "outputmode" => "url", "dualsidecheck" => false, "verify_expiry" => true, "verify_documentno" => "", "verify_name" => "", "verify_dob" => "", "verify_age" => "", "verify_address" => "", "verify_postcode" => "", "country" => "", "region" => "", "type" => "", "checkblocklist" => "", "vault_save" => "", "vault_saveunrecognized" => "", "vault_noduplicate" => "", "vault_automerge" => "", "vault_customdata1" => "", "vault_customdata2" => "", "vault_customdata3" => "", "vault_customdata4" => "", "vault_customdata5" => "", "barcodemode" => false, "biometric_threshold" => 0.4)

Methods

enableAuthentication()

Validate the document to check whether the document is authentic and has not been tampered, and set authentication module

public enableAuthentication([bool $enabled = false ][, mixed $module = 2 ]) : null
Parameters
$enabled : bool = false

Enable/Disable Document Authentication

$module : mixed = 2

Module: 1, 2 or quick

Tags
throws
Exception
Return values
null

enableBarcodeMode()

Disable Visual OCR and read data from AAMVA Barcodes only

public enableBarcodeMode([bool $enabled = false ]) : null
Parameters
$enabled : bool = false

Enable/Disable Barcode Mode

Return values
null

enableDualsideCheck()

Check if the names, document number and document type matches between the front and the back of the document when performing dual-side scan. If any information mismatches error 14 will be thrown.

public enableDualsideCheck([bool $enabled = false ]) : null
Parameters
$enabled : bool = false
Return values
null

enableImageOutput()

Generate cropped image of document and/or face, and set output format [url, base64]

public enableImageOutput([bool $cropDocument = false ][, bool $cropFace = false ][, string $outputFormat = "url" ]) : null
Parameters
$cropDocument : bool = false

Crop document

$cropFace : bool = false

Crop face

$outputFormat : string = "url"

url/base64

Tags
throws
Exception
Return values
null

enableVault()

Save document image and parsed information in your secured vault. You can list, search and update document entries in your vault through Vault API or web portal.

public enableVault([bool $enabled = true ][, bool $saveUnrecognized = false ][, bool $noDuplicateImage = false ][, bool $autoMergeDocument = false ]) : null
Parameters
$enabled : bool = true

Enable/Disable Vault

$saveUnrecognized : bool = false

Save document image in your vault even if the document cannot be recognized.

$noDuplicateImage : bool = false

Prevent duplicated images from being saved.

$autoMergeDocument : bool = false

Automatically merge images with same document number into a single entry inside vault.

Return values
null

init()

Initialize Core API with an API key and optional region (US, EU)

public init(string $apikey[, string $region = "US" ]) : null
Parameters
$apikey : string

You API key

$region : string = "US"

US/EU

Return values
null

resetConfig()

Reset all API configurations except API key and region.

public resetConfig() : null
Return values
null

restrictCountry()

Check if the document was issued by specified countries, if not error code 10 will be thrown. Separate multiple values with comma. For example "US,CA" would accept documents from United States and Canada.

public restrictCountry([string $countryCodes = "US,CA,UK" ]) : null
Parameters
$countryCodes : string = "US,CA,UK"

ISO ALPHA-2 Country Code separated by comma

Return values
null

restrictState()

Check if the document was issued by specified state, if not error code 11 will be thrown. Separate multiple values with comma. For example "CA,TX" would accept documents from California and Texas.

public restrictState([string $states = "CA,TX" ]) : null
Parameters
$states : string = "CA,TX"

State full name or abbreviation separated by comma

Return values
null

restrictType()

Check if the document was one of the specified types, if not error code 12 will be thrown. For example, "PD" would accept both passport and drivers license.

public restrictType([string $documentType = "DIP" ]) : null
Parameters
$documentType : string = "DIP"

P: Passport, D: Driver's License, I: Identity Card

Return values
null

scan()

Scan an ID document with Core API, optionally specify document back image, face verification image, face verification video and video passcode

public scan(string $document_primary[, string $document_secondary = "" ][, string $biometric_photo = "" ][, string $biometric_video = "" ][, string $biometric_video_passcode = "" ]) : array<string|int, mixed>
Parameters
$document_primary : string

Front of Document (File path or URL)

$document_secondary : string = ""

Back of Document (File path or URL)

$biometric_photo : string = ""

Face Photo (File path or URL)

$biometric_video : string = ""

Face Video (File path or URL)

$biometric_video_passcode : string = ""

Face Video Passcode (4 Digit Number)

Tags
throws
Exception
Return values
array<string|int, mixed>

setAccuracy()

Set OCR Accuracy

public setAccuracy([int $accuracy = 2 ]) : null
Parameters
$accuracy : int = 2

0 = Fast, 1 = Balanced, 2 = Accurate

Return values
null

setBiometricThreshold()

Set the minimum confidence score to consider faces being identical

public setBiometricThreshold([float $threshold = 0.4 ]) : null
Parameters
$threshold : float = 0.4

float between 0 to 1

Tags
throws
Exception
Return values
null

setOCRImageResize()

Scale down the uploaded image before sending to OCR engine. Adjust this value to fine tune recognition accuracy on large full-resolution images. Set 0 to disable image resizing.

public setOCRImageResize([int $maxScale = 1500 ]) : null
Parameters
$maxScale : int = 1500

0 or 500~4000

Tags
throws
Exception
Return values
null

setVaultData()

Add up to 5 custom strings that will be associated with the vault entry, this can be useful for filtering and searching entries.

public setVaultData([string $data1 = "" ][, string $data2 = "" ][, string $data3 = "" ][, string $data4 = "" ][, string $data5 = "" ]) : null
Parameters
$data1 : string = ""

Custom data field 1

$data2 : string = ""

Custom data field 2

$data3 : string = ""

Custom data field 3

$data4 : string = ""

Custom data field 4

$data5 : string = ""

Custom data field 5

Return values
null

verifyAddress()

Check if supplied address matches with document.

public verifyAddress([string $address = "123 Sample St, California, US" ]) : null
Parameters
$address : string = "123 Sample St, California, US"

Address requiring validation

Return values
null

verifyAge()

Check if the document holder is aged between the given range.

public verifyAge([string $ageRange = "18-99" ]) : null
Parameters
$ageRange : string = "18-99"

Age range, example: 18-40

Tags
throws
Exception
Return values
null

verifyDOB()

Check if supplied date of birth matches with document.

public verifyDOB([string $dob = "1990/01/01" ]) : null
Parameters
$dob : string = "1990/01/01"

Date of birth in YYYY/MM/DD

Tags
throws
Exception
Return values
null

verifyDocumentNumber()

Check if supplied document or personal number matches with document.

public verifyDocumentNumber([string $documentNumber = "X1234567" ]) : null
Parameters
$documentNumber : string = "X1234567"

Document or personal number requiring validation

Tags
throws
Exception
Return values
null

verifyExpiry()

Check if the document is still valid based on its expiry date.

public verifyExpiry([bool $enabled = false ]) : null
Parameters
$enabled : bool = false

Enable/Disable expiry check

Return values
null

verifyName()

Check if supplied name matches with document.

public verifyName([string $fullName = "ELON MUSK" ]) : null
Parameters
$fullName : string = "ELON MUSK"

Full name requiring validation

Tags
throws
Exception
Return values
null

verifyPostcode()

Check if supplied postcode matches with document.

public verifyPostcode([string $postcode = "90001" ]) : null
Parameters
$postcode : string = "90001"

Postcode requiring validation

Return values
null

Search results