> ## Documentation Index
> Fetch the complete documentation index at: https://developers.argosidentity.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Face Compare API

> Compare two facial images to determine their similarity and provide detailed analysis results

# Face Compare API

The Face Compare API allows users to compare two faces to determine their similarity. With this functionality, users can easily measure the resemblance between two facial images, enabling them to identify and analyze similarities or differences.

## API Overview

The Face Compare API provides a powerful tool for facial similarity analysis with the following capabilities:

* **Dual Image Comparison**: Compare two facial images side by side
* **Similarity Scoring**: Get precise similarity scores between faces
* **High Accuracy**: Advanced AI algorithms for reliable comparisons
* **Fast Processing**: Quick analysis and response times
* **Multiple Formats**: Support for various image formats
* **Privacy Focused**: No storage of facial data, only comparison results

## Request Parameters

### Required Parameters

* **originFace**: Base64 encoded image of the face to be compared with the targetFace image
* **targetFace**: Base64 encoded image of the face to be compared with the originFace image

### Optional Parameters

* **callbackUrl**: The URL where the face compare results will be sent upon completion

### Authentication

* **x-api-key**: API key essential for authentication and access control purposes

## Response Format

The API returns detailed comparison results including:

* **apiType**: API type identifier
* **transactionId**: Unique identifier for each request
* **result**: Object containing the processing result
  * **face**: Recognition result of the originFace
  * **targetFace**: Recognition result of the targetFace
  * **similarity**: Similarity score between the two faces

## Use Cases

* **Identity Verification**: Verify if two photos belong to the same person
* **Fraud Detection**: Detect identity theft and fake documents
* **Access Control**: Verify identity for secure entry systems
* **Customer Onboarding**: Ensure consistent identity across registrations
* **Document Verification**: Compare ID photos with live captures

## Processing Modes

### Synchronous Processing

* Immediate response with comparison results
* Best for real-time applications
* Direct API response

### Asynchronous Processing

* Use callback URL for delayed results
* Better for batch processing
* Detailed callback response format

## Similarity Scoring

The API provides similarity scores that indicate how closely two faces match:

* **High Score (80-100%)**: Very likely the same person
* **Medium Score (60-79%)**: Possibly the same person
* **Low Score (0-59%)**: Likely different people


## OpenAPI

````yaml POST /compare
openapi: 3.1.0
info:
  title: Face Compare API
  description: API for comparing two facial images and determining their similarity
  version: 1.0.0
servers:
  - url: https://idverify-api.argosidentity.com/modules
    description: Production server
security:
  - apiKeyAuth: []
paths:
  /compare:
    post:
      tags:
        - Face Compare
      summary: Compare two facial images
      description: >-
        Compare two facial images to determine their similarity and provide
        detailed analysis results
      operationId: compareFaces
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - originFace
                - targetFace
              properties:
                originFace:
                  type: string
                  description: >-
                    The base64 encoded image of the face to be compared with the
                    targetFace image.


                    * Base64 encoded characters in the payload must not include
                    the MIME type. For example, if the encoded base64 characters
                    are "image/png;base64,/9j/2wBDABQODxIP...", then remove
                    "image/png;base64," and send only the encoded data
                    "/9j/2wBDABQODxIP...".
                  example: >-
                    iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==
                targetFace:
                  type: string
                  description: >-
                    The base64 encoded image of the face to be compared with the
                    originFace image.
                  example: >-
                    iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==
                callbackUrl:
                  type: string
                  description: >-
                    The URL where the face compare results will be sent upon
                    completion. If a callbackUrl is provided, the process works
                    asynchronously. If no callbackUrl is provided, the process
                    operates synchronously.
                  format: uri
                  example: https://your-domain.com/callback
      responses:
        '200':
          description: Successful face comparison
          content:
            application/json:
              schema:
                type: object
                properties:
                  apiType:
                    type: string
                    description: API type identifier
                    example: compare_face
                  transactionId:
                    type: string
                    description: Unique identifier for each request
                    example: txn_123456789
                  result:
                    type: object
                    description: Object containing the processing result
                    properties:
                      face:
                        type: object
                        description: Recognition result of the originFace
                        properties:
                          isAvailable:
                            type: boolean
                            description: Presence of the recognized originFace
                            example: true
                          boundingBox:
                            type: object
                            description: Bounding Box object for the recognized originFace
                            properties:
                              Width:
                                type: number
                                description: >-
                                  Width coordinate of the Bounding Box for
                                  originFace
                                example: 0.42534321546554565
                              Height:
                                type: number
                                description: >-
                                  Height coordinate of the Bounding Box for
                                  originFace
                                example: 0.567890123456789
                              Left:
                                type: number
                                description: >-
                                  Left coordinate of the Bounding Box for
                                  originFace
                                example: 0.12345678901234566
                              Top:
                                type: number
                                description: >-
                                  Top coordinate of the Bounding Box for
                                  originFace
                                example: 0.23456789012345677
                          confidence:
                            type: number
                            description: Confidence score of face detection
                            example: 0.9876543210987654
                      targetFace:
                        type: object
                        description: Recognition result of the targetFace
                        properties:
                          isAvailable:
                            type: boolean
                            description: Presence of the recognized targetFace
                            example: true
                          boundingBox:
                            type: object
                            description: Bounding Box object for the recognized targetFace
                            properties:
                              Width:
                                type: number
                                description: >-
                                  Width coordinate of the Bounding Box for
                                  targetFace
                                example: 0.4567890123456789
                              Height:
                                type: number
                                description: >-
                                  Height coordinate of the Bounding Box for
                                  targetFace
                                example: 0.543210987654321
                              Left:
                                type: number
                                description: >-
                                  Left coordinate of the Bounding Box for
                                  targetFace
                                example: 0.13456789012345677
                              Top:
                                type: number
                                description: >-
                                  Top coordinate of the Bounding Box for
                                  targetFace
                                example: 0.2456789012345679
                          confidence:
                            type: number
                            description: Confidence score of face detection
                            example: 0.9765432109876543
                      similarity:
                        type: object
                        description: Similarity analysis between the two faces
                        properties:
                          score:
                            type: number
                            description: Similarity score between the two faces (0-1 scale)
                            example: 0.854321098765432
                          threshold:
                            type: number
                            description: Threshold used for matching
                            example: 0.8
                          isMatch:
                            type: boolean
                            description: >-
                              Boolean indicating if faces match based on
                              threshold
                            example: true
              examples:
                successful-comparison:
                  summary: Successful face comparison with high similarity
                  value:
                    apiType: compare_face
                    transactionId: txn_123456789
                    result:
                      face:
                        isAvailable: true
                        boundingBox:
                          Width: 0.42534321546554565
                          Height: 0.567890123456789
                          Left: 0.12345678901234566
                          Top: 0.23456789012345677
                        confidence: 0.9876543210987654
                      targetFace:
                        isAvailable: true
                        boundingBox:
                          Width: 0.4567890123456789
                          Height: 0.543210987654321
                          Left: 0.13456789012345677
                          Top: 0.2456789012345679
                        confidence: 0.9765432109876543
                      similarity:
                        score: 0.854321098765432
                        threshold: 0.8
                        isMatch: true
                low-similarity:
                  summary: Face comparison with low similarity
                  value:
                    apiType: compare_face
                    transactionId: txn_987654321
                    result:
                      face:
                        isAvailable: true
                        boundingBox:
                          Width: 0.42534321546554565
                          Height: 0.567890123456789
                          Left: 0.12345678901234566
                          Top: 0.23456789012345677
                        confidence: 0.9876543210987654
                      targetFace:
                        isAvailable: true
                        boundingBox:
                          Width: 0.4567890123456789
                          Height: 0.543210987654321
                          Left: 0.13456789012345677
                          Top: 0.2456789012345679
                        confidence: 0.9765432109876543
                      similarity:
                        score: 0.23456789012345677
                        threshold: 0.8
                        isMatch: false
        '400':
          description: Bad request - Invalid input parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        example: INVALID_IMAGE
                      message:
                        type: string
                        example: One or both images are invalid or corrupted
        '401':
          description: Unauthorized - Invalid API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        example: INVALID_API_KEY
                      message:
                        type: string
                        example: Invalid or missing API key
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        example: INTERNAL_ERROR
                      message:
                        type: string
                        example: An internal server error occurred
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````