Skip to main content

Face Search (1:N)

In FACIA, the Face Search 1:N service plays a pivotal role by employing a robust facial search algorithm. This algorithm adeptly identifies similarities between a Selfie (Photo) and our comprehensive Image Database. Operating on a versatile 1:N matching approach, it allows users to seamlessly compare against multiple images in the database.

Create Face Search Transaction​

This endpoint initiates a transaction request for the face search algorithm and returns a reference_id if the request includes proper authentication and valid fields, as mentioned below in the request parameters, using the POST method.

Endpoint

POSThttps://api.facia.ai/face-search

Authorization:​

Token Type: Bearer
Description:

This API utilizes Access token or Client-Secret key in header for authentication.

You can use your client_id and client_secret key when using the "/request-access-token" endpoint to obtain a Bearer token for authorization while connecting to this API. For additional details on Authorization, click Here

Run in Postman

Request Body Samples:​

//POST /face-search  HTTP/1.1
//Host: https://api.facia.ai
//Content-Type: application/json
//Authorization: Bearer <access-token-here>

{
"type": "face_search",
"file": "data:image/png;base64,your_image_base64_here",
"client_reference":"your_client_reference_here",
"allow_override":0,
"enroll_face":false
}

Request Parameter​

ParametersDescription
type Required: Yes
Type: string
Example: type=face_search
Type must be face_search.
fileRequired: Yes (if liveness or face_match in services)
Type: file or string
multipart/form-data: the image file (.jpg, .jpeg, .png).
application/json: a Base64 data URI including the prefix, e.g. data:image/jpeg;base64,/9j/4AAQ.... Plain Base64 without the data:image/...;base64, prefix is rejected.
The face to be searched.
client_reference Required: No
Type: string
Minimum: 5 characters
Maximum: 255 characters
Example: client_reference="your_client_reference_here"
Required if allow_override field set to 1.
allow_overrideRequired: No
Type: boolean
Accepted values: 1 / 0 (or true / false in JSON requests)
Default: 0
Set to 1 to replace the latest previously enrolled image with the new one for the given client_reference. client_reference is required when this is set to 1.
enroll_face
Required: No
Type: boolean
Example: enroll_face=true
Default value: true
If you do not want the system to enroll the face then set the value of the key as false.

Multipart Upload Sample​

Image fields can also be sent as files with multipart/form-data instead of Base64 JSON:

curl -X POST https://api.facia.ai/face-search \
-H "Authorization: Bearer <token>" \
-F "type=face_search" \
-F "file=@/path/to/photo.jpg"

Response Sample​


{
"status": true,
"message": "Transaction Created",
"result": {
"data": {
"reference_id": "your_reference_id_here"
}
}
}


Response Parameter​

ParametersDescription
reference_id Type: string
Example: reference_id=your_reference_id_here
The unique identifier associated with the created transaction.
message Type: string
Example: message=Transaction Created

Face Search Result​

This endpoint accepts a single field in the body request payload: reference_id. Once the backend finalizes the response, this endpoint returns a face_search_response object with multiple object ids of images that share the most similar features with the provided image. Failure to provide a valid reference_id will result in a 422 status code.

Endpoint

POSThttps://api.facia.ai/result

Authorization:​

Token Type: Bearer
Description:

This API utilizes Access token or Client-Secret key in header for authentication.

You can use your client_id and client_secret key when using the "/request-access-token" endpoint to obtain a Bearer token for authorization while connecting to this API. For additional details on Authorization, click Here

Run in Postman

Request Body Samples:​

//POST /result HTTP/1.1
//Host: api.facia.ai
//Content-Type: application/json
//Authorization: Bearer <access-token-here>

{
"reference_id": "your_reference_id_here"
}

Request Parameter​

ParametersDescription
reference_id Required: Yes
Type: string
Example: reference_id=your_reference_id_here
The unique identifier associated with the created transaction.

Response Sample​


{
"status": true,
"message": "success",
"result": {
"data": {
"facia_reference_id": "your_reference_id_here",
"client_reference": "your_client_reference_here",
"face_search_response": {
"result": {
"matched_faces": [
[
"65ae1ee3bb742faa2c0507we",
0.98,
"https://api.facia.ai/get-proof/ZFV0dDVOTmpPV01mSGs5QThxZGNqdGhtbWhidmRiaG46NjVhZTFlZTNiYjc0MmZhYTJjMDUwN2Ki",
"your_client_reference_here"
],
[
"65ae0ddc7adc1de48801b3ab",
0.98,
"https://api.facia.ai/get-proof/TzVodnB3SnVvd3NGZ0xjU3E4MVVqdTd3S25kNnBlRjU6NjVhZTBkZGM3YWRjMWRlNDg4MDFiMzPi",
"your_client_reference_here"
]
],
"is_face_found": true
}
}
}
}
}


Response Parameter​

ParametersDescription
facia_reference_id Type: string
Example: facia_reference_id=your_reference_id_here
This key includes the reference number of the request.
client_reference Type: string
Example: client_reference=your_client_reference_here
This is the client's provided reference ID associated with the transaction creation.
face_search_response Type: object
It contains the response generated by the system.
matched_faces Type: Array
This parameter returns the matched face images.
matched_faces[0][0] Type: string
ID of the uploaded proof against which the transaction was conducted.
matched_faces[0][1] Type: number
It is a floating number between 0 and 1, which represents the confidence score, indicating the degree of similarity between both objects.
matched_faces[0][2] Type: string
URL of the uploaded proof against which the transaction was conducted. It has expiry of 15 minutes.
matched_faces[0][3] Type: string
This is the client's request reference.
is_face_found Type: boolean
Indicates whether faces were found against the provided proof or not.