Liveness Session Operations - Get Liveness Session Result

Get session result of detectLiveness/singleModal call.

GET {endpoint}/face/{apiVersion}/detectLiveness-sessions/{sessionId}

URI Parameters

Name In Required Type Description
apiVersion
path True

string

API Version

endpoint
path True

string

uri

Supported Cognitive Services endpoints (protocol and hostname, for example: https://{resource-name}.cognitiveservices.azure.com).

sessionId
path True

string

The unique ID to reference this session.

Responses

Name Type Description
200 OK

LivenessSession

The request has succeeded.

Other Status Codes

FaceErrorResponse

An unexpected error response.

Headers

x-ms-error-code: string

Security

Ocp-Apim-Subscription-Key

The secret key for your Azure AI Face subscription.

Type: apiKey
In: header

AADToken

The Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: accessCode
Authorization URL: https://api.example.com/oauth2/authorize
Token URL: https://api.example.com/oauth2/token

Scopes

Name Description
https://cognitiveservices.azure.com/.default

Examples

Get LivenessSession Result

Sample request

GET {endpoint}/face/v1.2/detectLiveness-sessions/b12e033e-bda7-4b83-a211-e721c661f30e

Sample response

{
  "sessionId": "b12e033e-bda7-4b83-a211-e721c661f30e",
  "authToken": "eyJhbGciOiJFUzI1NiIsIm",
  "status": "NotStarted",
  "modelVersion": "2024-11-15",
  "results": {
    "attempts": [
      {
        "attemptId": 2,
        "attemptStatus": "Succeeded",
        "result": {
          "livenessDecision": "realface",
          "targets": {
            "color": {
              "faceRectangle": {
                "top": 669,
                "left": 203,
                "width": 646,
                "height": 724
              }
            }
          },
          "digest": "B0A803BB7B26F3C8F29CD36030F8E63ED3FAF955FEEF8E01C88AB8FD89CCF761",
          "sessionImageId": "Ae3PVWlXAmVAnXgkAFt1QSjGUWONKzWiSr2iPh9p9G4I"
        }
      },
      {
        "attemptId": 1,
        "attemptStatus": "Failed",
        "error": {
          "code": "FaceWithMaskDetected",
          "message": "Mask detected on face image.",
          "targets": {
            "color": {
              "faceRectangle": {
                "top": 669,
                "left": 203,
                "width": 646,
                "height": 724
              }
            }
          }
        }
      }
    ]
  }
}

Definitions

Name Description
FaceError

The error object. For comprehensive details on error codes and messages returned by the Face Service, please refer to the following link: https://aka.ms/face-error-codes-and-messages.

FaceErrorResponse

A response containing error details.

FaceRectangle

A rectangle within which a face can be found.

LivenessColorDecisionTarget

The target from color image used for liveness classification.

LivenessDecision

The outcome of the liveness classification.

LivenessDecisionTargets

The targets used for liveness classification.

LivenessError

The error of the liveness classification.

LivenessModel

The model version used for liveness classification.

LivenessResult

The results of the liveness classification.

LivenessSession

Session result of detect liveness.

LivenessSessionAttempt

The liveness session attempt.

LivenessSessionResults

The results of the liveness session.

OperationState

The current status of the session.

FaceError

The error object. For comprehensive details on error codes and messages returned by the Face Service, please refer to the following link: https://aka.ms/face-error-codes-and-messages.

Name Type Description
code

string

One of a server-defined set of error codes.

message

string

A human-readable representation of the error.

FaceErrorResponse

A response containing error details.

Name Type Description
error

FaceError

The error object.

FaceRectangle

A rectangle within which a face can be found.

Name Type Description
height

integer

The height of the rectangle, in pixels.

left

integer

The distance from the left edge if the image to the left edge of the rectangle, in pixels.

top

integer

The distance from the top edge if the image to the top edge of the rectangle, in pixels.

width

integer

The width of the rectangle, in pixels.

LivenessColorDecisionTarget

The target from color image used for liveness classification.

Name Type Description
faceRectangle

FaceRectangle

The face region where the liveness classification was made on.

LivenessDecision

The outcome of the liveness classification.

Name Type Description
realface

string

The algorithm has classified the target face as real.

spoofface

string

The algorithm has classified the target face as a spoof.

uncertain

string

The algorithm could not classify the target face as either real or spoof.

LivenessDecisionTargets

The targets used for liveness classification.

Name Type Description
color

LivenessColorDecisionTarget

The target from color image used for liveness classification.

LivenessError

The error of the liveness classification.

Name Type Description
code

string

The error code.

message

string

The error message.

targets

LivenessDecisionTargets

Targets used for liveness classification.

LivenessModel

The model version used for liveness classification.

Name Type Description
2024-11-15

string

LivenessResult

The results of the liveness classification.

Name Type Description
digest

string

The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution.

livenessDecision

LivenessDecision

The liveness classification for the target face.

sessionImageId

string

The image ID of the session request.

targets

LivenessDecisionTargets

Targets used for liveness classification.

LivenessSession

Session result of detect liveness.

Name Type Description
authToken

string

Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable.

modelVersion

LivenessModel

The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen

results

LivenessSessionResults

The results of the liveness session.

sessionId

string

The unique ID to reference this session.

status

OperationState

The current status of the session.

LivenessSessionAttempt

The liveness session attempt.

Name Type Description
attemptId

integer

The attempt ID, start from 1.

attemptStatus

OperationState

The status of the attempt.

error

LivenessError

The error of the liveness call, will be null if there is result.

result

LivenessResult

The result of the liveness call, will be null if there is error.

LivenessSessionResults

The results of the liveness session.

Name Type Description
attempts

LivenessSessionAttempt[]

The attempts data of underlying liveness call with the session.

OperationState

The current status of the session.

Name Type Description
Canceled

string

The operation has been canceled by the user.

Failed

string

The operation has failed.

NotStarted

string

The operation has not started.

Running

string

The operation is in progress.

Succeeded

string

The operation has completed successfully.