Face Search API (1:N)
Searches a face against your private gallery and returns any existing users above your similarity threshold, with their IDs and scores. It can also enrol the new face.
- Source
- Our face recognition model, searching a gallery of faces you have enrolled
- Turnaround
- Real time, usually one to two seconds
- Endpoint
- POST /v1/face/search
- Who can use it
- Businesses with a clear fraud-prevention purpose and user notice and consent covering face storage.
Overview
Fraudsters change names, PANs and phone numbers. Their face stays the same. Face search (1:N) compares a new user's face with a private gallery of your existing users and returns any close matches. It's how lenders catch repeat defaulters under a new identity and how gaming apps stop one person running twenty accounts.
Good to know
It only finds people already in your gallery. A match score is evidence for a review, not proof of identity.
What you get
- Your own galleryFaces are stored in a gallery that belongs to you. We don't search across clients.
- Search and enrol in one callSearch for duplicates and add the new face to the gallery in the same request.
- Your IDs backMatches come back with your own user IDs, so you can open the old account straight away.
- Delete on requestRemove a face from the gallery when a user closes their account or withdraws consent.
Request
POST https://api.ampletrails.com/v1/face/search
| Field | Type | Status | Description |
|---|---|---|---|
image | string | Required | Face image as base64 or HTTPS URL |
gallery_id | string | Required | Your face gallery to search in |
top_k | number | Optional | Maximum number of candidates to return |
threshold | number | Optional | Minimum similarity to include a candidate (0–100) |
enroll | boolean | Optional | Add this face to the gallery after searching |
external_id | string | Optional | Your user ID to attach to the enrolled face |
Response
Fields inside data. Every response also carries status, request_id and, on errors, message. See error codes.
| Field | Meaning | Example |
|---|---|---|
duplicate_found | Whether any candidate met the threshold | true |
candidates | Matching faces sorted by score | […] |
candidates[].external_id | Your user ID for the matched face | user_88412 |
candidates[].score | Similarity score from 0 to 100 | 96.1 |
enrolled_face_id | ID of the newly enrolled face, if enroll was true | fc_7d1e9a |
Example
curl -X POST https://api.ampletrails.com/v1/face/search \
-H "Authorization: Bearer $AMPLE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"image": "data:image/jpeg;base64,…", "gallery_id": "customers-prod", "top_k": 5, "threshold": 85, "enroll": true, "external_id": "user_102938", "consent": "Y"}'import os, requests
resp = requests.post(
"https://api.ampletrails.com/v1/face/search",
headers={"Authorization": f"Bearer {os.environ['AMPLE_API_KEY']}"},
json={
"image": "data:image/jpeg;base64,…",
"gallery_id": "customers-prod",
"top_k": 5,
"threshold": 85,
"enroll": True,
"external_id": "user_102938",
"consent": "Y"
},
timeout=30,
)
resp.raise_for_status()
print(resp.json()["data"])const resp = await fetch("https://api.ampletrails.com/v1/face/search", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.AMPLE_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"image": "data:image/jpeg;base64,…",
"gallery_id": "customers-prod",
"top_k": 5,
"threshold": 85,
"enroll": true,
"external_id": "user_102938",
"consent": "Y"
}),
});
const { data } = await resp.json();$ch = curl_init("https://api.ampletrails.com/v1/face/search");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("AMPLE_API_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(["image" => "data:image/jpeg;base64,…", "gallery_id" => "customers-prod", "top_k" => 5, "threshold" => 85, "enroll" => true, "external_id" => "user_102938", "consent" => "Y"]),
]);
$data = json_decode(curl_exec($ch), true)["data"];{
"status": "success",
"request_id": "req_7f3a9c21e4",
"data": {
"duplicate_found": true,
"candidates": {
"external_id": "user_88412",
"score": 96.1
},
"enrolled_face_id": "fc_7d1e9a"
}
}Example data. The exact field list for your account comes with your sandbox documentation.
Use cases
Repeat defaulters
Flag an applicant whose face matches a written-off borrower, even if every document is new.
Bonus abuse in gaming
Spot one person behind many accounts claiming sign-up bonuses.
Blacklists
Keep a gallery of known fraudsters and check every new sign-up against it.
Questions about this API
How large can a gallery be?
Galleries can hold millions of faces. Search time grows slowly with size; tell us your expected volume and we'll size it.
Is storing faces allowed?
Face images are personal data under the DPDP Act. Tell users why you keep them, keep them only as long as you need them and delete them on request. We can help with the notice text.
What should we do with a match?
Treat it as a lead for review, not an automatic rejection. Twins and lookalikes exist, and a human should look before you act.
Can we search without enrolling?
Yes. Set enroll to false to search only, for example when checking a user against a blacklist.
Try the Face Search API (1:N) API
Sandbox keys, the full field reference and a Postman collection, usually within a working day.