Documentation menu

Make your first API call

Start with face comparison. Choose a plan on RapidAPI, configure your credentials, and send two images from your server.

1. Choose an API on RapidAPI

Open the Face Verification & Comparison listing, select a plan, and open the Compare Two Faces endpoint. Use the displayed X-RapidAPI-Key and X-RapidAPI-Host values. The host is the API host, not the RapidAPI marketplace URL or tigratech.ai.

2. Configure your server environment

The commands below use a POSIX shell such as Bash or zsh. Replace the two placeholders with your own values from RapidAPI. Keep the key in server-side configuration.

Shell
# Replace these with the values from the selected RapidAPI listing.
export RAPIDAPI_KEY="YOUR_RAPIDAPI_KEY"
export RAPIDAPI_HOST="YOUR_SELECTED_API_HOST"

3. Send two images

Place a reference photo at ./source.jpg and a second photo at ./target.jpg. Use a single clear face in the source image. Each file must stay within the published 20 MB limit.

cURL
curl --request POST \
  --url "https://$RAPIDAPI_HOST/face/compare" \
  --header "X-RapidAPI-Key: $RAPIDAPI_KEY" \
  --header "X-RapidAPI-Host: $RAPIDAPI_HOST" \
  --form 'source=@./source.jpg' \
  --form 'target=@./target.jpg'
Do not set Content-Type yourself. cURL sets the multipart boundary.

4. Read the result

JSON
{
  "matched": true,
  "similarity": 99.98,
  "threshold": 90,
  "sourceFaceConfidence": 99.99,
  "matchedFace": {
    "left": 0.2,
    "top": 0.1,
    "width": 0.5,
    "height": 0.6
  },
  "targetFacesChecked": 1
}
Illustrative response. Your scores depend on the submitted images.

matched reports whether the similarity reaches the applied threshold. A numeric similarity is a score from 0 to 100; a null value means there was no comparable face. Handle that case explicitly in your application.

Node.js example

This example uses built-in fetch, FormData, and Blob in Node.js 20 or newer. Run it as an ES module after configuring the environment variables above.

JavaScript
// Node.js 20+ · run on your server, not in a browser bundle.
import { readFile } from "node:fs/promises";

const host = process.env.RAPIDAPI_HOST;
const key = process.env.RAPIDAPI_KEY;
if (!host || !key) throw new Error("Configure RapidAPI credentials first");

const body = new FormData();
body.append("source", new Blob([await readFile("./source.jpg")]), "source.jpg");
body.append("target", new Blob([await readFile("./target.jpg")]), "target.jpg");

const response = await fetch(
  `https://${host}/face/compare`,
  {
    method: "POST",
    headers: { "X-RapidAPI-Key": key, "X-RapidAPI-Host": host },
    body
  }
);

if (!response.ok) {
  throw new Error(`Vision request failed (HTTP ${response.status})`);
}
const result = await response.json();
// Apply your own workflow policy to result.matched and result.similarity.
console.log({ matched: result.matched, similarity: result.similarity });

Next steps

Questions about this integration?Contact the team