Face Match (Service SDK)
Use the IDCanopy SDK to perform face-to-face comparison from your own UI.You control capture (camera/upload), we handle the request signing, routing to
/faceMatch
, and response normalization.
- Compare:
- Two images (Base64 JPEG/PNG)
- Two biometric templates
- Image ↔ template
- ID document portrait token (
tokenFaceImage
) ↔ image/template
- Optional livenessMode (
none
|passive
) for selfie evaluation. - Threshold-based decisioning (
approve
|decline
|review
).
For the REST endpoint details, see the [Face Match API]](/essentials/faceMatch) page.
Prerequisites
- ✅ Completed Authentication with Access Key.
- ✅ (Optional) Handshake and Webhooks configured if you plan to use
callbackUrl
(async flow).
Authentication
To access the Address Verification API, authentication is required. A Bearer Token must be included in every request.- Tokens are valid for 60 minutes and must be refreshed after expiration.
- Refer to the Authentication for detailed steps on obtaining a token.
- Include the token in the
Authorization
header as follows:
API Base URL
Install & Import
Initialize
Create a single SDK instance and reuse it across your app.Quick Start (sync)
Pass two sources and get a similarity score + decision back.Parameters
Allowed Inputs per Method
comparisonMethod | token1 | token2 |
---|---|---|
openImages | Base64 image | Base64 image |
biometricTemplates | Template raw | Template raw |
imageToTemplate | Base64 image | Template raw |
docPhotoToImage | tokenFaceImage | Base64 image |
docPhotoToTemplate | tokenFaceImage | Template raw |
Method
- Sync (default): Returns a FaceMatchResult with decision and scores.
- Async (when callbackUrl set): Returns FaceMatchAccepted and later posts a webhook.
Types
Examples
A) Image ↔ Image (no liveness)
B) Doc Portrait Token ↔ Selfie (with passive liveness)
C) Image ↔ Template
Handling Errors
SDK raises normalized errors with a consistent shape.Common causes
code | when | fix |
---|---|---|
InvalidInput | Wrong enum / missing required / wrong token type | Check comparisonMethod and token formats |
UnsupportedMedia | Corrupted Base64 / wrong MIME | Ensure JPEG/PNG encoding |
ImageQualityInsufficient | No face / blur / glare / occlusion | Guide user to better lighting & framing |
TemplateInvalid | Template string not parseable | Verify provider template format |
Unauthorized | Bad apiKey / missing auth | Confirm Access Key and environment |
ProviderError | Upstream failure | Retry with backoff |
RateLimited | Too many requests | Throttle / exponential backoff |
Async Flow (Optional)
When you passcallbackUrl
, the SDK may return { status: 'accepted' }
immediately.
You’ll receive a webhook event when processing completes.
- Event:
face.match.completed
- Verify: Follows the same signature process as Webhooks doc.
Quality Guidance (UX you control)
Because you own the UI, apply standard capture guidelines:- Framing: Shoulders & full face centered, single face only
- Lighting: Even, no backlight, avoid glare
- Stability: Brief hold (auto-capture if sharp & face centered)
- No occlusions: Remove masks, hats, sunglasses
- Doc portrait token: Ensure the doc crop flow produces a valid tokenFaceImage
Security & Privacy
- Tokens/images are sent over TLS; data at rest follows your global retention policy.
- Do not log raw images or templates. Use externalReferenceId for correlation.
- Redact PII in analytics/telemetry.