REST API: working with faces

Search by biometric vectors

Search your person lists with stored vectors.

Purpose

Use this call when you already hold the vector representation of a face, for example from the compare call with embedding, and want to search your person lists with it. Each vector is searched separately.

Request

POST <API_BASE_URL>/vector/search. All calls are POST under your API address. Replace <API_BASE_URL> with the API address provided with your access.

Send a permanent API token in the token field of the body, or a user token in the token header. See authentication.

Content type: application/json.

FieldTypeRequiredDescription
tokenstring (uuid)if no headerYour permanent API token. Required unless you send a user token in the token header.
embeddingsstring or array of stringyesOne vector or an array of vectors, base64 encoded.
list_idsstring or array of string (uuid)noThe person list or lists to search.
thresholdstring or numbernoThe distance threshold of a match.
resultsstring or numbernoHow many matching persons to return per vector.
person_databooleannoInclude person data in the matches.

Response

HTTP 200. The search finished.

FieldTypeDescription
statusstringAlways ok on this body.
resultsarray of array of objectOne entry per vector you sent, in the order you sent them. Each entry is a list of matches.

Errors

  • 400: The body failed validation. The answer has status of error and a details list with one entry per offending field (path, expected, actual).
  • 401: The token is missing, expired or unknown.
  • 404: A referenced entity does not exist.

A refusal can also come before the operation runs: an address outside your IP allowlist, a token bound to another address, or a body that is not valid JSON. See response format and errors.

Example

Request:

curl -X POST "<API_BASE_URL>/vector/search" \
  -H "Content-Type: application/json" \
  -d '{
    "token": "<your permanent API token>",
    "embeddings": [
      "<base64 vector>"
    ],
    "list_ids": [
      "<person list id>"
    ],
    "results": 5
  }'

Response:

{
  "status": "ok",
  "results": [
    []
  ]
}

Questions about the face API?

Write to us and we will help.

Talk to us