> ## Documentation Index
> Fetch the complete documentation index at: https://venator-06aff335.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Face Search (One to Many)

Identify a person by searching a facial image against a database of enrolled identities. The service performs biometric face comparison and returns potential matching identities with similarity scores.

<div
  style={{
display: "inline-flex",
alignItems: "center",
background: "#fff",
borderRadius: "12px",
padding: "16px 24px",
border: "1px solid #e5e7eb",
boxShadow: "0 1px 3px rgba(0,0.05)",
fontFamily: "monospace",
gap: "16px"
}}
>
  <span
    style={{
color: "#2563eb",
fontWeight: "700",
fontSize: "18px",
letterSpacing: "0.5px"
}}
  >
    POST
  </span>

  <span
    style={{
fontSize: "14px",
color: "#4b5563"
}}
  >
    /api/gw/services/face\_search
  </span>
</div>

***

### Authorizations

<ResponseField name="x-api-key" type="string" required>
  API key used to authenticate the request.
</ResponseField>

***

### Body

<ResponseField name="imageBase64" type="string" required>
  Base64 encoded facial image to search against the identity database.
</ResponseField>

<ResponseField name="threshold" type="number">
  Minimum similarity score threshold for returning matches (0 to 1).
</ResponseField>

<ResponseField name="topK" type="number">
  Maximum number of matching identities to return.
</ResponseField>

***

### Response

<Tabs>
  <Tab title="200">
    <ResponseField name="success" type="boolean">
      Indicates whether the request was processed successfully.
    </ResponseField>

    <ResponseField name="requestId" type="string">
      Unique identifier for the API request.
    </ResponseField>

    <ResponseField name="correlationId" type="string">
      Identifier used for tracing the request across systems.
    </ResponseField>

    <ResponseField name="data" type="object">
      Contains face search results.
    </ResponseField>

    <ResponseField name="data.matches" type="array">
      List of identities matching the submitted facial image.
    </ResponseField>

    <ResponseField name="data.matches[].identityId" type="string">
      Unique identifier of the matched identity.
    </ResponseField>

    <ResponseField name="data.matches[].similarityScore" type="number">
      Similarity score between the submitted face and matched identity (0 to 1).
    </ResponseField>

    <ResponseField name="data.matches[].confidence" type="number">
      Confidence score of the biometric match.
    </ResponseField>

    <ResponseField name="error" type="object | null">
      Contains error details if the request fails; otherwise null.
    </ResponseField>

    <ResponseField name="durationMs" type="number">
      Time taken to process the request in milliseconds.
    </ResponseField>

    <ResponseField name="processedAt" type="string">
      Timestamp when the request was processed (ISO 8601 format).
    </ResponseField>
  </Tab>

  <Tab title="400">
    <ResponseField name="error" type="string">
      Error message returned when face search processing fails.
    </ResponseField>
  </Tab>
</Tabs>

***

<RequestExample>
  ```bash Curl theme={null}
  curl -X POST "https://dev-idf-gw.cognetlabs.org/api/gw/services/face_search" \
  -H "Content-Type: application/json" \
  -d '{
    "imageBase64": "<base64-face-image>",
    "threshold": 0.85,
    "topK": 5
  }'
  ```

  ```python Python theme={null}
  import requests

  url = "https://dev-idf-gw.cognetlabs.org/api/gw/services/face_search"

  payload = {
      "imageBase64": "<base64-face-image>",
      "threshold": 0.85,
      "topK": 5
  }

  res = requests.post(url, json=payload)
  print(res.json())
  ```

  ```javascript JavaScript theme={null}
  fetch("https://dev-idf-gw.cognetlabs.org/api/gw/services/face_search", {
    method: "POST",
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      imageBase64: "<base64-face-image>",
      threshold: 0.85,
      topK: 5
    })
  })
  .then(res => res.json())
  .then(console.log);
  ```

  ```php PHP theme={null}
  <?php
  $url = "https://dev-idf-gw.cognetlabs.org/api/gw/services/face_search";

  $data = [
    "imageBase64" => "<base64-face-image>",
    "threshold" => 0.85,
    "topK" => 5
  ];

  $options = [
    "http" => [
      "header"  => "Content-Type: application/json\r\nx-api-key: YOUR_API_KEY",
      "method"  => "POST",
      "content" => json_encode($data),
    ],
  ];

  $context = stream_context_create($options);
  $result = file_get_contents($url, false, $context);

  echo $result;
  ?>
  ```

  ```go Go theme={null}
  package main

  import (
  	"bytes"
  	"net/http"
  )

  func main() {

  	jsonData := []byte(`{
  		"imageBase64":"<base64-face-image>",
  		"threshold":0.85,
  		"topK":5
  	}`)

  	req, _ := http.NewRequest(
  		"POST",
  		"https://dev-idf-gw.cognetlabs.org/api/gw/services/face_search",
  		bytes.NewBuffer(jsonData),
  	)

  	req.Header.Set("Content-Type", "application/json")
  	req.Header.Set("x-api-key", "YOUR_API_KEY")

  	client := &http.Client{}
  	client.Do(req)
  }
  ```

  ```java Java theme={null}
  import okhttp3.*;

  public class Main {
      public static void main(String[] args) throws Exception {

          OkHttpClient client = new OkHttpClient();

          String json = "{\"imageBase64\":\"<base64-face-image>\", \"threshold\":0.85, \"topK\":5 }";

          RequestBody body = RequestBody.create(
              json, MediaType.parse("application/json")
          );

          Request request = new Request.Builder()
              .url("https://dev-idf-gw.cognetlabs.org/api/gw/services/face_search")
              .addHeader("x-api-key", "YOUR_API_KEY")
              .post(body)
              .build();

          Response response = client.newCall(request).execute();

          System.out.println(response.body().string());
      }
  }
  ```

  ```ruby Ruby theme={null}
  require 'net/http'
  require 'uri'
  require 'json'

  uri = URI.parse("https://dev-idf-gw.cognetlabs.org/api/gw/services/face_search")

  header = {
    'Content-Type': 'application/json',
    'x-api-key': 'YOUR_API_KEY'
  }

  payload = {
    imageBase64: "<base64-face-image>",
    threshold: 0.85,
    topK: 5
  }

  http = Net::HTTP.new(uri.host, uri.port)
  request = Net::HTTP::Post.new(uri.request_uri, header)
  request.body = payload.to_json

  response = http.request(request)

  puts response.body
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "requestId": "8fa921c45",
    "correlationId": "58664e8f17d1452ea3b171e7a90e09bf",
    "data": {
      "matches": [
        {
          "identityId": "USER_10045",
          "similarityScore": 0.96,
          "confidence": 0.98
        }
      ]
    },
    "error": null,
    "durationMs": 420,
    "processedAt": "2026-04-29T13:59:35.9472104Z"
  }
  ```

  ```json 400 theme={null}
  {
    "error": "ImageBase64 is required"
  }
  ```
</ResponseExample>
