Skip to main content

Find every photo a person appears in from one selfie, using the SightRadar face recognition API. Use when the user wants to find a person in a folder or gallery of photos, search faces in event, wedding, school or sports photos, deliver each guest their own pictures, group or tag photos by person, build 1:N face search, register a selfie and search by a stored face id, or index faces into a collection.

  • New
  • v1.0.0
  • Reviewed Dec 5
  • No reviews yet

Capabilities

  • Local folder: use the script

    Show the user the matched files with their scores

  • With curl

  • Errors

Getting started

Full instructions

Example command

Local folder: use the script

python3 scripts/find_person.py estimate ./photos                 # count + cost, no API call

Instructions: SKILL.mdv1.0.0

Face search: find a person's photos from one selfie

Two steps. Index the photos once: the faces of each photo are stored in a collection under your photoId. Then search with a selfie: the API returns the photo_ids that contain that person, ranked by similarity. Photos themselves are not stored.

Before you start

  • Key: export SIGHTRADAR_API_KEY="frs_..." (create one at https://sightradar.com/dashboard/keys). Never print or commit it. If it is missing, ask the user to set it; do not ask them to paste it in chat.
  • Cost: 93 credits per photo indexed and per search by image, 62 per search by a stored id. 1 credit = $0.00001, so 1,000 photos cost about $0.93. Tell the user the cost before indexing a folder and check the balance (GET /v1/wallet, free).
  • Consent: index and search faces only for people who agreed to it and for the purpose they expect. Do not use this to identify strangers.

Local folder: use the script

scripts/find_person.py (Python standard library, no install) indexes a folder and searches it. Each photo id is the file path relative to the folder with / written as :, and every search result carries the file path.

bash
python3 scripts/find_person.py estimate ./photos                 # count + cost, no API call
python3 scripts/find_person.py balance                           # free
python3 scripts/find_person.py index my-event ./photos --yes     # 93 credits per photo
python3 scripts/find_person.py search my-event ./selfie.jpg --limit 50

index prints a JSON summary: photos indexed, faces stored, photos with no usable face, failures. A second run on the same folder skips files that were already indexed and does not charge for them. search prints:

json
{ "collection_id": "my-event", "matches": [ { "photo_id": "ceremony:IMG_0012.jpg", "score": 0.91, "file": "ceremony/IMG_0012.jpg" } ] }

Show the user the matched files with their scores. An empty matches with a reason means the selfie was the problem: no_face or low_quality_selfie. Ask for a clearer, front-facing photo.

With curl

bash
B="https://api.sightradar.com"; AUTH="Authorization: Bearer $SIGHTRADAR_API_KEY"; J="Content-Type: application/json"

# Index a local file, or a public URL. The collection is created on first use.
curl -s -X POST "$B/v1/collections/my-event/index" -H "$AUTH" -H "Idempotency-Key: idx-my-event-001" \
  -F "file=@./photos/001.jpg" -F "photoId=001"
curl -s -X POST "$B/v1/collections/my-event/index" -H "$AUTH" -H "$J" \
  -d '{"url":"https://cdn.example.com/001.jpg","photoId":"001"}'
# {"photo_id":"001","indexed":3,"detected_face_count":3,"rejected_face_count":0,"faces":[{"point_id":"...","bbox":{...}}]}

# Search with a selfie
curl -s -X POST "$B/v1/collections/my-event/search" -H "$AUTH" -F "file=@./selfie.jpg" -F "limit=50"
curl -s -X POST "$B/v1/collections/my-event/search" -H "$AUTH" -H "$J" \
  -d '{"url":"https://cdn.example.com/selfie.jpg","limit":50,"threshold":0.6}'
# {"matches":[{"photo_id":"001","score":0.91}],"photo_ids":["001"]}

# Collections (free)
curl -s "$B/v1/collections" -H "$AUTH"
curl -s "$B/v1/collections/my-event" -H "$AUTH"      # photo_count, face_count, selfie_count

indexed: 0 is a successful, charged result: no face passed the quality gate (too small, blurry, or turned away). photoId is optional and defaults to a hash of the image; always set it to the user's own photo key. Keep / out of it: a photo id with a slash cannot be addressed by the per-photo delete route.

Returning users: register the selfie once, search by id

For an app where the same person searches many times, register their selfie once (93) and keep the returned point_id. Each later search by id costs 62 and needs no image.

bash
curl -s -X POST "$B/v1/collections/my-event/selfies" -H "$AUTH" -H "Idempotency-Key: reg-u_42" \
  -F "file=@./selfie.jpg" -F "userId=u_42"
# {"face_found":true,"point_id":"...","selfie_id":"...","quality_passed":true}
curl -s -X POST "$B/v1/collections/my-event/search-by-id" -H "$AUTH" -H "$J" \
  -d '{"pointId":"<point_id>","limit":50}'

userId is required. If face_found is false, ask for another photo. A point_id belongs to one collection.

In code

python
# pip install sightradar
from sightradar import SightRadar
sr = SightRadar()                                    # reads SIGHTRADAR_API_KEY
sr.index("my-event", file="photos/001.jpg", photo_id="001")
result = sr.search("my-event", file="selfie.jpg")
for m in result.matches:
    print(m.photo_id, round(m.score, 3))
ts
// npm install sightradar
import { SightRadar } from "sightradar";
const sr = new SightRadar();
await sr.index("my-event", { url: "https://cdn.example.com/001.jpg", photoId: "001" });
const result = await sr.search("my-event", { url: "https://cdn.example.com/selfie.jpg" });
for (const m of result.matches) console.log(m.photo_id, m.score);

Getting good results

  • Scores are cosine similarity from 0 to 1. There is no universal cut-off: test on a sample of the user's own photos and pick the threshold where right and wrong matches separate. For galleries, a looser threshold plus an "Is this you?" confirmation on borderline scores works better than a strict one.
  • One collection per event or library keeps searches scoped and makes deletion simple.
  • More than a few hundred photos that are reachable by URL: use the batch route (62 per photo, 1,000 URLs per call). See the face-batch-indexing skill or https://sightradar.com/docs/guides/batch-and-webhooks
  • When the work is done, or a person asks to be removed, delete the data: DELETE /v1/collections/{id} (soft, restorable) or DELETE /v1/collections/{id}/photos/{photoId}. See the face-data-deletion skill.

Errors

401 bad key. 402 out of credits (top up, then re-run; indexed photos are not charged again). 404 collection not found on search (index first). 409 the Idempotency-Key was already used: that call already ran. 413 image over 30 MB. 429, 502, 503: wait and retry with the same Idempotency-Key. Full docs: https://sightradar.com/llms.txt

Examples

Prompt

I want to find all photos of my friend in this wedding album folder using a selfie I took.

Output

First, we estimate the cost by running: python3 scripts/find_person.py estimate ./wedding_photos. Then, with your consent, we index the folder: python3 scripts/find_person.py index wedding-event ./wedding_photos --yes (cost: 93 credits per photo). After indexing completes, we search using your selfie: python3 scripts/find_person.py search wedding-event ./selfie.jpg --limit 50. The output lists matched photos with similarity scores, e.g., { "collection_id": "wedding-event", "matches": [ { "photo_id": "reception:IMG_0123.jpg", "score": 0.94, "file": "reception/IMG_0123.jpg" } ] }.

Prompt

Can you help me register my selfie once and then use it to quickly find me in the company event photos?

Output

Sure! First, register your selfie in the collection with: curl -X POST "https://api.sightradar.com/v1/collections/company-event/selfies" -H "Authorization: Bearer $SIGHTRADAR_API_KEY" -H "Idempotency-Key: reg-user123" -F "file=@./selfie.jpg" -F "userId=user123". This returns a point_id. Then index the event photos folder: python3 scripts/find_person.py index company-event ./event_photos --yes. Later, search by your stored face id with: curl -X POST "https://api.sightradar.com/v1/collections/company-event/search" -H "Authorization: Bearer $SIGHTRADAR_API_KEY" -H "Content-Type: application/json" -d '{"point_id":"your_point_id_here","limit":50}'. This returns matched photo IDs with similarity scores.
Browse all
This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Reviews (0)

What does the face-search skill do?

Find every photo a person appears in from one selfie, using the SightRadar face recognition API. Use when the user wants to find a person in a folder or gallery of photos, search faces in event, wedding, school or sports photos, deliver each guest their own pictures, group or tag photos by person, build 1:N face search, register a selfie and search by a stored face id, or index faces into a collection. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.

How do I install the face-search skill?

Run `npx @skills-hub-ai/cli install face-search` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/face-search/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.

Which AI tools does face-search work with?

face-search runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.

Is the face-search skill free?

Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.

How do I use face-search after installing it?

In Claude Code, type `/face-search` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.

Can I share the face-search skill with my team?

Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.

Badge for your README

Show that this skill is on Skills Hub. The badge links back to this page and shows the live install count.

Install on Skills Hub badge preview
Markdown
[![Install on Skills Hub](https://skills-hub.ai/api/badges/skill/face-search)](https://skills-hub.ai/skills/face-search)
HTML
<a href="https://skills-hub.ai/skills/face-search"><img src="https://skills-hub.ai/api/badges/skill/face-search" alt="Install on Skills Hub"></a>

More options in the badge docs.