Documentation

Add Face API

Call this API to add a face to a faceSet.

Request Example:

curl -X POST \
  https://sg-api.advance.ai/intl/openapi/face-search/facereferences \
  -H 'Content-Type: multipart/form-data' \
  -H 'X-ACCESS-TOKEN:{Your Access Token}' \
  --form 'faceSetId="1"' \
  --form 'faceImage=@"postman-cloud:///1ef5533f-579d-44b0-b389-7f02187f4af8"' \
  --form 'externalReferenceId="3aa0b51d-25df-4432-81ee-7b1774f89348"' \
  --form 'idNumber=""' \
  --form 'idCardType=""' \
  --form 'country="MG"' \
  --form 'name="Mrs. Justine"'

Request Url

https://sg-api.advance.ai/intl/openapi/face-search/facereferences
POST (multipart/form-data)
ParameterDescription
X-ACCESS-TOKENstring Please use Token Authentication API to get your access token.

Request Parameters

ParameterDescription
faceSetIdstring The unique id of faceSet.
faceImagefile The face image. form-data.
externalReferenceIdstring [Optional] The unique id used to track this request.
idNumberstring [Optional] The identity number of face.
idCardTypestring [Optional] The identity card type of face.
countrystring [Optional] The alpha-2 country code. Refer to ISO ALPHA-2 Country Code
namestring [Optional] The name of this face.

Image Quality Requirements

The services check and extract the necessary information from the uploaded images, hence please ensure the uploaded images satisfy the following criteria:

  • Is in one of the following image formats: PNG / JPG / JPEG
  • Below 2 MB file size
  • Minimum resolution of 256 x 256
  • Maximum resolution of 4096 x 4096

Response Description

ParameterDescription
codeenum Status Code.
transactionIdstring The request id, the max length is 64.
pricingStrategyenum Whether the request will be charged, enum type: FREE, PAY
messagestring The error message used to debug
datastring The face id created.
extraobject Extra response info (Exception Message).

Response Code

Status CodeMessage
SUCCESSfree OK.
PARAMETER_ERRORfree Parameter error, please check your request whether has illegal parameters.
free Failed to embed image: No face detected.
free File should be an image file, like jpg, png, jpeg.
free File size should be less than 2MB.
free Image resolution should be 256 * 256 to 4096 * 4096.
ERRORfree Server error.

Response Examples

SUCCESS

{
    "code": "SUCCESS",
    "message": "OK",
    "data": "1",
    "extra": null
}

PARAMETER_ERROR

{
    "code": "PARAMETER_ERROR",
    "message": "FaceSet not found, id: 1",
    "data": null,
    "extra": null,
    "pricingStrategy": "FREE"
}
{
    "code": "PARAMETER_ERROR",
    "message": "Failed to embed image: No face detected",
    "data": null,
    "extra": null,
    "pricingStrategy": "FREE"
}
{
    "code": "PARAMETER_ERROR",
    "message": "File should be an image file, like jpg, png, jpeg.",
    "data": null,
    "extra": null,
    "pricingStrategy": "FREE"
}
{
    "code": "PARAMETER_ERROR",
    "message": "File size should be less than 2MB",
    "data": null,
    "extra": null,
    "pricingStrategy": "FREE"
}
{
    "code": "PARAMETER_ERROR",
    "message": "Image resolution should be 256 * 256 to 4096 * 4096",
    "data": null,
    "extra": null,
    "pricingStrategy": "FREE"
}