Skip to main content

SDK Methods

create

Description:

You need to call this method before using the SDK. It will return an instance of it

Parameters:

NameTypeDescription
apiKeystringapi key
apiURLstringapi URL
langstringLanguage (en or es)
encryptbooleanIndicates the use of encryption (default: false)
translationsobjectThe object with the translations. (Ask support) (optional)
opencvURLstringThe URL of opencv (optional)
facefinderURLbooleanThe URL of facefinder (optional)

Returns

  • Object:

    The SDK instance

Example:

// Get onBoarding instance
const onBoarding = OnBoarding.create({
apiKey: "myApiKey",
apiURL: "myApiURL",
lang: "en",
});
// You can save it on a global variable
var onBoarding = OnBoarding.create({ apiKey: "myApiKey", apiURL: "myApiURL" });

// use the instance
onBoarding.createSession(countryCode).then((token) => {
// save token
});

createSession

Description:

Initializes new onboarding session.

Parameters:

NameTypeDescription
countryCodestringit can be 'US' OR 'MX'.
externalIdstring (optional)Any ID
optionsObjectobject (optional)Check Options seccions

Options:

NameTypeDescription
interviewIdstringThe interviewId for other session. If you send this param you are not gonna create a new session, it's gonna use the one in interviewId.
configurationIdstringThe flow (configuration) id. If you send this param the thresholds, checks, autoapprove, etc of the flow will be used.
customFieldsobjectThe object containing the customField

Returns:

The access token

  • Object:

    JSON object

Example:

// Get token
onBoarding.createSession(countryCode).then(token => {
// save token
...
});

Or with async function

// Get session
const session = await onBoarding.createSession(countryCode);
const token = session.token;
const interviewId = session.interviewId;

With an interviewId

const session = await onBoarding.createSession("MX", null, {
interviewId: "5ec49fd49999999999999f1e",
});

publishKeys

Description:

Send encryption information that will be sent in every intercepted call.

Parameters:

NameTypeDescription
tokenstringCiti side generated token.

Returns:

  • Object:

    JSON object

  • JSON example:

    {
    "success": true
    }

Example:

onBoarding.publishKeys(token);

addDeviceFingerprint

Description:

Send information device from which method is called.

Parameters:

NameTypeDescription
tokenstringaccess token to be used in all other methods.
deviceTypestring("IOS", "ANDROID", "WEBAPP")
ipstringIP from user

Returns:

  • Object:

    JSON object

Example:

// Get token
onBoarding.addDeviceFingerprint({ token, deviceType, ip, hash }).then(token => {
// save token
...
});

addPhone

Description:

Add phone to interview. If customer with that phone already exists, error will be thrown.

Parameters:

NameTypeDescription
tokenstringaccess token to be used in all other methods.
phonestringcustomer's phone

Returns:

  • Object:

    JSON object

  • JSON example:

    {
    "success": true
    }

Example:

onBoarding.addPhone({ token, phone }).then((res) => res);

addGeolocation

Description:

Send location to store in database, or send coordinates and fetch location and store it. Longitude and latitude fields are mandatory, location field is optional.

Parameters:

NameTypeDescription
tokenstringaccess token to be used in all other methods.
latitudestringlatitude
longitudestringlongitude

Returns:

  • Object:

    JSON object

  • JSON example:

    {
    "location": "Belgrade, Serbia"
    }

Example:

onBoarding.addGeolocation({ token, latitude, longitude }).then((res) => res);

sendGeolocation

Description:

This is almost the same as addGeolocation with the difference this it's gonna ask the user automatically for the coordinates.

Parameters:

NameTypeDescription
tokenstringaccess token to be used in all other methods.

Returns:

  • Object:

    JSON object

  • JSON example:

    {
    "location": "Belgrade, Serbia"
    }

Example:

onBoarding.sendGeolocation({ token }).then((res) => res);

addSignature

Description:

Upload signature image (as byte array) and store data. Make sure to put header 'Content-Type: image/jpeg'

Parameters:

NameTypeDescription
tokenstringaccess token to be used in all other methods.
imageobjectsignature as image

Returns:

  • Object:

    JSON object

  • JSON example:

    {
    "success": "true"
    }

Example:

onBoarding.addSignature({ token, image }).then((res) => res);

addAddressStatement

Description:

Upload address statement image (as byte array) and store data. Make sure to put header 'Content-Type: image/jpeg'

Parameters:

NameTypeDescription
tokenstringaccess token to be used in all other methods.
imageobjectaddress statement as image

Returns:

  • Object:

    JSON object

  • JSON example:

    {
    "success": "true"
    }

Example:

onBoarding.addAddressStatement({ token, image }).then((res) => res);

updateSession

Description:

Updates the onboarding session (can be used for example for sending proof of address document).

Parameters:

NameTypeDescription
tokenstringaccess token.
keystringname of the property that will be updated.
valuestringnew value for property.

Returns:

  • Object:

    JSON object

  • Parameters:

    NameTypeDescription
    successbooleanflag indicating success.
  • JSON example:
    {
    "success": true
    }

Example:

// send proof of address document
onBoarding.updateSession({
token,
key: "documentBase64",
value: base64Image,
});

capture

Description:

Sends a captured frame of the ID or selfie to server for processing.

Parameters:

NameTypeDescription
tokenstringaccess token.
imageobjectin case it is front/back ID it is binary image; in case it is selfie it is base64 encoded string.
typestringtype of captured image: front,back, selfie.
regionstringUSA or MEX
encryptedbooleanselfie must always be encripted
sendBase64booleanif you need to send the image in base64 send this to true

Returns:

  • Object:

    JSON object

  • Parameters:

    NameTypeDescription
    croppedFacestringbase64 encoded cropped face from ID (only if type = 'front')
    frontIdstringbase64 encoded front ID image (only if type = 'front')
    sharpnessnumbersharpness of image, number 0 - 100 (only if type in ['front', 'back'])
    glarenumberglare of image, number 0 - 100 (only if type in ['front', 'back'])
    classificationbooleanflag indicating document could be properly classified (only if type = 'front')
    spoofConfidencenumberfloat number 0 -1 indicating spoof atempt confidence (only if type = 'selfie')
    confidencenumberfloat number 0 - 1 indicating recognition confidence (only if type = 'selfie')
    blurrinessnumberfloat number indicating blurriness level of image (only if type = 'selfie')
    base64CroppedImagestringbase64 encoded string representation of selfie (only if type = 'selfie')
    shadowConfidencenumberfloat number indicating shadow confidence (only if type in ['front', 'back'])
  • JSON example:

    {}

Example:

// send selfie
const response = await onBoarding.capture({
token,
image: base64image,
type: "selfie",
});

processFace

Description:

This method should be called after both selfie and front id are uploaded. (/omni/add/face and /omni/add/front-id). The response contains information if this user already exists in system and recognition cofidence between selfie image and face image from front id. In order to get face images method /omni/get/images should be called.

Parameters:

NameTypeDescription
tokenstringaccess token.

Returns:

  • Object:

    JSON object

  • Parameters:

    NameTypeDescription
    confidencenumberfloat number 0 - 1 indicating recognition confidence
    existingUserbooleanindicates if the user has been already enrolled
  • JSON example:

    {
    "confidence": 0.794,
    "existingUser": false
    }

Example:

const response = await onBoarding.processFace({
token,
});

processId

Description:

This method should be called once the upload of front and back side is over. Incode validations, tests and ocr parsing are processed during this method. To fetch ocr data use ocrData method. Parameter queueName is needed so it can be determined in wich queue interview should go. Once this is called, user is no longer able to upload ID (front, back side, passport or insurance card)!

Parameters:

NameTypeDescription
tokenstringaccess token.

Returns:

  • Object:

    JSON object

  • JSON example:

    {
    "success": true
    }

Example:

const response = await onBoarding.processId({
token,
});

processAddressStatement

Description:

This method should be called after both /omni/process/id and /omni/add/address-statement are over. Address from id is compared with address from address statement, and confidence is stored. Result will be visible on conference.

Parameters:

NameTypeDescription
tokenstringaccess token.

Returns:

  • Object:

    JSON object

  • JSON example:

    {
    "success": true
    }

Example:

const response = await onBoarding.processAddressStatement({
token,
});

processGovernmentValidation

Description:

This method should be called after both /omni/process/id (or /omni/add/document-id) and /omni/add/face are over. This method compares user's selfie against image in INE database.

Parameters:

NameTypeDescription
tokenstringaccess token.

Returns:

  • Object:

    JSON object

  • JSON example:

    {
    "success": true
    }

Example:

const response = await onBoarding.processGovernmentValidation({
token,
});

ocrData

Description:

Fetch OCR data

Parameters:

NameTypeDescription
tokenstringaccess token.

Returns:

  • Object:

    JSON object

  • Parameters:

    NameTypeDescription
    birthDatestringtimestamp of birthday.
    namestringuser full name.
    addressstringaddress.
    genderstringuser gender.
    typeOfIdstringtype of ID
    .........
  • JSON example (actual data returned depends on id type):

    {
    "_id": "5e0b133d8c00860016e7e8db",
    "_createdAt": 1577784125675,
    "_updatedAt": 1577784125675,
    "apiKey": "f35844c8bcb417be1a64fd6e8d622cc93b0fcfaa",
    "name": "DIEGO MONDRAGON OCARANZA",
    "phone": "+381605211222",
    "birthDate": "632966400000",
    "address": "COL PEDREGAL DE SAN ANGEL 01900\nALVARO OBREGON ,D.F.",
    "gender": "M",
    "typeOfId": "INE",
    "countryCode": "MEX",
    "cic": "114988030",
    "numeroEmisionCredencial": "01",
    "tamperedConfidence": 0.17613846,
    "idValidationScore": "Attention",
    "fakeIdConfidence": 0.9999198,
    "paperFrontConfidence": 0.0,
    "screenFrontConfidence": 1.7501973e-6,
    "paperBackConfidence": 0.0,
    "screenBackConfidence": 3.5412256e-7,
    "retouchFrontConfidence": 0.004690816,
    "classification": 14,
    "frontSharpness": 59,
    "frontGlare": 100,
    "frontShadowConfidence": 0.8312062,
    "backSharpness": 67,
    "backGlare": 100,
    "backShadowConfidence": 0.6933477,
    "issueDate": 2014,
    "expirationDate": 2024,
    "croppedIDFaceRef": "5e0b26528c00860016e7e8fa",
    "fullFrameFrontIDRef": "5e0b26528c00860016e7e8fb",
    "fullFrameBackIDRef": "5e0b26dc8cdb170011c6e705",
    "frontIdProcessed": true,
    "backIdProcessed": true,
    "idValidationFinished": true,
    "paternalLastNameValid": true,
    "maternalLastNameValid": false,
    "nameValid": true,
    "curpValid": true,
    "ocrValid": true,
    "claveDeElectorValid": true,
    "numeroEmisionCredencialValid": true,
    "registrationDateValid": true,
    "issueDateValid": true
    }
  • Insurance card JSON example (actual data returned depends on insurance card type):

    {
    "_id": "5e0b133d8c00860016e7e8db",
    "_createdAt": 1577784125675,
    "_updatedAt": 1577784125675,
    "apiKey": "f35844c8bcb417be1a64fd6e8d622cc93b0fcfaa",
    "name": "John Smith",
    "cardId": "114988030",
    "phone": "+14535634564",
    "email": "john.smith@outlook.com",
    "birthDate": "632966400000",
    "groupNumber": "154",
    "groupName": "Group A",
    "address": "725 5th Ave, New York, NY 10022",
    "gender": "M",
    "typeOfId": "AdultCare",
    "employer": "Walmart",
    "payerID": "8739",
    "countryCode": "US",
    "issueNumber": "01",
    "tamperedConfidence": 0.17613846,
    "idValidationScore": "Attention",
    "fakeIdConfidence": 0.9999198,
    "paperFrontConfidence": 0.0,
    "screenFrontConfidence": 1.7501973e-6,
    "paperBackConfidence": 0.0,
    "screenBackConfidence": 3.5412256e-7,
    "retouchFrontConfidence": 0.004690816,
    "classification": 14,
    "frontSharpness": 59,
    "frontGlare": 100,
    "frontShadowConfidence": 0.8312062,
    "backSharpness": 67,
    "backGlare": 100,
    "backShadowConfidence": 0.6933477,
    "issueDate": 2014,
    "expirationDate": 2024,
    "croppedIDFaceRef": "5e0b26528c00860016e7e8fa",
    "fullFrameFrontIDRef": "5e0b26528c00860016e7e8fb",
    "fullFrameBackIDRef": "5e0b26dc8cdb170011c6e705",
    "frontIdProcessed": true,
    "backIdProcessed": true,
    "idValidationFinished": true,
    "paternalLastNameValid": true,
    "maternalLastNameValid": false,
    "nameValid": true,
    "cardValid": true,
    "ocrValid": true,
    "issueDateValid": true,
    "expirationDateValid": true
    }

Example:

// get ocr data from the ID
const ocrData = await onBoarding.ocrData({ token })
const { birthDate, name, address, gender, ... } = ocrData

addToQueue

Description:

Add customer to queue for conference call

Parameters:

NameTypeDescription
tokenstringaccess token.
interviewCodestringInterview code returned in session token

Returns:

  • Object:

    JSON object

  • Parameters:

    NameTypeDescription
    successbooleanflag indicating if user is successfully added to queue
    waitingTimeInSecondsnumbertime in seconds to be picked from queue
  • JSON example:
    {
    "waitingTimeInSeconds": 203,
    "success": true
    }

Example:

// Add user to conference queue
await onBoarding.addToQueue({ token });

removeFromQueue

Description:

Remove customer from queue for conference call

Parameters:

NameTypeDescription
tokenstringaccess token.

Returns:

  • Object:

    JSON object

  • Parameters:

    NameTypeDescription
    successbooleanflag indicating if user is successfully removed from queue
  • JSON example:
    {
    "success": true
    }

Example:

// Removes user from conference queue
await onBoarding.removeFromQueue({ token: session.token });

getQueueIndex

Description:

Fetch customer number in the queue.

Parameters:

NameTypeDescription
tokenstringaccess token.

Returns:

  • Object: JSON object

  • Parameters: * index (number) user position in the queue

    NameTypeDescription
    indexnumberuser position in the queue
  • JSON example:

    {
    "index": 0
    }

Example:

// Get queue index
const { index } = await onBoarding.getQueueIndex({ token });

getScore

Description:

Get id validation, liveness and face recognition results for given interviewId.

Parameters:

NameTypeDescription
tokenstringaccess token.

Returns:

  • Object: JSON object
  • JSON example:

    {
    "idValidation": {
    "photoSecurityAndQuality": [
    {
    "value": "PASSED",
    "status": "OK",
    "key": "incodeTamperCheck"
    },
    {
    "value": "PASSED",
    "status": "OK",
    "key": "incodeFakeCheck"
    },
    {
    "value": "PASSED",
    "status": "OK",
    "key": "incodeIdLiveness"
    },
    {
    "value": "PASSED",
    "status": "OK",
    "key": "qrCheck"
    },
    {
    "value": "PASSED",
    "status": "OK",
    "key": "issueDateCheck"
    },
    {
    "value": "100",
    "status": "OK",
    "key": "balancedLightFront"
    },
    {
    "value": "100",
    "status": "OK",
    "key": "balancedLightBack"
    },
    {
    "value": "59",
    "status": "OK",
    "key": "sharpnessFront"
    },
    {
    "value": "67",
    "status": "OK",
    "key": "sharpnessBack"
    },
    {
    "value": "100.0",
    "status": "OK",
    "key": "readabilityCheck"
    },
    {
    "value": "79",
    "status": "WARN",
    "key": "incodeCrossCheck"
    }
    ],
    "idSpecific": [
    {
    "value": "50",
    "status": "WARN",
    "key": "2DBarcodeRead"
    },
    {
    "value": "100",
    "status": "OK",
    "key": "birthDateValid"
    },
    {
    "value": "100",
    "status": "OK",
    "key": "compositeCheckDigit"
    },
    {
    "value": "100",
    "status": "OK",
    "key": "documentClassification"
    },
    {
    "value": "100",
    "status": "OK",
    "key": "documentExpired"
    },
    {
    "value": "100",
    "status": "OK",
    "key": "documentNumberCheckDigit"
    },
    {
    "value": "100",
    "status": "OK",
    "key": "expirationDateCrosscheck"
    },
    {
    "value": "100",
    "status": "OK",
    "key": "expirationDateValid"
    },
    {
    "value": "50",
    "status": "WARN",
    "key": "fullNameCrosscheck"
    },
    {
    "value": "100",
    "status": "OK",
    "key": "imageTamperingCheck"
    },
    {
    "value": "100",
    "status": "OK",
    "key": "issueDateValid"
    },
    {
    "value": "100",
    "status": "OK",
    "key": "issuingStateValid"
    },
    {
    "value": "100",
    "status": "OK",
    "key": "visiblePattern"
    },
    {
    "value": "100",
    "status": "OK",
    "key": "visiblePhotoCharacteristics"
    }
    ],
    "overall": {
    "value": "76.0",
    "status": "OK"
    }
    },
    "liveness": {
    "livenessScore": {
    "value": "98.9%",
    "status": "OK"
    },
    "photoQuality": {
    "value": "116.9"
    },
    "overall": {
    "value": "98.9",
    "status": "OK"
    }
    },
    "faceRecognition": {
    "existingUser": true,
    "overall": {
    "value": "88.4",
    "status": "OK"
    }
    },
    "governmentValidation": {
    "recognitionConfidence": {
    "value": "81.3",
    "status": "OK"
    },
    "validationStatus": {
    "value": "0",
    "status": "OK",
    "key": "ok"
    },
    "ocrValidation": [
    {
    "value": "true",
    "status": "OK",
    "key": "issueDate"
    },
    {
    "value": "true",
    "status": "OK",
    "key": "firstName"
    },
    {
    "value": "true",
    "status": "OK",
    "key": "maternalLastName"
    },
    {
    "value": "true",
    "status": "OK",
    "key": "paternalLastName"
    },
    {
    "value": "true",
    "status": "OK",
    "key": "ocr"
    },
    {
    "value": "true",
    "status": "OK",
    "key": "personalId"
    },
    {
    "value": "true",
    "status": "OK",
    "key": "electorsKey"
    },
    {
    "value": "true",
    "status": "OK",
    "key": "emissionNumber"
    },
    {
    "value": "true",
    "status": "OK",
    "key": "registrationDate"
    }
    ],
    "overall": {
    "value": "81.3",
    "status": "OK"
    }
    },
    "overall": {
    "value": "86.2",
    "status": "OK"
    }
    }

Example:

// Get score
const score = await onBoarding.getScore({ token });

getImages

Description:

Returns images for user. Values for images that can be returned: selfie, croppedFace, croppedIDFace, document, signature, fullFrameFrontID, fullFrameBackID, croppedFrontID, croppedBackID

Parameters:

NameTypeDescription
tokenstringaccess token.
bodyObjectCheck body object table and example

Body:

NameTypeDescription
imagesArray of StringsNeeds to be an array with one or more of this: selfie, croppedFace, croppedIDFace, document, signature, fullFrameFrontID, fullFrameBackID, croppedFrontID, croppedBackID

Returns:

  • Object: JSON object
  • JSON example:

    {
    "croppedFace": "iVBORw0KGgoAAAANSUhEUgAAAaQAAAGkCAIAAADxLsZ....",
    "croppedIDFace": "iVBORw0KGgoAAAANSUhEUgAAAaQAAAGkCAIAAADxLsZ..."
    }

Example:

// Get images
const images await onBoarding.getImages({
token: sessionToken,
body: { images: ['croppedIDFace', 'selfie'] },
})

detect

Description:

Perform document or face detection

Parameters:

NameTypeDescription
typestringtype of captured image: `'front''back''selfie'`
canvasHTMLElement
webcamHTMLElement videoThe video element where the user media is
onFarAwayfunctionCallback when the ID is too far away
onCapturingfunctionCallback for showing a message
onCapturefunctionCallback when you should take the photo
onIdNotDetectedfunctionCallback when there is no ID detected (only if type = 'front' or 'back')
onTooClosefunctionCallback when the user is too close (only if type = 'selfie')
onNothingHappenfunctionCallback when no ID is detected for 5 seconds (only if type = 'front' or 'back')
onErrorfunctionCallback when an error occurs
onShadowsfunctionCallback when shadows are detected

Example:

onBoarding.renderCamera("front", container, {
onSuccess: onSuccess,
onError: onError,
});

renderCamera

Description:

This method is gonna render the Camera with the autodetect and notifications in the browser

Parameters:

NameTypeDescription
typestringtype of captured image: `'front''back''selfiedocumentpassportsecondIdthirdIdinsuranceCard'`
containerHTMLElement
optionsObjectobjectoptions object

Options:

NameTypeDescription
onSuccessfunctionCallback when the detect was success
onErrorfunctionCallback when the detect was unsuccess
tokenObjectThe session object (optional if not presented is readed from state)
numberOfTriesNumberThe number of tries of capturing
onLogfunctionA function with a logger
permissionMessageStringThe message in the permission screen. Default: "Press \"Allow\" to continue."
permissionBackgroundColorStringThe background of permissions screen. Default: "#696969
sendBase64booleanIf you need to send the image in base64 send this to true (only if type = 'selfie')
timeoutnumberThe timeout in miliseconds for looking for a face (only if type = 'selfie')
showPreviewbooleanSet to true to show capture preview. (only if type = 'selfie')
streamMediaStreamIf you send stream it won't ask again to the user. This is an advanced option. Optional
nativeCamerabooleanThis is only for document option. If set to true, it's going to use the native camera for the capture (default: false)
showTutorialbooleanOption to show the tutorial (default: false)
isRecordingEnabledbooleanOption to record the capture camera (default: false)
onRestartOnboardingfunctionCallback for the restart flow after camera access is denied (default: () => window.location.reload())
showDoublePermissionsRequestbooleanOption to show the custom permission prompt (default: false)

Returns:

  • Object:

    JSON object

    NameTypeDescription
    closefunctionThis will close the camera and will unmount the component

Example:

const { close } = incode.renderCamera("front", container, {
onSuccess: onSuccess,
onError: onError,
});

// then you can close the SDK from your code
document.querySelector("#close-modal").addEventListener("click", () => {
close(); // this will close the component prematurely, so use it only if you want to abort the process and close the camera
});

renderConference

Description:

This method is gonna render the Conference component

Parameters:

NameTypeDescription
containerHTMLElement
options Objectobjectoptions object
callback Objectobjectcallbacks object

Options:

NameTypeDescription
tokenObjectThe session object (Mandatory)
showOTPBooleanIf true, is gonna render OTP screen before conference
numberOfTriesNumberThe Number of tries that the user has for OTP. If you put -1 the user will have infinite tries. Default: 3
queueStringThe queue for the video conference. Default: ''

Callbacks:

NameTypeDescription
onSuccessfunctionIt will pass as param the status. Possible status are: close, deny, approve
onErrorfunctionCallback when the detect was unsuccess. Something went wrong in conference
onConnectfunctionCallback when conference is connected
onLogfunctionCallback for the logging

Example:

onBoarding.renderConference(
container,
{
token: token,
showOTP: false,
},
{
onSuccess: (status) => {
log(status);

switch (status) {
case "close":
console.log("The conference was close");
goToStep("closeCase");
break;
case "deny":
console.log("The conference was denied");
goToStep("denyCase");
break;
case "close":
console.log("The conference was approved");
goToStep("approveCase");
break;
}
},
}
);

renderSignature

Description:

This method is gonna render the Signature Component

Parameters:

NameTypeDescription
containerHTMLElement
options Objectobjectoptions object

Options:

NameTypeDescription
tokenStringThe token string (Mandatory)
onSuccessfunctionCallback when the upload of signature was success
onErrorfunctionCallback when the upload of signature was unsuccess
typestringType of signature. This can be used for sign contracts
initialsbooleanIf true, this will send initial and not signature
titlejsxThe title element in jsx syntax
subtitlejsxThe subtitle element in jsx syntax

Example:

onBoarding.renderSignature(document.getElementById("app"), {
token: session.token,
onSuccess: console.log,
onError: console.log,
});

renderVideoSelfie

Description:

This method is gonna render the VideoSelfie Component

Parameters:

NameTypeDescription
containerHTMLElement
options Objectobjectoptions object
callback Objectobjectoptions object

Options:

NameTypeDescription
tokenStringThe token string (Mandatory)
showTutorialbooleanOption to show the tutorial (default: false)
modulesArray[String]The modules you want to perform in video selfie. Check the table to see all available modules (The default is all modules)
speechToTextCheckbooleanOption to perform the speech to text check, if this is false the videoSelfie always gonna call onSuccess (default: true)

Modules

NameDescription
selfieSelfie step
frontFront ID step
backBack ID step
poaProof of address step
questionsRandom questions step
speechThe user will perform a autorization. Important: this step is mandatory and it needs to be the last one

Callback

NameTypeDescription
onSuccessfunctionCallback when the videoselfue was successful. If this is called means the speech detection was successful
onErrorfunctionCallback when the detect was unsuccessful. If this is called means the speech detection was not successful
numberOfTriesnumberThe number of tries in speech to text

Example:

onBoarding.renderVideoSelfie(
container,
{
token: session,
showTutorial: true,
modules: ["selfie", "front", "back", "speech"], // you can add 'poa' and 'questions'
speechToTextCheck: true, // this is the check for the speech
},
{
onSuccess: () => alert("speech detected"),
onError: () => alert("speech not detected"),
numberOfTries: 3,
}
);

getMedicalOcrData

Description:

Fetch Medical Card OCR data

Parameters:

NameTypeDescription
tokenstringaccess token.

Returns:

  • Object:

    JSON object

getFinishStatus

Description:

This method is called after you finish the onboarding process but only if you are using custom flows. It is required for self configurations like autoapprove to function properly.

Parameters:

NameTypeDescription
flowIdstringThe ID of the flow you put in createSession (optional, can be null)
tokenstringThe token obtained from createSession.

Returns:

  • Object:

    JSON object

  • Parameters:

    NameTypeDescription
    successbooleanIf the call was called correctly.
  • JSON example:

    {
    "success": true
    }

Example:

// first you call createSession with the flow id you want to use in the onboarding. (It's called configurationId in the createSession method)
const flowId = 'someFlowId'
const { token } = incode.createSession(code, undefined, {
configurationId: flowId,
})
...
// Call SDK methods to finish the onboarding process
...
// then you call getFinishStatus with the session object and the flowId (flowId is optional here)
incode.getFinishStatus(flowId, { token });

identify

Description:

Identify user by face.

Parameters:

NameTypeDescription
base64Imagestringbase64 encoded string

Returns:

  • Object:

    JSON object

  • JSON response example:

    {
    "spoofConfidence": 0.71,
    "blurriness": 200,
    "secondFactor": false,
    "token": "fkjgoeoigjioenbnb.roejgeognsnbopro3430.897t798atva7"
    }

Example:

incode.identify({ base64Image }).then((res) => res);

renderLogin

Description:

This method is going to render the Face Login Component

Parameters:

NameTypeDescription
containerHTMLElement
onSuccessfunctionCallback when the detect was success
onErrorfunctionCallback when the detect was success
tokenObjectThe session object

Example:

incode.renderLogin(container, {
onSuccess: onSuccess,
onError: onError,
});

attachSignatureOnAnnotation

Description:

Signature from interview to previously uploaded PDF contracts at all places annotated with text from request, with desired height on pdf. Annotations must contain text with either preselected values, or alternative can be supplied. Preselected values are: INITIALS, PATIENTS_SIGNATURE, NON_MEDICAL_SIGNATURE_1, NON_MEDICAL_SIGNATURE_2, MEDICAL_SIGNATURE_1, MEDICAL_SIGNATURE_2. Endpoint is intended to be used as fluent method. One call to the method gives in responses id of the signed document which can then be used in the subsequent call to continuously add another signature on a different annotation.

Parameters:

NameTypeDescription
tokenstringThe session object.
contractIdstring (optional)IDs of previously added contract (Check addDocument)
signatureTypestring (optional)one of the preselected values for annotation text
signedContractIdstring (optional)IDs of previously signed contract (ID is returned as response from the previous attachSignatureOnAnnotation)

Returns:

  • Object:

    JSON object

  • `Parameters:

    NameTypeDescription
    successbooleanIf the call was called correctly.
    additionalInformationobjectInfo about the signed contract
  • additionalInformation:
NameTypeDescription
signedDocumentIdstringNew signed document ID
signedDocumentURLstringTemporary URL to new signed document
  • JSON example:

    {
    "success": true,
    "additionalInformation": {
    "signedDocumentId": "new signed document ID",
    "signedDocumentURL": "temporary URL to new signed document"
    }
    }

Example:

incode.attachSignatureOnAnnotation({
contractId: "somecontractid",
signatureType: "PATIENTS_SIGNATURE",
token: session.token,
signedContractId: "someSignedContractId",
});

addDocument

Description:

Upload document image and store data.

Parameters:

NameTypeDescription
tokenstringThe session object.
typestringPossible values: signature, document, medicalDoc, thirdId, contract
imagestringImage of a document represented in base64.

Returns:

  • Object:

    JSON object

  • `Parameters:

    NameTypeDescription
    successbooleanIf the call was called correctly.
    additionalInformationobjectInfo about the signed contract
  • additionalInformation:
NameTypeDescription
contractIdstringUsed later when adding signature to contract.
  • JSON example:

    {
    "success": true,
    "additionalInformation": {
    "contractId": "cf2ec1fd-bf20-4885-b748-d7e761592d19"
    }
    }

Example:

incode.addDocument({
token,
type: "contract",
image: contractBase64,
});

Description:

Fetches temporary link of the signed contracts uploaded for the current session.

Parameters:

NameTypeDescription
tokenstringThe session object.

Returns:

  • Object:

    JSON object

  • `Parameters:

    NameTypeDescription
    successbooleanIf the call was called correctly.
    additionalInformationobjectInfo about the signed contract
  • additionalInformation:
NameTypeDescription
signedContractIdstringEvery key will be the signedContractId and the value will be the temporary URLs to signed documents. URLs valid for 1h
  • JSON example:

    {
    "success": true,
    "sessionStatus": "Alive",
    "additionalInformation": {
    "document ID1": "Temporary URL to signed document with ID1",
    "document ID2": "Temporary URL to signed document with ID2",
    "document ID3": "Temporary URL to signed document with ID3"
    }
    }

Example:

incode.getSignedContractsLinks({
token,
});

renderRedirectToMobile

Description:

This method is gonna render the Redirect Component

Parameters:

NameTypeDescription
containerHTMLElement
options Objectobjectoptions object

Options:

NameTypeDescription
sessionobject*The session object you get in createSession (Mandatory)
flowIdstringID of the flow that will be used in the mobile
onSuccessfunction*Callback when the onboarding in mobile was success and it's finished
urlstringURL to be redirected to
showSmsbooleanBoolean flag indicating if SMS component should be shown
allowReEnrollmentbooleanBoolean flag indicating if user re-enrollment is allowed
externalIdstringExternal ID to concatenate to URL if needed
assetsobjectObject containing assets from dashboard
expiredbooleanBoolean flag indicating if a session is expired
smsTextstringCustom text to be send in SMS. The URL is concatenated after this text

Example:

const flowId = "someflowid";

const session = await onBoarding.createSession("ALL", null, {
configurationId: flowId,
});

if (onBoarding.isDesktop()) {
onBoarding.renderRedirectToMobile(containerRef.current, {
onSuccess: () => {
renderFinishScreen();
},
session: session,
flowId: flowId,
});
} else {
// show mobile normal flow
renderFrontId();
}

isDesktop

Description:

It is a function that tells you if the user is using a desktop computer (it can be a laptop)

Example:

if (onBoarding.isDesktop()) {
onBoarding.renderRedirectToMobile(containerRef.current, {
onSuccess: () => {
renderFinishScreen();
},
session: session,
flowId: flowId,
});
} else {
// show mobile normal flow
renderFrontId();
}

getCustomFields

Description:

This method is used for fetching custom fields for current session.

Parameters:

NameTypeDescription
tokenstringThe session object.

Returns:

  • Object:

    JSON object

  • `Parameters:

    NameTypeDescription
    customFieldsobjectObject of custom fields with type that was inserted.
  • JSON example:

    { "customFields": { "watchlistName": "John Smith" } }

Example:

incode.getCustomFields({
token: session.token,
});

addCustomFields

Description:

This endpoint is used for adding custom fields to current onboarding session. Parameters:

NameTypeDescription
tokenstringaccess token to be used in all other methods.
fieldsobjectObject of custom fields that will be inserted.

Returns:

  • Object:

    JSON object

  • `Parameters:

    NameTypeDescription
    successbooleanIf the call was called correctly.
  • JSON example:
    {
    "success": true
    }

Example:

incode.addCustomFields({
token: session.token,
fields: { watchlistName: name },
});

renderEnterCurp

Description:

This method renders the component to enter and validate CURP.

Parameters:

NameTypeDescription
tokenstringaccess token to be used in all other methods.

Example:

incode.renderEnterCurp(document.getElementById('app'), {
token: session.token,
onSuccess: console.log,
onError: console.log,,
})