SmartSelfie™ Authentication

Required Class: WebApi Class

Running SmartSelfie™ Authentication on Java

  1. Get your Smile ID Partner ID

  2. Get your API Key

  3. Create a Callback Endpoint

  4. Get your user's Selfie

  5. Get the user ID you initially used to register the user

  6. Submit the Job to Smile ID

  7. Interpret your results

Get your Partner ID

You can find your Partner ID in the menu list when logged into the portal.

Get your API Key

Your API Key is also in the developer section of the portal.

  • Click on the Generate New API Key button

  • Copy your api key (ensure you are in the right environment)

Create a Callback Endpoint

Responses from this product are asynchronous (based on various actions we carry out on the product) and are sent as soon as they are ready, you will need to setup a callback when submitting a job. You can read about creating a Callback URL here.

Get the User's Selfie

To successfully run SmartSelfie™ Authentication jobs you need to submit the user's selfie. There are two types of selfies that can be submitted

  • Selfie - a single colour-image selfie of user

  • (optional but required for Proof of Live) Liveness images - 8 colour images of user

  • ID card photo

The selfies images can either be submitted as files (with the path to the image specified during submission) or as base64 encoded strings.

We recommend that you use our Web SDK to capture these images.

Get the User's User ID

Since SmartSelfie™ Authentication entails comparing a user's selfie with the selfie they have on file in Smile ID, you must supply the User's existing user_id in the partner params (the user_id must be the same as the one you used when you ran a successful "Enhanced KYC + SmartSelfie™" or "Document Verification" for the user). If the User ID you supplied does not exist, the job will fail.

Submit the Job to Smile ID

String partnerId = "<Put your partner ID here>";
String defaultCallback = "<Put your default callback url here>";
String apiKey = "<Put your API key here>";
String sidServer = "< 0 || 1 >";  // Use '0' for the sandbox server and '1' for production

WebApi connection = new WebApi(partnerId, apiKey, defaultCallback, sidServer);

// Create required tracking parameters
Map<String, Object> optionalInfo = new HashMap(); // map of optional parameters partner uses to track jobs. can be left empty
PartnerParams params = new PartnerParams(JobType.SMART_SELFIE_AUTHENTICATION, "<unique ID for user>", "< unique job ID >", optionalInfo);

// Create image list
// ImageType - This infers to either a file or a base64 encoded image, but not both.
// If using base 64 encoded image, pass in the encoded string as the second parameter and set fileName to null.
// If using file, set image parameter to null and filename to path to file
// ImageType.SELFIE - Selfie image jpg (if you have the full path of the selfie)
// ImageType.SELFIE_BASE64 - Selfie image jpg base64 encoded (if you have the base64image string of the selfie)
// ImageType.LIVENESS - Liveness image jpg (if you have the full path of the liveness image)
// ImageType.LIVENESS_BASE64 - Liveness image jpg base64 encoded (if you have the base64image string of the liveness image)


List<ImageDetails> imageDetails = new ArrayList<>();
ImageDetail selfie = new ImageDetail(ImageType.SELFIE, null, "< full path to selfie >");
ImageDetail liveness = new ImageDetail(ImageType.LIVENESS, null, "< full path to liveness image");

imageDetails.add(selfie);
imageDetails.add(liveness); // Not required if you don't require proof of life

// Options for the job
boolean returnJobStatus = false; // Set to true if you want to get
// the job result in sync (in addition to the result been sent to
// your callback). If set to false, result is sent to callback url only
boolean returnHistory = false; // Set to true to receive all of the
// updates you would otherwise have received in your callback as
// opposed to only the final result. You must set return_job_status
// to true to use this flag.
boolean returnImageLinks = false; // Set to true to receive links to
// the selfie and the photo it was compared to. You must set
// return_job_status to true to use this flag.
String callBackUrl = "< optional callback url to use for this job only >";
Options options = new Options(returnHistory, returnImageLinks, returnJobStatus, callBackUrl);

connection.submitJob(params, imageDetails, null, options);

Interpret your Results

You can read more about result codes and responses in the SmartSelfie™ Authentication section of the docs.

Last updated