{"openapi":"3.1.0","info":{"title":"SightRadar Face Recognition API","version":"1.0.0","summary":"AWS-Rekognition-compatible face indexing & search, priced below Rekognition.","description":"SightRadar is a face-recognition SaaS. Index faces from photos, search a\ncollection with a selfie, detect & compare faces — billed on a **prepaid\ncredit** model (no per-month commitment).\n\n## Authentication\nAll `/v1/*` endpoints require an API key, sent as a Bearer token:\n\n```\nAuthorization: Bearer frs_<prefix>_<secret>\n```\n\nCreate keys in the [portal](https://sightradar.com) → **API Keys**, or via\n`POST /portal/keys`. The plaintext key is shown **once** at creation and is\nnever recoverable — store it securely.\n\n## Billing model\n- **Prepaid credits.** Each billable call *reserves* credits up front, then\n  *settles* on success or *refunds* on engine failure (you are never charged\n  for a 4xx/5xx).\n- **Per photo processed, never per face.** A photo with 0 or 5 faces in it is\n  one charge. Almost every endpoint processes exactly one photo per request,\n  so in practice the charge is **per request**. The one exception is\n  `POST /v1/compare`, which takes two images (source + target) and is\n  therefore charged for **both** — see that endpoint for the exact rule.\n- **Three price tiers** (all below AWS Rekognition's first-tier US rate of $0.0010/image):\n  - **Real-time** — every synchronous call (index, search, selfie, detect,\n    compare): **93 credits** = $0.00093/photo (7% under Rekognition). You get\n    the answer in the HTTP response, served by an always-warm fleet.\n  - **Search by face-id** (`search-by-id`): **62 credits** = $0.00062/search\n    (38% under). A pure vector lookup against a face you already indexed.\n  - **Standard (batch)** (`POST /v1/batches`): **62 credits** = $0.00062/photo\n    (38% under). Deferrable, URL-only, results via webhook.\n- Control-plane ops (create/list/get/delete collection, wallet, usage, keys,\n  webhooks) are **free** (0 credits) but still require a valid key.\n- When your wallet hits zero, billable calls return **402 Payment Required**.\n  The `X-Credits-Remaining` response header reports your balance after each\n  billable call.\n\n## Idempotency\nBillable calls are idempotent **opt-in**: send an `Idempotency-Key` header to\nmake safe retries. Without the header, each call is unique (an identical re-run\ncharges again).\n\nA replay under the same key is **never re-charged and never re-runs the\nengine**. What it returns depends on the operation:\n- **Selfie register** (`POST /v1/collections/{id}/selfies`): a replay of the\n  SAME registration (same collection + `userId` + `selfieId`) returns **200**\n  with the originally stored result and an `Idempotent-Replay: true` header, so\n  a caller whose response was lost after the charge can recover the `point_id`.\n  The replay body carries the identity fields (`point_id`, `collection_id`,\n  `user_id`, `selfie_id`, `face_found: true`, `replayed: true`) but OMITS the\n  volatile `embedding`, `det_score`, `quality_passed`, and `model_version` of\n  the first response — the contract is \"recover the `point_id`\", not \"reproduce\n  the full first response\". Reusing one key for a DIFFERENT selfie (another\n  collection, or another `userId`/`selfieId`) does NOT replay; it returns 409.\n- **All other billable ops**: a replay returns **409** before any charge.\n\n## Real-time vs batch\n- **Real-time** (`/v1/collections/{id}/index`, `/search`, etc.): synchronous,\n  immediate response. Accepts a `url`, a `gcsKey`, or raw/multipart image\n  bytes (≤ 30 MB).\n- **Batch** (`POST /v1/batches`): fire-and-forget, up to 1000 **URL-only**\n  photos; results delivered per-photo via your registered webhook, or poll\n  `GET /v1/batches/{id}/photos` for authoritative per-photo outcomes.\n"},"servers":[{"url":"https://api.sightradar.com","description":"Production API"}],"security":[{"ApiKeyAuth":[]}],"tags":[{"name":"Collections","description":"Create and manage face collections (the registry of your indexed photos)."},{"name":"Faces","description":"Index, search, detect, and compare faces (billable operations)."},{"name":"Selfies","description":"Register a single-face selfie for later search-by-id."},{"name":"Batch","description":"Asynchronous bulk processing with webhook callbacks."},{"name":"Webhooks","description":"Register endpoints for per-photo batch results and verified deletion completion events."},{"name":"Wallet & Usage","description":"Check your credit balance, usage, and auto-recharge config."},{"name":"API Keys","description":"Mint, list, and revoke API keys."},{"name":"Profile","description":"View and edit your account profile (name, organization)."},{"name":"Health","description":"Liveness and readiness probes (unauthenticated)."}],"paths":{"/health":{"get":{"tags":["Health"],"summary":"Liveness probe (alias of /healthz)","description":"Process is up and serving. No dependencies. Unauthenticated. Conventional alias of /healthz for uptime monitors.","security":[],"responses":{"200":{"description":"Service is alive.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"ok"}}}}}}}}},"/healthz":{"get":{"tags":["Health"],"summary":"Liveness probe","description":"Process is up and serving. No dependencies. Unauthenticated.","security":[],"responses":{"200":{"description":"Service is alive.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"ok"}}}}}}}}},"/readyz":{"get":{"tags":["Health"],"summary":"Readiness probe","description":"Verifies the Postgres connection. 200 = ready, 503 = not ready. Unauthenticated.","security":[],"responses":{"200":{"description":"Ready to serve traffic.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"ready"},"postgres":{"type":"string","example":"ok"},"engine_breaker":{"type":"string","enum":["closed","open"],"description":"Engine circuit-breaker state."},"schema_version":{"type":"string","description":"Applied database migration."}}}}}},"503":{"description":"Not ready (Postgres down or unconfigured).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"not ready"},"postgres":{"type":"string","example":"down"}}}}}}}}},"/v1/collections":{"post":{"tags":["Collections"],"summary":"Create a collection","description":"Creates a new face collection owned by your account. Free (0 credits).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["collection_id"],"properties":{"collection_id":{"type":"string","description":"Your chosen identifier for the collection.","example":"event-2026-wedding"}}}}}},"responses":{"200":{"description":"Collection created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}},"400":{"description":"collection_id missing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"description":"Collection already exists in a non-active state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["Collections"],"summary":"List collections","description":"Lists your collections, newest first, paged via limit/offset. Pass `q` to filter by a case-insensitive substring of the collection ID. Returns the matching `total` so clients can paginate accurately. Free.\n","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","default":50,"minimum":1,"maximum":200}},{"name":"offset","in":"query","schema":{"type":"integer","default":0,"minimum":0}},{"name":"q","in":"query","description":"Case-insensitive LITERAL substring filter on collection_id (max 100 chars; wildcard characters are matched literally).","schema":{"type":"string","maxLength":100}}],"responses":{"200":{"description":"Your collections.","content":{"application/json":{"schema":{"type":"object","properties":{"collections":{"type":"array","items":{"$ref":"#/components/schemas/Collection"}},"total":{"type":"integer","description":"Total collections matching the filter (ignores limit/offset).","example":12166},"limit":{"type":"integer","example":50},"offset":{"type":"integer","example":0},"status":{"type":"string","description":"The status filter that was applied (empty when none).","example":""}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/collections/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Collection id."}],"get":{"tags":["Collections"],"summary":"Describe a collection","description":"Returns the collection with its face/selfie counts, from the gateway's count registry (or a live engine read when the registry is not ready, or with `?verify=true`). Free.","parameters":[{"name":"verify","in":"query","required":false,"schema":{"type":"boolean"},"description":"Force a live engine read of the counts instead of the gateway registry (counts_source becomes `engine`)."}],"responses":{"200":{"description":"Collection detail.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}},"400":{"$ref":"#/components/responses/InvalidCollectionId"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"delete":{"tags":["Collections"],"summary":"Delete a collection (soft by default, restorable)","description":"Schedules a durable cascade delete — all faces and selfies are removed\nasynchronously. Returns 202 with a workflow id. Free.\n\nTwo modes:\n\n* **Soft (default, no flag)** — the collection is tagged\n  `deletion_pending` and stops accepting index/search operations\n  *immediately*, but nothing is erased until the grace window elapses.\n  Undo with `POST /v1/collections/{id}/restore` any time before the purge\n  starts. This is the safe default: an accidental mass-delete from your\n  own automation is recoverable.\n* **Immediate (`?immediate=true`)** — skips the grace window and starts\n  erasing now. NOT restorable.\n\n`?compliance=true` is an alias for `immediate=true` that additionally\nrecords the erasure as compliance-class for your own audit trail.\n\nPoll `GET /v1/collections/{id}/deletion` for authoritative progress.\n","parameters":[{"name":"immediate","in":"query","required":false,"schema":{"type":"boolean","default":false},"description":"Skip the grace window and begin erasing now. Not restorable."},{"name":"compliance","in":"query","required":false,"schema":{"type":"boolean","default":false},"description":"Alias for `immediate=true`, additionally recorded as a compliance-class erasure."}],"responses":{"202":{"description":"Deletion scheduled.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["deletion_pending","deleting"],"description":"`deletion_pending` for a soft delete (still restorable); `deleting` once erasure has been scheduled."},"mode":{"type":"string","enum":["soft","immediate"]},"workflow_id":{"type":"string"},"restorable":{"type":"boolean","description":"True for a soft delete (undo via `POST /v1/collections/{id}/restore`); false for an immediate delete."},"purge_after":{"type":"string","format":"date-time","description":"When the grace window elapses and erasure begins. Soft deletes only."},"message":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"Collection is already deleting or deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/collections/{id}/restore":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Collection id."}],"post":{"tags":["Collections"],"summary":"Undo a soft collection delete","description":"Restores a collection that is still inside its grace window\n(`status=deletion_pending`) back to `active`, cancelling the scheduled\npurge. The collection keeps the same incarnation, and any batch work that\nwas paused by the delete resumes. Free and idempotent.\n\nReturns 409 once the purge has actually started (`status=deleting`) —\nvectors are being erased at that point, so a restore could not honestly\nreturn the collection intact. Also 409 for a compliance-class erasure,\nwhich is deliberately not restorable.\n","responses":{"200":{"description":"Collection restored.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"active"},"message":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Account is read-only.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"Not restorable — the purge has already started, or this was a compliance-class erasure.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/collections/{id}/recreate":{"parameters":[{"description":"Collection id.","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"post":{"tags":["Collections"],"summary":"Recreate a purged collection","description":"Brings back a collection whose deletion has fully completed\n(`status=deleted`) as a new, empty collection under the same id. Nothing\nfrom before the delete comes back: re-index the photos you still need.\nFree.\n\n`POST /v1/collections` keeps returning 409 for a deleted id, and indexing\ninto one is refused, so a stale job can never revive it by accident.\nRecreating it has to be this explicit call.\n\nReturns 409 while the collection is still `active`, `deletion_pending`\n(use restore instead) or `deleting`; when the erasure was\ncompliance-class; when deletion was not verified complete; or while work\naccepted before the delete is still queued or running.\n","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}},"description":"Collection recreated, active and empty."},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Account is read-only."},"404":{"$ref":"#/components/responses/NotFound"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Not recreatable. The error message says which condition failed."}}}},"/v1/collections/{id}/photos/{photoId}/restore":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Collection id."},{"name":"photoId","in":"path","required":true,"schema":{"type":"string"},"description":"The photoId supplied at index time."}],"post":{"tags":["Collections"],"summary":"Undo a soft photo delete","description":"Un-deletes a soft-deleted photo's faces so they are searchable again.\nOnly works while the vectors still exist — i.e. for a soft delete inside\nits grace window. An immediate delete physically removed the vectors and\ncannot be undone; re-index the photo instead. Free and idempotent.\n","responses":{"200":{"description":"Faceprints restored.","content":{"application/json":{"schema":{"type":"object","properties":{"restored":{"type":"boolean","example":true},"collection_id":{"type":"string"},"photo_id":{"type":"string"},"engine":{"type":"object","description":"The engine's own acknowledgement, echoed for audit."}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Account is read-only, or the collection does not accept a restore.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/NotFound"},"502":{"description":"Restore service unavailable, or the engine failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/collections/{id}/deletion":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Collection id."}],"get":{"tags":["Collections"],"summary":"Get collection deletion status","description":"Authoritative status for an asynchronous collection deletion. Poll until\n`phase=completed` and `verified_zero=true` before removing a client-side\ntombstone. Active collections return `phase=not_deleting`. Free.\n","responses":{"200":{"description":"Current deletion lifecycle.","content":{"application/json":{"schema":{"type":"object","required":["collection_id","phase","collection_status","verified_zero","attempts"],"properties":{"collection_id":{"type":"string"},"phase":{"type":"string","enum":["not_deleting","deletion_pending","deleting","completed","blocked"]},"collection_status":{"type":"string","enum":["active","deletion_pending","deleting","deleted"]},"verified_zero":{"type":"boolean"},"attempts":{"type":"integer"},"deletion_class":{"type":"string","enum":["product","compliance"]},"workflow_id":{"type":"string"},"workflow_status":{"type":"string","enum":["pending","completed","failed"]},"purge_after":{"type":"string","format":"date-time"},"requested_at":{"type":"string","format":"date-time"},"completed_at":{"type":"string","format":"date-time"},"last_error":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/collections/{id}/metrics":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"tags":["Collections"],"summary":"Collection metrics","description":"Face/selfie counts for one collection, from the gateway's count registry (or a live engine read when the registry is not ready, or with `?verify=true`). Free.","parameters":[{"name":"verify","in":"query","required":false,"schema":{"type":"boolean"},"description":"Force a live engine read of the counts instead of the gateway registry (counts_source becomes `engine`)."}],"responses":{"200":{"description":"Counts.","content":{"application/json":{"schema":{"type":"object","properties":{"collection_id":{"type":"string"},"status":{"type":"string","example":"active"},"photo_count":{"type":"integer","format":"int64"},"face_count":{"type":"integer","format":"int64"},"selfie_count":{"type":"integer","format":"int64"},"counts_source":{"type":"string","description":"`postgres` = the gateway's count registry, `engine` = a live engine read."}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"502":{"description":"Engine metrics unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/collections/{id}/photos/{photoId}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Collection id."},{"name":"photoId","in":"path","required":true,"schema":{"type":"string"},"description":"The photoId supplied at index time."}],"delete":{"tags":["Collections"],"summary":"Delete one photo's faceprints (soft by default, restorable)","description":"Deletes the face vectors indexed from one photo (by the `photoId` you\nsupplied at index time), without touching the rest of the collection.\nSynchronous and free. Idempotent — deleting an already-removed photo\nstill returns 200. The response also says whether the photo had any\nfaces in the collection (`found`), from the gateway's photo registry or,\nwhere that is not complete, from the engine's count of the photo's face\npoints at the time of the delete; a photo with none returns\n`found: false` and `restorable: false`.\n\nTwo modes, mirroring the collection delete:\n\n* **Soft (default, no flag)** — the faces are tagged deleted and drop out\n  of search *immediately*, but the vectors survive the grace window so the\n  delete can be undone with\n  `POST /v1/collections/{id}/photos/{photoId}/restore`. This is the safe\n  default: an accidental delete from your own automation is recoverable.\n* **Immediate (`?immediate=true`)** — the vectors are physically removed\n  now. NOT restorable.\n\n`?compliance=true` is an alias for `immediate=true` that additionally\nrecords the erasure as compliance-class for your own audit trail.\n","parameters":[{"name":"immediate","in":"query","required":false,"schema":{"type":"boolean","default":false},"description":"Physically delete the vectors now instead of soft-deleting them.\nNot restorable.\n"},{"name":"compliance","in":"query","required":false,"schema":{"type":"boolean","default":false},"description":"Alias for `immediate=true`, additionally recorded as a\ncompliance-class erasure.\n"}],"responses":{"200":{"description":"Faceprints deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean","example":true},"collection_id":{"type":"string"},"photo_id":{"type":"string"},"mode":{"type":"string","enum":["soft","immediate"],"description":"Which delete mode was applied."},"restorable":{"type":"boolean","description":"True for a soft delete (undo via the restore endpoint); false for an immediate delete, and false when `found` is false."},"found":{"type":"boolean","description":"Whether this photo id had faces in the collection when the delete ran. Omitted only when neither the photo registry nor the engine could tell."},"engine":{"type":"object","description":"The engine's own acknowledgement, echoed for audit (includes `purge_after` as unix seconds on a soft delete)."}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"502":{"description":"Deletion service unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/collections/{id}/selfies/{selfieId}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Collection id."},{"name":"selfieId","in":"path","required":true,"schema":{"type":"string","maxLength":512},"description":"The selfieId supplied at registration (at most 512 bytes)."}],"delete":{"tags":["Selfies"],"summary":"Delete one selfie (immediate, not restorable)","description":"Deletes one registered selfie (Rekognition `DeleteFaces` analog) by the\n`selfieId` you supplied to `POST /v1/collections/{id}/selfies`. Every\nstored version of that selfie is removed. Free and synchronous.\n\n* **Immediate only.** There is no soft mode and no restore: the vectors\n  are physically removed before the 200 is returned.\n* **Verified.** A 200 means no matching selfie remains. If one is still\n  stored after the delete, the response is a 503 and you should retry;\n  the delete is idempotent, so a retry converges.\n* **Idempotent.** An unknown or already-deleted `selfieId` returns 200\n  with `deleted: []`.\n\nIf the same `selfieId` was registered under several users, pass\n`?userId=` to delete only that user's copy. An empty `?userId=` is a\n400, never a delete of every copy.\n\nPhoto faces are not touched; to remove a person from indexed photos use\n`DELETE /v1/collections/{id}/photos/{photoId}`.\n","parameters":[{"name":"userId","in":"query","required":false,"schema":{"type":"string","maxLength":512},"description":"Only delete the copy registered under this userId."},{"name":"compliance","in":"query","required":false,"schema":{"type":"boolean","default":false},"description":"Record the erasure as compliance-class in your audit trail. The delete itself is the same."}],"responses":{"200":{"description":"Selfie deleted (or was never stored).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubjectDeleteResponse"}}}},"400":{"description":"The selfieId or userId is empty, longer than 512 bytes, or contains '/', '\\', a control character, or is '.' / '..'.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"The account is read-only.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/NotFound"},"502":{"description":"Deletion service unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"The delete could not be verified (a matching selfie is still stored), or deletion is temporarily shed. Retry; the delete is idempotent.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/collections/{id}/users/{userId}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Collection id."},{"name":"userId","in":"path","required":true,"schema":{"type":"string","maxLength":512},"description":"The userId supplied at selfie registration (at most 512 bytes)."}],"delete":{"tags":["Selfies"],"summary":"Delete every selfie of a user (immediate, not restorable)","description":"Deletes every selfie registered under `userId` in the collection\n(Rekognition `DeleteUser` analog). Free and synchronous, with the same\ncontract as the selfie delete: immediate, not restorable, verified (503\nif a matching selfie remains; retry), and idempotent (an unknown\n`userId` returns 200 with `deleted: []`).\n\n`deleted_selfie_ids` lists the selfieIds that were removed. Photo faces\nare not touched: SightRadar stores no link between a photo face and a\nuser, so to remove the person from indexed photos use\n`DELETE /v1/collections/{id}/photos/{photoId}`.\n","parameters":[{"name":"compliance","in":"query","required":false,"schema":{"type":"boolean","default":false},"description":"Record the erasure as compliance-class in your audit trail. The delete itself is the same."}],"responses":{"200":{"description":"The user's selfies deleted (or none were stored).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubjectDeleteResponse"}}}},"400":{"description":"The userId is empty, longer than 512 bytes, or contains '/', '\\', a control character, or is '.' / '..'.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"The account is read-only.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/NotFound"},"502":{"description":"Deletion service unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"The delete could not be verified (a matching selfie is still stored), or deletion is temporarily shed. Retry; the delete is idempotent.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/collections/{id}/index":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"post":{"tags":["Faces"],"summary":"Index faces from a photo","description":"Detects all quality-gated faces in an image and stores them in the\ncollection (Rekognition `IndexFaces`). **Billable: 93 credits (real-time tier).**\n\nProvide the image as JSON `{url}` / `{gcsKey}`, a multipart `file`, or\nraw image bytes. Optional `photoId` is the per-image key (defaults to a\ncontent hash).\n\nIndexing into a `collection_id` that does not exist yet creates it. An\nindex the engine refuses (4xx/5xx) creates nothing and is not charged.\n","parameters":[{"name":"photoId","in":"query","schema":{"type":"string"},"description":"Per-image key (also accepted in body)."},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageInput"}},"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"},"photoId":{"type":"string"}}}},"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"responses":{"200":{"description":"Faces indexed.","headers":{"X-Credits-Remaining":{"$ref":"#/components/headers/CreditsRemaining"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IndexResult"}}}},"400":{"$ref":"#/components/responses/BadImage"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/InsufficientCredits"},"409":{"description":"A request with this Idempotency-Key is in flight or already processed (`duplicate_request_*`), or, on accounts whose photo_ids are unique across collections, `error_code` `photo_id_in_other_collection`: this photoId is already indexed in another collection. Nothing was written and the hold is refunded; `error_detail.hint` says how to proceed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"$ref":"#/components/responses/ImageTooLarge"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/EngineUnavailable"}}}},"/v1/collections/{id}/search":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"post":{"tags":["Faces"],"summary":"Search a collection","description":"Search by a selfie image OR a precomputed 512-d embedding. Returns the\nmatching photo ids ranked by similarity. **Billable: 93 credits (real-time tier).**\nA collection that does not exist returns 404 and is not charged.\n","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchInput"}},"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"},"threshold":{"type":"number"},"limit":{"type":"integer"}}}}}},"responses":{"200":{"description":"Search result.","headers":{"X-Credits-Remaining":{"$ref":"#/components/headers/CreditsRemaining"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchResult"}}}},"400":{"$ref":"#/components/responses/BadImage"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/InsufficientCredits"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/DuplicateRequest"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/EngineUnavailable"}}}},"/v1/collections/{id}/search-by-id":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"post":{"tags":["Faces"],"summary":"Search by a stored selfie point id","description":"Search using a previously-registered selfie's `pointId` (Rekognition\n`SearchFaces` by FaceId). **Billable: 62 credits (search-by-face-id tier).**\nA collection that does not exist returns 404 and is not charged.\n","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["pointId"],"properties":{"pointId":{"type":"string","description":"A point_id returned by /selfies."},"threshold":{"type":"number","description":"Min cosine similarity (0-1)."},"limit":{"type":"integer","description":"Max matches to return."}}}}}},"responses":{"200":{"description":"Search result.","headers":{"X-Credits-Remaining":{"$ref":"#/components/headers/CreditsRemaining"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchResult"}}}},"400":{"description":"pointId missing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/InsufficientCredits"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/EngineUnavailable"}}}},"/v1/collections/{id}/selfies":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"post":{"tags":["Selfies"],"summary":"Register a selfie","description":"Register a single-face selfie (Rekognition `IndexFaces` MaxFaces=1).\nReturns a `point_id` you can later pass to `search-by-id`.\n**Billable: 93 credits (real-time tier).**\nLike indexing, the first registration into a new `collection_id`\ncreates the collection, so the selfie is listed and is erased by\n`DELETE /v1/collections/{id}`. A registration the engine refuses\ncreates nothing and is not charged.\n","parameters":[{"name":"userId","in":"query","schema":{"type":"string"},"description":"Required (also accepted in body)."},{"name":"selfieId","in":"query","schema":{"type":"string"},"description":"Optional; defaults to a content hash."},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ImageInput"},{"type":"object","required":["userId"],"properties":{"userId":{"type":"string"},"selfieId":{"type":"string"}}}]}},"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"},"userId":{"type":"string"},"selfieId":{"type":"string"}}}}}},"responses":{"200":{"description":"Selfie processed (check face_found). On a settled idempotent replay of the SAME registration (same collection + userId + selfieId), the body is the reduced SelfieReplayResult and the Idempotent-Replay header is true.","headers":{"X-Credits-Remaining":{"$ref":"#/components/headers/CreditsRemaining"},"Idempotent-Replay":{"description":"Present and \"true\" ONLY on a settled idempotent replay; the body is a SelfieReplayResult.","schema":{"type":"string","enum":["true"]}}},"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/SelfieResult"},{"$ref":"#/components/schemas/SelfieReplayResult"}]}}}},"400":{"description":"userId missing or bad image.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/InsufficientCredits"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/EngineUnavailable"}}}},"/v1/detect":{"post":{"tags":["Faces"],"summary":"Detect faces (no storage)","description":"Detect + quality-gate faces in an image WITHOUT storing anything\n(Rekognition `DetectFaces`). **Billable: 93 credits (real-time tier).**\n","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageInput"}},"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"}}}},"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"responses":{"200":{"description":"Detection result.","headers":{"X-Credits-Remaining":{"$ref":"#/components/headers/CreditsRemaining"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DetectResult"}}}},"400":{"$ref":"#/components/responses/BadImage"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/InsufficientCredits"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/EngineUnavailable"}}}},"/v1/compare":{"post":{"tags":["Faces"],"summary":"Compare two faces","description":"Compare the best face in two images (Rekognition `CompareFaces`).\nReturns cosine similarity (0-1) and a match boolean at the configured\nthreshold.\n\n**Billable: 93 credits per image processed (real-time tier).** This is the\nONLY endpoint that can process two photos in one request, and billing is\nper photo processed:\n  - two images (source + target) → **186 credits**\n  - one image + one precomputed embedding → **93 credits**\n  - two precomputed embeddings → **93 credits** (one billable operation;\n    no image is fetched or run through the model)\nA side supplied as `source_embedding` / `target_embedding` is not a\nprocessed photo and is not charged as one.\n","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"Provide image refs OR precomputed embeddings for source & target.","properties":{"sourceUrl":{"type":"string"},"sourceGcsKey":{"type":"string"},"targetUrl":{"type":"string"},"targetGcsKey":{"type":"string"},"source_embedding":{"type":"array","items":{"type":"number"},"minItems":512,"maxItems":512},"target_embedding":{"type":"array","items":{"type":"number"},"minItems":512,"maxItems":512}}}}}},"responses":{"200":{"description":"Comparison result.","headers":{"X-Credits-Remaining":{"$ref":"#/components/headers/CreditsRemaining"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompareResult"}}}},"400":{"description":"Bad body or missing source/target.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/InsufficientCredits"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/EngineUnavailable"}}}},"/v1/wallet":{"get":{"tags":["Wallet & Usage"],"summary":"Get credit balance","description":"Returns your current prepaid credit balance. Free.","responses":{"200":{"description":"Balance.","content":{"application/json":{"schema":{"type":"object","properties":{"balance_credits":{"type":"integer","format":"int64","example":5000000}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/usage":{"get":{"tags":["Wallet & Usage"],"summary":"Usage report","description":"Per-operation usage aggregation. The window is either the last `days`\ndays (default 30, max 365) or a custom `from`/`to` range, which wins when\nboth parse. `to` is exclusive; a bare date such as `2026-11-02` means the\nend of that day, so the echoed `to` is the next midnight\n(`2026-11-03T00:00:00Z`). An empty or inverted range falls back to the 30\ndays before `to`. Free.\n","parameters":[{"name":"days","in":"query","schema":{"type":"integer","default":30,"maximum":365}},{"name":"from","in":"query","description":"Window start, inclusive (YYYY-MM-DD or RFC3339). Requires `to`.","schema":{"type":"string"}},{"name":"to","in":"query","description":"Window end, exclusive (YYYY-MM-DD or RFC3339); a bare date includes that whole day. Requires `from`.","schema":{"type":"string"}}],"responses":{"200":{"description":"Usage breakdown.","content":{"application/json":{"schema":{"type":"object","properties":{"days":{"type":"integer","example":30,"description":"Length of the returned window in days: the `days` you asked for, or for a `from`/`to` range the days it spans, rounded up."},"from":{"type":"string","format":"date-time","description":"Resolved window start (inclusive)."},"to":{"type":"string","format":"date-time","description":"Resolved window end (exclusive)."},"by_op":{"type":"array","items":{"type":"object","properties":{"op":{"type":"string","example":"index"},"calls":{"type":"integer","format":"int64"},"credits":{"type":"integer","format":"int64"}}}},"total_calls":{"type":"integer","format":"int64"},"total_credits":{"type":"integer","format":"int64"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/usage/daily":{"get":{"tags":["Wallet & Usage"],"summary":"Daily usage time series","description":"Daily spend time series for charting: each operation individually, a\ncombined operations line, and the daily face-vector storage charge — all\nindex-aligned to one dense UTC `dates` axis, so no client-side date\nalignment or gap filling is needed.\n\nWindow semantics match `GET /v1/usage`: a custom `from`/`to` range wins\nwhen both parse, otherwise `days` (default 30, max 365). Days with no\nactivity are present in the axis with `0` values.\n\nOperations and storage are kept as SEPARATE series because they are\ndifferent cost models (per-call vs per-day off stored vector count).\n`total_credits` is the per-day grand total (`ops_total_credits` +\n`storage.credits_owed`); it uses storage OWED, not debited, so the total\nreflects true cost even during a wallet shortfall or shadow mode.\n\nFree (0-credit) control-plane operation.\n","parameters":[{"name":"days","in":"query","schema":{"type":"integer","default":30,"maximum":365}},{"name":"from","in":"query","description":"Window start, inclusive (YYYY-MM-DD or RFC3339). Requires `to`.","schema":{"type":"string"}},{"name":"to","in":"query","description":"Window end, exclusive (YYYY-MM-DD or RFC3339); a bare date includes that whole day. Requires `from`.","schema":{"type":"string"}}],"responses":{"200":{"description":"Daily series. Every array is the same length as `dates`.","content":{"application/json":{"schema":{"type":"object","properties":{"days":{"type":"integer","example":30,"description":"Length of the returned window in days: the `days` you asked for, or for a `from`/`to` range the days it spans, rounded up."},"from":{"type":"string","format":"date-time","description":"Resolved window start (inclusive)."},"to":{"type":"string","format":"date-time","description":"Resolved window end (exclusive)."},"dates":{"type":"array","description":"Dense UTC day axis, oldest first. All series below are index-aligned to it.","items":{"type":"string","format":"date","example":"2026-07-12"}},"ops":{"type":"array","description":"Per-operation daily series, ordered by window spend descending.","items":{"type":"object","properties":{"op":{"type":"string","example":"index"},"calls":{"type":"array","items":{"type":"integer","format":"int64"}},"credits":{"type":"array","items":{"type":"integer","format":"int64"}},"total_calls":{"type":"integer","format":"int64"},"total_credits":{"type":"integer","format":"int64"}}}},"ops_total_credits":{"type":"array","description":"Combined per-day operations cost (Σ over ops). Excludes storage.","items":{"type":"integer","format":"int64"}},"ops_total_calls":{"type":"array","items":{"type":"integer","format":"int64"}},"storage":{"type":"object","description":"Daily face-vector storage cost on the same date axis.","properties":{"credits":{"type":"array","description":"Credits actually debited that day.","items":{"type":"integer","format":"int64"}},"credits_owed":{"type":"array","description":"Full daily charge owed (>= credits; the difference is uncollected arrears).","items":{"type":"integer","format":"int64"}},"vector_count":{"type":"array","description":"Stored face vectors that day (point-in-time stock, not a flow).","items":{"type":"integer","format":"int64"}},"total_credits":{"type":"integer","format":"int64"},"total_credits_owed":{"type":"integer","format":"int64"},"any_dry_run":{"type":"boolean","description":"True when at least one day in the window is a shadow-mode PROJECTION that was never billed. Clients must label such a series as a projection."}}},"total_credits":{"type":"array","description":"Per-day grand total = ops_total_credits + storage.credits_owed.","items":{"type":"integer","format":"int64"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/usage/storage":{"get":{"tags":["Wallet & Usage"],"summary":"Daily storage charges","description":"Your daily face-vector storage charges over the last `days` (default 90,\nmax 365), newest first. `credits` is what was debited; `credits_owed` is\nthe full charge (the difference is uncollected arrears during a wallet\nshortfall); `dry_run` marks a shadow-mode projection that was never\nbilled. Free.\n","parameters":[{"name":"days","in":"query","schema":{"type":"integer","default":90,"maximum":365}}],"responses":{"200":{"description":"Storage history.","content":{"application/json":{"schema":{"type":"object","properties":{"days":{"type":"integer"},"series":{"type":"array","items":{"type":"object","properties":{"billing_date":{"type":"string","format":"date"},"vector_count":{"type":"integer","format":"int64"},"credits":{"type":"integer","format":"int64"},"credits_owed":{"type":"integer","format":"int64"},"rate_credits_per_mvec_day":{"type":"integer","format":"int64","description":"Credits per million vectors per day."},"dry_run":{"type":"boolean"},"charged_at":{"type":["string","null"],"format":"date-time","description":"When this day's charge was debited (UTC). Day D is charged early on D+1. null when nothing was debited (a projection, or an empty wallet)."}}}},"total_credits":{"type":"integer","format":"int64"},"total_credits_owed":{"type":"integer","format":"int64"},"total_vector_days":{"type":"integer","format":"int64"},"latest_vector_count":{"type":"integer","format":"int64"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/batches":{"post":{"tags":["Batch"],"summary":"Submit a batch job","description":"Fire-and-forget bulk processing of up to 1000 **URL-only** photos.\nbase64 is rejected in batch — use real-time endpoints for inline images.\nResults arrive per-photo via your registered webhook, or poll\n`GET /v1/batches/{id}`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["collection_id","op","photos"],"properties":{"collection_id":{"type":"string"},"op":{"type":"string","enum":["index","match"]},"webhook_endpoint_id":{"type":"string","description":"Optional; an endpoint id from POST /v1/webhooks."},"photos":{"type":"array","maxItems":1000,"items":{"type":"object","required":["url"],"properties":{"url":{"type":"string","format":"uri"},"external_id":{"type":"string"}}}}}}}}},"responses":{"202":{"description":"Batch accepted.","content":{"application/json":{"schema":{"type":"object","properties":{"batch_id":{"type":"string"},"total_photos":{"type":"integer"},"status":{"type":"string","example":"processing","description":"A new batch starts as `processing`; it becomes `completed` once no photo is pending or claimed."},"message":{"type":"string"}}}}}},"400":{"description":"Validation error: missing fields, `op` not index|match, empty `photos`, base64 in batch, or more than 1000 photos (`{\"error\":\"batch too large\",\"max\":1000,\"received\":N}`). Per-photo URL problems are NOT rejected here; they surface per photo as `image_fetch_failed` (the URL could not be fetched: the host answered 404 or 410, or the host is not allowed or does not resolve), `image_access_denied` (403 or an expired signed URL), `image_too_large`, `image_corrupt` (the bytes are not a decodable image) or `image_invalid`. A 5xx or timeout from the image host is retried and ends as `retry_exhausted` if it persists. The real-time endpoints report a URL the host answers 4xx for differently: a 400 whose `reason_code` is `invalid_url`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"get":{"tags":["Batch"],"summary":"List batches","description":"List your most recent batches (newest first) with per-status job\ncounts. Keyset-paginated: when `has_more` is true, pass the returned\n`next_before_created` and `next_before_id` back as `before_created` and\n`before_id` to fetch the next page. Free.\n","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":25,"minimum":1,"maximum":100}},{"name":"before_created","in":"query","required":false,"description":"Cursor from the previous page's `next_before_created` (RFC3339).","schema":{"type":"string","format":"date-time"}},{"name":"before_id","in":"query","required":false,"description":"Cursor from the previous page's `next_before_id`.","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Recent batches.","content":{"application/json":{"schema":{"type":"object","properties":{"batches":{"type":"array","items":{"type":"object","properties":{"batch_id":{"type":"string"},"collection_id":{"type":"string"},"op":{"type":"string"},"status":{"type":"string"},"total_photos":{"type":"integer"},"succeeded":{"type":"integer"},"failed":{"type":"integer"},"pending":{"type":"integer"},"claimed":{"type":"integer"},"created_at":{"type":"string","format":"date-time"}}}},"has_more":{"type":"boolean"},"next_before_created":{"type":"string","format":"date-time","description":"Present when has_more is true."},"next_before_id":{"type":"string","format":"uuid","description":"Present when has_more is true."}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/batches/failed/requeue":{"post":{"tags":["Batch"],"summary":"Preview or execute a failed-photo retry wave","description":"Safely retries one bounded wave of eligible, uncharged terminal batch\nphotos for the authenticated customer. Only `insufficient_credits`,\n`internal_error`, and `retry_exhausted` are retryable. Charged photos,\nphotos with a live reservation, and photos already covered or in flight\nin another batch are excluded.\n\nFirst send scope fields with `execute` omitted or false. The response is\na ten-minute, one-time preview. Then send only its `preview_id` with\n`execute: true`. Execute uses the stored server-side scope and may requeue\nfewer photos when eligibility changed after preview.\n\nPreview never reserves or debits credits. `balance_credits` and\n`has_estimated_balance` are advisory snapshots. Workers reserve each\nretried photo's own price: the price fixed when it was submitted, if it\nhas one, otherwise the per-photo batch price. `estimated_credits` uses\nthe same rule, and `credits_per_photo` is the batch price unless every\nselected photo shares one fixed price.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/FailedBatchRetryScope"},{"$ref":"#/components/schemas/FailedBatchRetryExecute"}]},"examples":{"preview":{"value":{"reason_code":"insufficient_credits","limit":500,"created_after":"2026-07-01T00:00:00Z","created_before":"2026-07-18T00:00:00Z","stagger_seconds":1,"execute":false}},"execute":{"value":{"preview_id":"8c6d8f5d-c8cc-42d2-b04b-4ed45bcebe5e","execute":true}}}}}},"responses":{"200":{"description":"Preview created or one-time retry executed.","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/FailedBatchRetryPreview"},{"$ref":"#/components/schemas/FailedBatchRetryResult"}]},"examples":{"preview":{"value":{"preview_id":"8c6d8f5d-c8cc-42d2-b04b-4ed45bcebe5e","preview_expires_at":"2026-07-18T12:10:00Z","reason_code":"insufficient_credits","selected":500,"limit":500,"stagger_seconds":1,"execute":false,"credits_per_photo":62,"estimated_credits":31000,"balance_credits":5000000,"has_estimated_balance":true}},"execute":{"value":{"preview_id":"8c6d8f5d-c8cc-42d2-b04b-4ed45bcebe5e","reason_code":"insufficient_credits","preview_selected":500,"requeued":497,"batch_ids":["bb237a15-86a2-41d6-af78-a19d4b8f970b"],"execute":true}}}}}},"400":{"description":"Malformed JSON, non-retryable reason, invalid bounds/date range, or invalid request mode.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Read-only tenant-alias accounts cannot preview or execute retries.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Preview missing or owned by another customer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Preview expired or was already consumed (`preview_expired` or `preview_consumed`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Preview store or wallet lookup failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/batches/statuses":{"post":{"tags":["Batch"],"summary":"Get statuses for an explicit batch set","description":"Returns progress aggregates for up to 5,000 requested batch IDs in one\ntenant-scoped query. Missing or foreign-tenant IDs are omitted. Intended\nfor polling exact historical parent batches reopened by a retry wave.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["batch_ids"],"properties":{"batch_ids":{"type":"array","minItems":1,"maxItems":5000,"items":{"type":"string","format":"uuid"}}}}}}},"responses":{"200":{"description":"Owned requested batches, preserving first-requested order.","content":{"application/json":{"schema":{"type":"object","required":["batches"],"properties":{"batches":{"type":"array","items":{"$ref":"#/components/schemas/BatchStatus"}}}}}}},"400":{"description":"Invalid JSON, empty/oversized ID list, or malformed UUID.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/batches/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"tags":["Batch"],"summary":"Get batch status","description":"Poll a batch's progress (webhook-down fallback). Free.","responses":{"200":{"description":"Batch status.","content":{"application/json":{"schema":{"type":"object","properties":{"batch_id":{"type":"string"},"collection_id":{"type":"string"},"op":{"type":"string"},"status":{"type":"string"},"total_photos":{"type":"integer"},"succeeded":{"type":"integer"},"failed":{"type":"integer"},"pending":{"type":"integer"},"claimed":{"type":"integer"},"created_at":{"type":"string","format":"date-time"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/batches/{id}/photos":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"tags":["Batch"],"summary":"Get per-photo batch results","description":"Authoritative pull fallback for every photo in a batch. Results are\nkeyset-paginated by zero-based `photo_index`; use `next_after_index`\nwhile `has_more=true`. For an `op=match` batch each succeeded photo also\ncarries its match result (`matches`, `photo_ids`, and `reason` when set),\nthe same data the webhook sends, so a webhook is not required. Free.\n","parameters":[{"name":"limit","in":"query","description":"Page size. For an op=match batch the default and maximum are 100, because each row carries its match list.","schema":{"type":"integer","default":500,"minimum":1,"maximum":1000}},{"name":"after_index","in":"query","schema":{"type":"integer","minimum":0}}],"responses":{"200":{"description":"Per-photo batch outcomes.","content":{"application/json":{"schema":{"type":"object","properties":{"batch_id":{"type":"string"},"collection_id":{"type":"string"},"status":{"type":"string"},"total_photos":{"type":"integer"},"photos":{"type":"array","items":{"type":"object","properties":{"external_id":{"type":"string"},"photo_index":{"type":"integer"},"status":{"type":"string","enum":["pending","claimed","succeeded","failed"]},"face_count":{"type":"integer","description":"op=index only: faces stored from this photo (0 = no indexable face). Omitted on op=match rows, whose outcome is `matches` / `photo_ids` / `reason`."},"model_version":{"type":"string"},"reason_code":{"type":"string","description":"Present when status=failed. Same codes as the webhook `error.code`; see BatchWebhookEvent."},"matches":{"type":"array","description":"op=match, status=succeeded only: the matches found for this photo, as in the search response and the webhook `result`.","items":{"$ref":"#/components/schemas/Match"}},"photo_ids":{"type":"array","description":"op=match, status=succeeded only: matched photo ids, best first.","items":{"type":"string"}},"reason":{"type":"string","description":"op=match only, when no match could be attempted: no_face | low_quality_selfie."}}}},"has_more":{"type":"boolean"},"next_after_index":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/webhooks":{"post":{"tags":["Webhooks"],"summary":"Register a webhook endpoint","description":"Register an HTTPS URL to receive per-photo batch results and verified\ncollection-deletion completion events. We sign every delivery with\nHMAC-SHA256 over `timestamp.body`. If you omit `secret`, one is generated\nand returned **once**. Callback bodies are either\n[`BatchWebhookEvent`](#/components/schemas/BatchWebhookEvent) or\n[`DeletionWebhookEvent`](#/components/schemas/DeletionWebhookEvent).\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"url":{"type":"string","format":"uri","description":"Public HTTPS URL."},"secret":{"type":"string","description":"Optional signing secret; generated if omitted."}}}}}},"responses":{"200":{"description":"Endpoint registered.","content":{"application/json":{"schema":{"type":"object","properties":{"webhook_endpoint_id":{"type":"string"},"url":{"type":"string"},"status":{"type":"string"},"secret":{"type":"string","description":"Returned ONCE only when generated."},"note":{"type":"string"}}}}}},"400":{"description":"Invalid or non-HTTPS/private URL.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"503":{"description":"Webhook encryption key not configured.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["Webhooks"],"summary":"List webhook endpoints","parameters":[{"name":"status","in":"query","required":false,"description":"Filter endpoints by lifecycle. Omit for all endpoints.","schema":{"type":"string","enum":["active","inactive"]}}],"responses":{"200":{"description":"Your webhook endpoints.","content":{"application/json":{"schema":{"type":"object","properties":{"webhooks":{"type":"array","items":{"type":"object","properties":{"webhook_endpoint_id":{"type":"string"},"url":{"type":"string"},"status":{"type":"string","enum":["active","disabled"]},"created_at":{"type":"string","format":"date-time"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/webhooks/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"delete":{"tags":["Webhooks"],"summary":"Disable a webhook endpoint","description":"Stops new and queued deliveries for this endpoint. Historical delivery\nrecords remain available for audit and batch results remain pollable.\nRepeating the request is idempotent for the endpoint owner.\n","responses":{"200":{"description":"Endpoint disabled.","content":{"application/json":{"schema":{"type":"object","properties":{"webhook_endpoint_id":{"type":"string"},"status":{"type":"string","enum":["disabled"]}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Read-only accounts cannot disable endpoints.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/webhooks/dead-letters":{"get":{"tags":["Webhooks"],"summary":"List dead-lettered webhook deliveries","description":"Lists delivery metadata after the retry budget is exhausted. Payloads and signing secrets are never returned.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","default":50,"minimum":1,"maximum":200}}],"responses":{"200":{"description":"Dead-lettered deliveries owned by the caller.","content":{"application/json":{"schema":{"type":"object","properties":{"dead_letters":{"type":"array","items":{"type":"object","properties":{"delivery_id":{"type":"string"},"webhook_endpoint_id":{"type":"string"},"url":{"type":"string","format":"uri"},"idempotency_key":{"type":"string"},"attempts":{"type":"integer"},"failed_at":{"type":"string","format":"date-time"},"last_status_code":{"type":"integer"},"last_error":{"type":"string"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/webhooks/dead-letters/replay":{"post":{"tags":["Webhooks"],"summary":"Replay dead-lettered webhook deliveries","description":"Requeues selected deliveries, or every eligible delivery when the body is absent. Stable idempotency keys are preserved.","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"delivery_ids":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"Replay accepted.","content":{"application/json":{"schema":{"type":"object","properties":{"requeued":{"type":"integer"}}}}}},"400":{"description":"Invalid JSON body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Read-only accounts cannot replay deliveries.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/portal/keys":{"get":{"tags":["API Keys"],"summary":"List API keys","description":"Returns your keys' non-secret metadata. Free.","responses":{"200":{"description":"Keys.","content":{"application/json":{"schema":{"type":"object","properties":{"keys":{"type":"array","items":{"$ref":"#/components/schemas/ApiKeyMeta"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["API Keys"],"summary":"Create an API key","description":"Mints a new key. The `plaintext` is returned **once** and is never\nrecoverable afterward. Max 50 active keys per account.\n","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","example":"production-key"}}}}}},"responses":{"201":{"description":"Key created (plaintext shown once).","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"prefix":{"type":"string"},"name":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"plaintext":{"type":"string","example":"frs_a1b2c3d4_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"description":"Active key limit reached.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/portal/keys/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"delete":{"tags":["API Keys"],"summary":"Revoke an API key","responses":{"200":{"description":"Revoked.","content":{"application/json":{"schema":{"type":"object","properties":{"revoked":{"type":"boolean","example":true}}}}}},"400":{"description":"Invalid key id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/portal/profile":{"get":{"tags":["Profile"],"summary":"Get your profile","description":"Returns your account profile — email and display name (set at signup) plus the optional self-serve fields (first name, last name, organization). Free.\n","responses":{"200":{"description":"Profile.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Profile"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"put":{"tags":["Profile"],"summary":"Update your profile","description":"Update the optional profile fields. All fields are optional; send an empty string to clear one. first_name/last_name are capped at 100 chars, organization at 200. These fields are descriptive only — they never affect auth, billing, or data access. Free.\n","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"first_name":{"type":"string","maxLength":100,"example":"Jane"},"last_name":{"type":"string","maxLength":100,"example":"Doe"},"organization":{"type":"string","maxLength":200,"example":"Acme"}}}}}},"responses":{"200":{"description":"Updated profile.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Profile"}}}},"400":{"description":"A field exceeds its maximum length, or the body is malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/portal/auto-recharge":{"get":{"tags":["Wallet & Usage"],"summary":"Get auto-recharge config","description":"Returns your auto-recharge settings and mandate state. Free.","responses":{"200":{"description":"Config.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoRecharge"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Wallet not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["Wallet & Usage"],"summary":"Update auto-recharge config","description":"Enable/disable auto-recharge and set the threshold + recharge amount.\nEnabling requires a positive threshold and a recharge amount ≥ the\nplatform minimum top-up. A payment mandate must be authorized separately\nin the portal before the sweep will act.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"threshold_credits":{"type":"integer","format":"int64"},"recharge_credits":{"type":"integer","format":"int64"}}}}}},"responses":{"200":{"description":"Updated config.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoRecharge"}}}},"400":{"description":"Validation error (negative amounts, below minimum, no threshold).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Wallet not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"frs_<prefix>_<secret>","description":"Send your API key as: Authorization: Bearer frs_<prefix>_<secret>"}},"parameters":{"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"},"description":"Opt-in idempotency. A replay under the same key is never re-charged. For a selfie register it returns 200 with the stored result (Idempotent-Replay: true) when the registration identity matches; every other op returns 409."}},"headers":{"CreditsRemaining":{"description":"Your credit balance after this billable call.","schema":{"type":"integer","format":"int64"}}},"responses":{"Unauthorized":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"unauthorized"}}}},"NotFound":{"description":"Resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"InvalidCollectionId":{"description":"The collection id is \".\", \"..\", or contains '/', '\\' or a control character. Same message as create.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"BadImage":{"description":"Cannot decode image, or no url/gcsKey/body provided.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"InsufficientCredits":{"description":"Wallet balance too low for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"insufficient credits"}}}},"DuplicateRequest":{"description":"A request with this Idempotency-Key is in flight or already processed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"ImageTooLarge":{"description":"Image exceeds the 30 MB encoded size cap.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"RateLimited":{"description":"Per-key RPS or per-customer concurrency limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"EngineUnavailable":{"description":"Engine error (the credit hold is refunded automatically).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"error_code":{"type":"string","description":"Stable machine-readable code for structured errors."},"error_detail":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"hint":{"type":"string","description":"How to fix the request, when the gateway has one."},"docs_url":{"type":"string","format":"uri"}}}}},"SubjectDeleteResponse":{"type":"object","required":["collection_id","deleted","deleted_selfie_ids","deleted_user_ids","unsuccessful","deleted_count","mode","compliance","verified","restorable"],"properties":{"collection_id":{"type":"string"},"selfie_id":{"type":"string","description":"The selfieId from the path (selfie delete only)."},"user_id":{"type":"string","description":"The userId from the path (user delete) or from `?userId=` (selfie delete, only when given)."},"deleted":{"type":"array","items":{"type":"string"},"description":"Point ids of the removed selfies (the `point_id` returned at registration, the Rekognition FaceId analog). Empty when nothing was stored."},"deleted_selfie_ids":{"type":"array","items":{"type":"string"},"description":"The selfieIds that were removed."},"deleted_user_ids":{"type":"array","items":{"type":"string"},"description":"The userIds whose selfies were removed."},"unsuccessful":{"type":"array","items":{"type":"object"},"description":"Always empty: a delete that cannot be completed is a 503, never a partial 200."},"deleted_count":{"type":"integer","description":"Number of entries in `deleted`."},"mode":{"type":"string","enum":["immediate"],"description":"Always immediate; selfie and user deletes have no soft mode."},"compliance":{"type":"boolean","description":"Echoes `?compliance=true`."},"verified":{"type":"boolean","description":"Always true on a 200. The engine checked that no matching selfie remains."},"restorable":{"type":"boolean","description":"Always false; there is no restore for a selfie or user delete."}}},"FailedBatchRetryScope":{"type":"object","additionalProperties":false,"required":["reason_code"],"properties":{"reason_code":{"type":"string","enum":["insufficient_credits","internal_error","retry_exhausted"]},"limit":{"type":"integer","default":500,"minimum":1,"maximum":5000},"created_after":{"type":"string","format":"date-time","description":"Inclusive original job creation bound."},"created_before":{"type":"string","format":"date-time","description":"Exclusive original job creation bound."},"stagger_seconds":{"type":"integer","default":1,"minimum":0,"maximum":60},"execute":{"type":"boolean","const":false,"default":false}}},"FailedBatchRetryExecute":{"type":"object","additionalProperties":false,"required":["preview_id","execute"],"properties":{"preview_id":{"type":"string","format":"uuid"},"execute":{"type":"boolean","const":true}}},"FailedBatchRetryPreview":{"type":"object","required":["preview_id","preview_expires_at","reason_code","selected","limit","stagger_seconds","execute","credits_per_photo","estimated_credits","balance_credits","has_estimated_balance"],"properties":{"preview_id":{"type":"string","format":"uuid"},"preview_expires_at":{"type":"string","format":"date-time"},"reason_code":{"type":"string","enum":["insufficient_credits","internal_error","retry_exhausted"]},"selected":{"type":"integer","format":"int64","minimum":0},"limit":{"type":"integer","minimum":1,"maximum":5000},"stagger_seconds":{"type":"integer","minimum":0,"maximum":60},"execute":{"type":"boolean","const":false},"credits_per_photo":{"type":"integer","format":"int64","minimum":0},"estimated_credits":{"type":"integer","format":"int64","minimum":0},"balance_credits":{"type":"integer","format":"int64"},"has_estimated_balance":{"type":"boolean","description":"Advisory snapshot only; no credits are reserved by preview."}}},"FailedBatchRetryResult":{"type":"object","required":["preview_id","reason_code","preview_selected","requeued","batch_ids","execute"],"properties":{"preview_id":{"type":"string","format":"uuid"},"reason_code":{"type":"string","enum":["insufficient_credits","internal_error","retry_exhausted"]},"preview_selected":{"type":"integer","format":"int64","minimum":0},"requeued":{"type":"integer","format":"int64","minimum":0},"batch_ids":{"type":"array","description":"Exact parent batches reopened by this execution, for direct status polling.","items":{"type":"string","format":"uuid"}},"execute":{"type":"boolean","const":true}}},"BatchStatus":{"type":"object","required":["batch_id","collection_id","op","status","total_photos","succeeded","failed","pending","claimed","created_at"],"properties":{"batch_id":{"type":"string","format":"uuid"},"collection_id":{"type":"string"},"op":{"type":"string"},"status":{"type":"string"},"total_photos":{"type":"integer","minimum":0},"succeeded":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"pending":{"type":"integer","minimum":0},"claimed":{"type":"integer","minimum":0},"created_at":{"type":"string","format":"date-time"}}},"Collection":{"type":"object","properties":{"collection_id":{"type":"string"},"status":{"type":"string","enum":["active","deletion_pending","deleting","deleted"],"example":"active"},"counts_source":{"type":"string","description":"Where the counts came from: `postgres` = the gateway's count registry (the normal case), `engine` = a live read from the engine (a collection whose registry counts are not ready yet, or `?verify=true`).","example":"postgres"},"photo_count":{"type":"integer","format":"int64"},"face_count":{"type":"integer","format":"int64"},"selfie_count":{"type":"integer","format":"int64"},"created_at":{"type":"string","format":"date-time"},"purge_after":{"type":"string","format":"date-time","description":"Present on `deletion_pending` collections: when the soft delete becomes permanent."}}},"ImageInput":{"type":"object","description":"Provide exactly one image source.","properties":{"url":{"type":"string","format":"uri","description":"Public image URL."},"gcsKey":{"type":"string","description":"Google Cloud Storage object key."},"photoId":{"type":"string","description":"Optional per-image key."}}},"SearchInput":{"type":"object","description":"Provide an embedding OR an image source.","properties":{"embedding":{"type":"array","items":{"type":"number"},"minItems":512,"maxItems":512},"url":{"type":"string","format":"uri"},"gcsKey":{"type":"string"},"threshold":{"type":"number","description":"Min cosine similarity (0-1)."},"limit":{"type":"integer","description":"Max matches."}}},"BBox":{"type":"object","description":"Face location as RATIOS of the image dimensions (0-1, top-left origin), the same convention as Rekognition's BoundingBox. Multiply by the source width/height for pixels.","required":["left","top","width","height"],"properties":{"left":{"type":"number","minimum":0,"maximum":1,"example":0.4146},"top":{"type":"number","minimum":0,"maximum":1,"example":0.3815},"width":{"type":"number","minimum":0,"maximum":1,"example":0.3995},"height":{"type":"number","minimum":0,"maximum":1,"example":0.4385}}},"IndexedFace":{"type":"object","properties":{"face_index":{"type":"integer"},"point_id":{"type":"string","description":"The faceId analog; usable with search-by-id."},"det_score":{"type":"number"},"min_px":{"type":"number","description":"Shorter side of the face box, in source pixels (fractional)."},"bbox":{"$ref":"#/components/schemas/BBox"}}},"IndexResult":{"type":"object","properties":{"collection_id":{"type":"string"},"photo_id":{"type":"string"},"indexed":{"type":"integer","description":"Faces stored."},"detected_face_count":{"type":"integer"},"rejected_face_count":{"type":"integer","description":"Detected but quality-gated out."},"faces":{"type":"array","items":{"$ref":"#/components/schemas/IndexedFace"}},"model_version":{"type":"string"}}},"Match":{"type":"object","properties":{"photo_id":{"type":"string"},"score":{"type":"number","description":"Cosine similarity (0-1)."}}},"SearchResult":{"type":"object","properties":{"collection_id":{"type":"string"},"matches":{"type":"array","items":{"$ref":"#/components/schemas/Match"}},"photo_ids":{"type":"array","items":{"type":"string"}},"reason":{"type":"string","description":"Present when no match: no_face | low_quality_selfie | point_not_found."},"model_version":{"type":"string"}}},"SelfieResult":{"type":"object","properties":{"face_found":{"type":"boolean"},"reason":{"type":"string","description":"no_face when face_found=false."},"collection_id":{"type":"string"},"user_id":{"type":"string"},"selfie_id":{"type":"string"},"point_id":{"type":"string","description":"Pass to search-by-id."},"embedding":{"type":"array","items":{"type":"number"},"description":"512-d L2-normalized vector."},"det_score":{"type":"number"},"quality_passed":{"type":"boolean"},"model_version":{"type":"string"}}},"SelfieReplayResult":{"type":"object","description":"Body returned on a SETTLED idempotent replay of a selfie register (served with the Idempotent-Replay: true header). It recovers the identity fields the gateway persisted at settle time; it deliberately OMITS the volatile embedding / det_score / quality_passed / model_version of the original response (the gateway never persisted them). face_found is always true (a point_id was stored) and replayed is always true.","properties":{"face_found":{"type":"boolean","enum":[true]},"collection_id":{"type":"string"},"user_id":{"type":"string"},"selfie_id":{"type":"string"},"point_id":{"type":"string","description":"Pass to search-by-id."},"replayed":{"type":"boolean","enum":[true]}}},"DetectedFace":{"type":"object","properties":{"face_index":{"type":"integer"},"det_score":{"type":"number"},"min_px":{"type":"number","description":"Shorter side of the face box, in source pixels (fractional)."},"bbox":{"$ref":"#/components/schemas/BBox"},"quality_passed":{"type":"boolean"}}},"DetectResult":{"type":"object","properties":{"detected_face_count":{"type":"integer"},"gated_face_count":{"type":"integer"},"faces":{"type":"array","items":{"$ref":"#/components/schemas/DetectedFace"}}}},"CompareResult":{"type":"object","properties":{"face_found":{"type":"boolean"},"similarity":{"type":["number","null"],"description":"Cosine similarity (0-1)."},"match":{"type":"boolean"},"threshold":{"type":"number"}}},"ApiKeyMeta":{"type":"object","properties":{"id":{"type":"string"},"prefix":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","example":"active"},"created_at":{"type":"string","format":"date-time"},"last_used_at":{"type":["string","null"],"format":"date-time"}}},"Profile":{"type":"object","properties":{"customer_id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"name":{"type":"string","description":"Display name, set at signup.","example":"Jane Doe"},"first_name":{"type":"string","example":"Jane"},"last_name":{"type":"string","example":"Doe"},"organization":{"type":"string","example":"Acme"}}},"AutoRecharge":{"type":"object","properties":{"enabled":{"type":"boolean"},"threshold_credits":{"type":"integer","format":"int64"},"recharge_credits":{"type":"integer","format":"int64"},"has_mandate":{"type":"boolean"},"dodo_customer_id":{"type":"string"},"failures":{"type":"integer"},"min_topup_credits":{"type":"integer","format":"int64"},"retry_after":{"type":"string","format":"date-time","description":"Set while auto-recharge waits after a temporary bank decline: no charge is attempted before this time. Omitted when not waiting. Re-enabling or changing the recharge amount clears it."}}},"BatchWebhookEvent":{"type":"object","description":"The signed per-photo callback body POSTed to your registered webhook URL,\none delivery per photo in a batch. Signature headers accompany every\ndelivery: `X-SightRadar-Timestamp` (unix seconds), `X-SightRadar-Signature`\n(`hex(HMAC-SHA256(secret, \"<timestamp>.<rawbody>\"))`), and\n`X-SightRadar-Idempotency-Key` (`wh:<job-id>`, stable per result — dedupe on\nit). Verify the HMAC over the RAW body and reject timestamps older than a\nfew minutes. Delivery is at-least-once; return 2xx once persisted.\n","required":["batch_id","external_id","photo_index","status","charged","processed_at"],"properties":{"batch_id":{"type":"string","description":"The batch this photo belonged to."},"external_id":{"type":"string","description":"Your per-photo id echoed from submit (empty string if you didn't set one)."},"photo_index":{"type":"integer","description":"Zero-based position of this photo in the submitted batch."},"status":{"type":"string","enum":["succeeded","failed"],"description":"Per-photo terminal outcome."},"charged":{"type":"boolean","description":"Whether this photo was billed (a rejected/failed photo is not charged)."},"processed_at":{"type":"string","format":"date-time","description":"Gateway event time (RFC3339, UTC)."},"result":{"type":"object","description":"Present on status=succeeded. face_count==0 with status=succeeded means a valid image with no indexable face.","properties":{"face_count":{"type":"integer","description":"Faces indexed for this photo (0 = no face)."},"detected_face_count":{"type":"integer","description":"Faces detected pre-quality-gate."},"faces":{"type":"array","items":{"$ref":"#/components/schemas/IndexedFace"}},"model_version":{"type":"string"}}},"error":{"type":"object","description":"Present on status=failed.","properties":{"code":{"type":"string","description":"Failure reason. One of insufficient_credits | image_fetch_failed | image_access_denied | image_corrupt | image_too_large | image_invalid | invalid_collection_id | already_indexed | index_in_progress | photo_id_in_other_collection | retry_exhausted | cancelled_collection_deleted | internal_error; treat any other value as a generic failure, since new codes may be added. image_fetch_failed means the URL could not be fetched: the image host answered 404 or 410, or the host is not allowed or does not resolve (the real-time endpoints report the same URL as a 400 with reason_code invalid_url); image_corrupt means the bytes were fetched but are not a decodable image. photo_id_in_other_collection means this account's photo_ids are unique across collections and this one is already indexed in another collection; nothing was written and the photo was not charged. retry_exhausted means transient engine errors outlasted the retry budget. cancelled_collection_deleted means the collection was hard-deleted before the photo was processed; the photo was not indexed and not charged, and it cannot be requeued."},"message":{"type":"string","description":"Human-readable explanation."}}}}},"DeletionWebhookEvent":{"type":"object","description":"Signed callback emitted after the engine has verified that a collection's\nvectors are gone. It uses the same signature headers and at-least-once\ndelivery contract as `BatchWebhookEvent`. The idempotency key is\n`whdel:<workflow-id>:<endpoint-id>`.\n","required":["event","collection_id","workflow_id","status","verified_zero","processed_at"],"properties":{"event":{"type":"string","enum":["collection.deletion.completed"]},"collection_id":{"type":"string"},"workflow_id":{"type":"string"},"status":{"type":"string","enum":["completed"]},"verified_zero":{"type":"boolean","const":true},"processed_at":{"type":"string","format":"date-time"}}}}}}