The full path
1
Verify connectivity and credentials
200 confirms the base URL and api-key are correct. A 401 means an invalid key or the wrong environment. Check the status code, not the body: version numbers change and are not part of your contract.2
Prepare the image
Capture or receive a JPEG, resize it to the recommended dimensions, and encode it as base64 with no prefix.
3
Call POST /inference
A single JSON body with
image, info, and logAnonymity.4
Apply the decision rule
status === 200 && spoofing === false approves. Everything else does not.Image requirements
Encoding to base64
-w 0 suppresses the line breaks base64 inserts every 76 characters. Without that flag the string arrives split and the service cannot decode it.
Request body
The info field in the response
This is where most integrations break. info is not always the same type:
Resolve it in one place and never read
info directly:
Timeouts and retries
Before going to production
An integration is ready when you can answer yes to all of these:- The decision is written in the positive:
status === 200 && spoofing === false. - No branch decides on
errorCode,values,confidence, orinfo. infois read through a single resolver that handles object, string, andnull.- In typed languages,
infois declared as a dynamic type orObject. imageQualityand its subfields are read as optional; no key is assumed present.- Images are sent at 640 × 480 with JPEG quality ≥ 95.
- A pre-check discards images smaller than 224 × 224 before spending a call.
- base64 is generated with no
data:prefix and no line breaks. - The timeout is set to 30 s.
- Retries are capped at 2 and limited to
499and non-deterministic500s. - Every transaction
idis logged, along with the environment and a timestamp. - The api-key lives only in the backend, in a secret manager, not in source.
- The team knows that
422 No Face Detectedis a capture problem and422 Bad requestis a code problem.
Responses
Next: what every response field means and how to read the diagnostics.