# faceRecoCompareFaceWithFace

## Description

Compare existing user's face with a face for login using the face recognition system.

## Parameters

| Parameter | Type   | Description                                                               |
| --------- | ------ | ------------------------------------------------------------------------- |
| profileId | string | unique profile id of the user, in case duplicate user will not be created |
| image     | string | base64 image data of the user id                                          |

## Response

| Parameter | Type   | Description                                                                                                                                              |
| --------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| message   | string | message about the response                                                                                                                               |
| status    | int    | <p>0 for user id already exists</p><p>1 for successful execution and user creation</p><p>-1 for any error occurs during the execution of the request</p> |

## Example Request and Response

### Prerequisites

Before making requests with Volary SDK, you must have it installed.

You can install Volary SDK using either `npm` or `yarn`. Use the following commands to install Volary SDK:

```sh
npm install @nest25/ai-core-sdk
OR
yarn add @nest25/ai-core-sdk
```

## Request

Here is an example of how to make a `faceRecoRegisterUser` request using the Volary SDK:

```javascript
// import the ai-core-sdk
const fs = require('fs');
import {AIServices} from '@nest25/ai-core-sdk';

// reusable arrow function to encode file data to base64 encoded string
const convertBase64 = async (path) => {
    // get the extention of the image
    let words = path.split('.')
    let extention = words.pop();
    // read binary data from file
    const bitmap = fs.readFileSync(path);
    // convert the binary data to base64 encoded string
    let base64String = bitmap.toString('base64');
    return `data:image/${extention};base64,${base64String}`;
};

// relative path to the file
const filePath = 'playground/sample.jpg';

// create a new instance of the sdk
const aiServices = new AIServices();

async function main() {
  // get the result of the test
  let result = await convertBase64(filePath);
  const result = await aiServices.faceRecoCompareFaceWithFace('user_id', result);
  console.log(result);
}

main();
```

## Response

```json
{
    "status": 1,
    "message": "User photo matches with the features."
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.volary.io/sdks-guide/ai-guide/face-recognition/facerecocomparefacewithface.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
