eKYC SDK: Building a Complete Onboarding Flow (ID + Selfie + Liveness)
An eKYC SDK is the set of libraries you build into your own app or server to verify a new customer’s identity remotely. Instead of calling a third-party service for every check, you run the steps yourself: scan an ID, read it, confirm it is real, check the person is live, and match their face to the ID photo. This guide walks through that flow from start to finish, so you can see how the pieces fit before you choose or build one.
If you are looking for how to call these steps over a REST API, see our guide to ID verification API integration. This article stays at the flow level: what each step proves, where it can fail, and where to run it.
What an Onboarding Flow Has to Prove
Every eKYC flow is answering the same three questions, and each one needs its own check:
- Is the document real? The ID must be a genuine physical document, not a photo of a screen, a printed copy, or an edited image.
- Is the person real and present? The selfie must come from a live person in front of the camera, not a photo, a video replay, a mask, or a deepfake.
- Is it the same person? The face on the selfie must match the portrait on the ID.
A fourth, quieter check runs underneath: is the data consistent? The name and date of birth on the printed card should agree with the machine-readable zone and any barcode. A mismatch is a strong sign of tampering.
If you skip any of these, you leave a gap. A flow with OCR and a face match but no liveness check can be passed with a photo of a photo. A flow with liveness but no document check can be passed with someone else’s real ID.
The Five Steps of a Complete Flow
Step 1: Capture the document
Everything downstream depends on a good image. The capture screen should show an outline, tell the user to avoid glare, and take the photo only when the document is in focus and fully in frame. Capture the front and the back, because many ID cards keep the barcode or machine-readable zone on the reverse.
A guided capture screen costs little to build and removes most of the blurry, cropped, and glare-covered images that cause rejections later. Passports are usually a single photo page.
Step 2: Read and validate the data
Document recognition turns the image into structured data. A good engine combines three sources:
- OCR reads the printed fields: name, date of birth, document number, expiry date.
- MRZ parsing reads the machine-readable zone on passports and many ID cards. The characters follow the ICAO 9303 standard and include check digits, so the data can be validated, not just read.
- Barcode decoding reads PDF417 and QR codes found on many IDs and driver licenses.
The useful part is the cross-check. When the printed text, the MRZ, and the barcode all agree, you can trust the data. When they do not, flag the document. The output should be structured JSON, so you can compare the fields with your own database or with the application form.
For more detail on how these three sources work together, see ID document recognition explained.
Step 3: Check the document is genuine
Reading a document is not the same as trusting it. Document liveness (also called document authenticity) checks that the image shows a real physical document rather than an attack. Typical attacks include a photo of a laptop or phone screen, a printed or photocopied ID, a digitally generated forgery, and a replaced portrait.
This check looks at the image itself, for signs such as screen patterns, print artifacts, and the origin of the photo, and can also verify security features on supported documents. Run it on every document, not only on ones that look suspicious. Our guide to adding document liveness to a KYC flow covers server and mobile options in more depth.
Step 4: Capture the selfie and check liveness
Now the person takes a selfie. Before you match it to anything, confirm it came from a live person. There are two main approaches:
- Passive liveness scores a single image and asks nothing of the user. It adds no friction and works well on a server.
- Active liveness asks the user to do something, such as blink, smile, or turn their head. It raises assurance for higher-risk actions, and because it needs a live camera session, it runs on the device in the mobile SDK.
Many flows combine them: passive by default, with an active challenge when the risk is higher or a passive score is borderline. Whatever you choose, test it against the attacks you expect, including printed photos, screen replays, masks, and injected video. For the deepfake side of the problem, see our Deepfake Detection SDK.
Step 5: Match the selfie to the document portrait
The last check is a 1:1 face comparison between the live selfie and the portrait cropped from the ID. The engine returns a similarity score, and you choose the threshold that decides pass or fail. A stricter threshold reduces false accepts but sends more genuine users to manual review, so set it according to the risk of the account you are opening.
Image quality matters here too. A face that is blurry, tiny, strongly turned, or poorly lit lowers the score for reasons that have nothing to do with identity. Good engines report why a face was rejected, so your app can ask for a better photo instead of failing the user without explanation.
Where to Run Each Step
An eKYC SDK can run on the phone, on your server, or both, and the choice affects privacy, latency, and what you can enforce.
- On the device: the capture screens, active liveness, and even recognition can run fully on the phone. Nothing leaves the device, and the flow can work offline.
- On your server: document recognition, document liveness, and face matching run as services on your own infrastructure, which gives you one place to enforce policy and keep an audit trail.
- Hybrid: the common pattern is capture and active liveness on the phone, with document processing and the final match on your server. The phone handles the camera. The server holds the decision.
Whichever you choose, do not rely on the client alone for the final decision. A result produced only on the phone can be tampered with by a determined attacker, so verify the important checks on your own server. For a broader view of the trade-offs, see self-hosted vs cloud identity verification.
Decisions That Shape the Flow
A few choices matter more than the SDK you pick:
- Thresholds by risk. Opening a savings account and unlocking a loyalty card do not need the same strictness. Make thresholds configurable per step and per journey.
- A path for failures. Plan for retries, a manual review queue, and a way to explain what went wrong. The goal is to stop attackers without losing real customers.
- Data minimization. Decide what you keep. Many teams store the verified fields and the decision, and delete the raw images after a set period. Confirm requirements for your jurisdiction with your compliance team.
- Re-verification. Identity checks do not end at onboarding. Account recovery and high-risk actions are good places to reuse the same face match.
What to Look for in an eKYC SDK
When you compare options, these questions separate a complete SDK from a partial one:
- Does it cover every step? Document recognition, document liveness, face matching, and face liveness. Gluing together four vendors means four contracts and four sets of edge cases.
- Can it run on your infrastructure? If data residency or privacy matters, check that processing stays on your servers or devices, and that it works without calling a cloud service.
- Which documents does it read? Ask for the supported-document list for the countries you operate in, and test with your own samples.
- How is it priced? Per-call pricing grows with your volume. A flat license per SDK keeps the cost predictable as you scale.
- Can you evaluate it first? Run your own documents and your own test attacks before you commit.
How FacePlugin Fits
The ID Verification SDK Suite brings these steps together: ID Document Recognition, ID Document Liveness, Face Recognition, and Face Liveness Detection. Everything runs on your own servers or on the device, with no biometric data sent to FacePlugin, and the licenses carry no per-call fees. The server products run as Docker containers, and the mobile SDKs cover Android, iOS, Flutter, React Native, Ionic and .NET MAUI. Guided active liveness is available in the mobile SDKs, while the server API provides passive liveness.
Pricing is a flat license per SDK, with unlimited transactions and a free 15-day evaluation license, so you can test the whole flow with your own documents. See pricing for details.
Key Takeaways
A complete eKYC flow proves four things: the document is real, its data is consistent, the person is live, and the face matches. Build or buy for all four, decide where each step runs, set thresholds by risk, and test with your own documents and your own attacks before launch.
Ready to see the whole flow working? Contact us for an evaluation license, or read how customer onboarding with eKYC fits your industry.
Reading identity documents, matching selfies to IDs and wiring identity verification into your product.
Advanced Biometric Solutions at FacePlugin
Transform the way you secure and verify identities with FacePlugin’s on-premises face recognition, face liveness detection, deepfake detection, and ID document recognition SDKs – engineered to keep identity verification secure, private, and fully under your control.
Talk to Our TeamFrequently Asked Questions
What is an eKYC SDK?
An eKYC SDK is a set of libraries you build into your own app or server to verify a customer's identity remotely. It typically reads an ID document, checks that the document and the person are real, and matches the selfie to the ID photo, so you can run the checks yourself instead of calling a third-party service for each one.
What steps does an eKYC onboarding flow include?
A complete flow has five steps: capture the document, read and validate its data (OCR, MRZ and barcode), check the document is genuine, capture a selfie and check liveness, and match the selfie to the portrait on the ID. Skipping any step leaves a gap that attackers can use.
Should eKYC checks run on the phone or on the server?
Both work. Running on the device keeps data on the phone and can work offline, while running on your server gives you one place to enforce policy and keep an audit trail. A common pattern is capture and active liveness on the phone, with document processing and the final match on your server. Do not rely on the phone alone for the final decision.
Can I try FacePlugin's eKYC SDKs before I pay?
Yes. Every licensed FacePlugin SDK includes a full-featured 15-day evaluation, so you can test the whole flow with your own documents. Licenses are a flat fee per SDK with unlimited transactions and no per-call charges.
Deploy identity verification AI on your own terms
Talk to our team about on-premises face recognition, liveness, deepfake, and ID document verification — or dive into the documentation.