Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Authenticate User V3

/authenticateUser/v3

Description

This service provides biometric template persistence and 1:1 facial authentication against stored templates. It supports two operating modes within a single endpoint, determined by the request body:

  • Enroll mode: Validates the liveness check and performs facial matching between a provided Biometric Template and a live capture, then persists the template associated with a userId.

  • Authenticate mode: Retrieves a previously stored template by userId and performs 1:1 facial matching and liveness check validation against a new live capture.

Functionality

  • Enroll: The userId is sent along with the Biometric Template (templateRaw) and the best tokenized image (bestImageToken). The liveness check and facial matching are validated. If both succeed, the template associated with the user is persisted. If the user already exists, the template is updated.

  • Authenticate: The userId is sent along with the bestImageToken from the current session. The stored template is retrieved and 1:1 matching is performed against the live capture. The authentication result is returned with the similarity score.

Use cases

  1. Customer without prior onboarding with Facephi: During password recovery, the customer completes Onboarding, which generates a Biometric Template. This template is enrolled through this endpoint and associated with a userId. Future password recoveries authenticate directly against the stored template without repeating Onboarding.

  2. Customer with prior onboarding with Facephi: The customer already has a stored template. Subsequent authentications use the 1:1 matching flow against the stored template.

Integration

Requires implementation of the Selphi Mobile Widget or the Selphi Web Widget to generate the bestImageToken and Biometric Template (templateRaw).

Endpoint

POST /services/authenticateUser/v3

Headers

Header
Type
Required
Description

x-api-key

String

Yes

Tenant API key

Content-Type

String

Yes

application/json

family

String

No

Required family header for Tracking

All calls to Endpoints with Tracking in Identity Platform must include the header family.


Enroll mode

Enrolls or updates a biometric template for a user. Requires successful liveness check and facial matching validation before persisting the template.

The presence of the field templateRaw in the request body activates this mode.

Request body

Content-Type: application/json

Parameters

Parameter
Type (Content)
Required
Description

userId

String

Yes

Unique user identifier. Must be at least 2 characters long.

templateRaw

String (Base64)

Yes

Facial biometric template generated from the best image during the onboarding process. Its presence activates enroll mode.

bestImageToken

String (Base64)

Yes

Best tokenized facial image generated by the Selphi Widget. Used for liveness check validation and facial matching against templateRaw to verify that they correspond to the same living person.

tracking

JSON Object

No

Object containing tracking information.

extraData

String (Base64)

No

Token generated by the SDK Mobile/Web containing tokenized tracking information.

operationId

String

No

Operation identifier generated by the SDK Mobile/Web.

Example request: Enroll

Enroll behavior

  1. Liveness check: Validates that bestImageToken corresponds to a living person.

  2. Facial matching: Performs 1:1 matching between templateRaw and bestImageToken to verify that they belong to the same person.

  3. Persistence: If both checks pass, looks up the userId:

    • If the user does not exist: creates the user and stores the template.

    • If the user already exists: updates the stored template with the new one.

  4. TTL (if configured): The template token has a configurable validity period for use in the service. Once expired, it is no longer valid for enrollment.


Authenticate Mode

Authenticates a user by comparing a live capture against their previously stored biometric template. This mode is activated when templateRaw is not included in the request body.

Important: The user must have been enrolled previously (through enroll mode or the v1/v2 self-registration flow) before they can be authenticated. Attempting to authenticate a user who has not been enrolled returns a User not found.

Parameters

Parameter
Type (Content)
Required
Description

userId

String

Yes

Unique identifier of the user to authenticate. Must be at least 2 characters long.

bestImageToken

String (Base64)

Yes

Best tokenized facial image from the current authentication session. Used for liveness check validation and 1:1 Matching against the stored template.

tracking

JSON Object

No

Object containing tracking information.

extraData

String (Base64)

No

Token generated by the SDK Mobile/Web containing tokenized tracking information.

operationId

String

No

Operation identifier generated by the SDK Mobile/Web.

Example request: Authenticate

Authentication behavior

  1. User lookup: Retrieves the stored template associated with userId.

  2. TTL check: If the template has an expiration configured and it has expired, returns Template expired.

  3. Liveness check: Validates that bestImageToken corresponds to a living person.

  4. Facial Matching: Performs 1:1 Matching between the stored template and bestImageToken.

  5. Result: Returns the Matching result, including the similarity score, authentication status, and liveness check diagnostics.


Responses

200 Success

Response parameters

Identifier
Type
Description

serviceResultCode

Integer

Code indicating the overall result of the service execution. See the Service Result Code table below.

serviceResultLog

String

Descriptive field for the execution result. Empty on success.

serviceFacialSimilarityResult

Float

Value indicating facial similarity between the template and bestImageToken. 1.0 = 100%. Present only when biometric Matching is performed.

serviceFacialAuthenticationLog

String

Descriptive field for the facial authentication result (e.g., "Positive", "Negative", "Uncertain"). Present only when biometric Matching is performed.

serviceFacialAuthenticationResult

Integer

Code indicating the facial authentication result. See Table 2 - Service Facial Authentication Result.

serviceLivenessLog

String

Descriptive field for the passive liveness check result (e.g., "Live", "Spoof"). Present only when the liveness check is evaluated.

serviceLivenessResult

Integer

Code indicating the result of the passive liveness check evaluation. See Table 3 - Service Liveness Result.

timestamp

String

Response timestamp (UTC) in the format: YYYY-MM-DDThh🇲🇲ssZ

transactionId

String

Transaction identifier associated with the request processed by the API.

Service Result Code

The serviceResultCode indicates the overall result of the service execution:

serviceResultCode
Description
HTTP code

0

Operation successful (enroll completed or user authenticated).

200

-101

The bestImageToken does not correspond to a live person.

200

-102

User authentication failed — negative facial match.

200

-103

User not found (authenticate mode only).

404

-104

Template not found — the user exists but has no stored template.

404

-105

Template expired — TTL exceeded; the template is no longer available.

200

Service Liveness Result

The serviceLivenessResult indicates the result of the passive liveness check evaluation:

Service Liveness Result
Code
Result
Description

0

None

The liveness check could not be evaluated.

1

Spoof

DEPRECATED. Use 'NoLive' instead.

2

Uncertain

DEPRECATED

3

Live

The subject is assumed to be live.

4

NoneBecauseBadQuality

The liveness check could not be evaluated because of poor image quality.

5

NoneBecauseFaceTooClose

The liveness check could not be evaluated because the detected faces are too close to the edges.

6

NoneBecauseFaceNotFound

The liveness check could not be evaluated because no faces were detected.

7

NoneBecauseFaceTooSmall

The liveness check could not be evaluated because the detected faces are too small.

8

NoneBecauseAngleTooLarge

The liveness check could not be evaluated because the angle between faces exceeds the permitted limit.

9

NoneBecauseImageDataError

The liveness check could not be evaluated because of errors in the image format.

10

NoneBecauseInternalError

The liveness check could not be evaluated because of an internal error.

11

NoneBecauseImagePreprocessError

The liveness check could not be evaluated because of an image preprocessing error.

12

NoneBecauseTooManyFaces

The liveness check could not be evaluated because too many faces were detected in the image.

13

NoneBecauseFaceTooCloseToBorder

The liveness check could not be evaluated because the face is too close to the edge.

14

NoneBecauseFaceCropped

The liveness check could not be evaluated because the face is cropped.

15

NoneBecauseLicenseError

The liveness check could not be evaluated because of a license error.

16

NoneBecauseFaceOccluded

The liveness check could not be evaluated because the face is occluded.

17

NoLive

No liveness detected.

18

NoneBecauseEyesClosed

The liveness check could not be evaluated because the person's eyes are closed.

Service Facial Authentication Result

The serviceFacialAuthenticationResult indicates the result of the facial matching operations:

Service Facial Authentication Result
Code
Result
Description

0

NONE

Facial verification could not be performed.

1

NEGATIVE

The process completed successfully. The facial pattern comparison did not match.

3

POSITIVE

The process completed successfully. The facial pattern comparison is positive. The value of serviceFacialSimilarityResult indicates the % similarity between the compared images.

4

NONE BECAUSE POSE EXCEED

Facial verification could not be performed because of the face position.

5

NONE BECAUSE INVALID EXTRACTIONS

Facial verification could not be performed due to problems extracting the facial pattern.

Example response: Successful enrollment

Example response: Successful authentication (positive match)

Example response: Negative match

Example response: User not found

400 Bad Request

401 Unauthorized

403 Forbidden

404 Not Found

413 Payload Too Large

The request exceeds the maximum allowed size. The gateway rejects it without processing it: the response does not include serviceResultCode or serviceTransactionId. See Request size limit.

Request greater than 6 MB and up to 10 MB (Content-Type: application/json):

Request greater than 10 MB (10,485,760 bytes) (Content-Type: text; charset=utf-8, plain text, not JSON):

502 Bad Gateway

504 Gateway Timeout


Differences from v1/v2

Aspect
v1/v2
v3

Template field in request

registeredTemplateRaw

templateRaw

merchantReferenceId

Required

Not used

image / template as input

Supported

Not supported — only templateRaw + bestImageToken

Automatic enrollment on first authentication

Yes

No — explicit enrollment required

Template in response

Yes (registeredTemplateRaw)

No (not returned for security reasons — avoids unnecessary transfer of PII)

Liveness check + match during enrollment

N/A

Required before persistence

Template TTL / expiration

Not supported

Supported (configurable per tenant using templateTTLSeconds)

New error codes

N/A

-104 (Template not found), -105 (Template expired)


Last updated