Skip to content

Face

This endpoint takes one image and returns the list of the faces found in it. For each face you get where it is in the image (boundingBox), its crop in base64, and the attributes estimated by the detector — apparent age and gender.

It is an endpoint for analyzing a single image in isolation. It does not check the face against anything.

🚧 Face and Face Match do not do the same thing

This is the most common confusion between the two neighboring endpoints:

  • Face (this page) — takes one image and describes the faces that exist in it. There is no comparison.
  • Face Match — takes two images and answers whether the face in one is the same person as the other.

If what you want is to compare a selfie with the photo on a document, the endpoint is Face Match, not this one.

This endpoint also does not perform liveness (use Liveness) and does not identify the person or query official databases.

Request

POST /face/v1

Headers

http
Authorization: ApiKey <your-api-key>

This endpoint also accepts the JWT token, in the format Authorization: Bearer <accessToken>. See JWT Token.

Parameters

All are optional, in the query string.

ParameterDescriptionRequired
shouldRotateFaceWhen true, the face crop is rotated before being returned. Default: false.No
shouldReturnConfidenceWhen true, each item of data also carries the confidence field of the detection. Default: false.No
faceCropProportionProportion used in the face crop. Decimal number, default 1.No

TIP

shouldRotateFace and shouldReturnConfidence are turned on only by the exact value true. Any other value — including 1 or TRUE — is treated as false.

Accepted files

ItemValue
Formatsimage/png, image/jpeg
Files per call1 file
Maximum size (multipart)15 MB

The form field name is up to you — use whatever makes sense in your integration. If more than one file is sent, the request is rejected with 422.

🚧 This endpoint does not accept PDF

Unlike Face Match, only PNG and JPEG images go in here. Sending a PDF results in 422.

Besides multipart/form-data, the file can be sent as JSON, in the base64 field, as described in Sending files.

Example request

bash
curl -i -X POST 'https://api-homolog.nxcd.app/face/v1' \
  --header 'Authorization: ApiKey YOUR_API_KEY' \
  --form 'foto=@./foto.jpg'

With the optional parameters:

bash
curl -i -X POST 'https://api-homolog.nxcd.app/face/v1?shouldReturnConfidence=true&faceCropProportion=1.5' \
  --header 'Authorization: ApiKey YOUR_API_KEY' \
  --form 'foto=@./foto.jpg'

Response

FieldDescriptionType
idUnique identifier of the requestString
versionAPI version that served the callString
dataList with one entry per face found in the image. Comes back empty when no face is found.Object[]
data[].confidenceConfidence of the face detection. Only appears when shouldReturnConfidence=true.Number
data[].ageApparent age estimated for the faceNumber
data[].genderObject with the apparent gender estimated for the faceObject
data[].gender.valueApparent gender: Male or FemaleString
data[].gender.confidenceConfidence of the gender estimate, from 0 to 100Number
data[].boundingBoxPosition of the face in the original image. The four values are proportions of the image, between 0 and 1.Object
data[].boundingBox.topStart of the face on the Y axisNumber
data[].boundingBox.leftStart of the face on the X axisNumber
data[].boundingBox.widthWidth of the faceNumber
data[].boundingBox.heightHeight of the faceNumber
data[].croppedBase64Crop of the face in base64, ready to use in HTMLString
metadataObject with the metadata of the requestObject
metadata.filesInfoList with the information of the file sentObject[]
metadata.filesInfo[].fieldnameName of the field used to send the fileString
metadata.filesInfo[].nameName of the file sentString
metadata.filesInfo[].sizeSize of the file, in bytesNumber
metadata.filesInfo[].mimetypeType of the file sentString
metadata.filesInfo[].encodingEncoding of the file as sentString
metadata.filesInfo[].sha256SHA-256 hash of the file sentString
metadata.timeSpentProcessing time of the request, in millisecondsNumber

TIP

data is a list, not an object: a photo with three people returns three entries. No face detected returns 200 with "data": [] — that is not an error.

JSON examples

  1. One face found
Status Code: 200
json
{
  "id": "13cfec7c-b238-4820-a4d1-5173e4c1418e",
  "version": "v1",
  "data": [
    {
      "age": 34,
      "gender": {
        "value": "Male",
        "confidence": 99.72
      },
      "boundingBox": {
        "top": 0.11424895375967026,
        "left": 0.26937249302864075,
        "width": 0.42325547337532043,
        "height": 0.6968063116073608
      },
      "croppedBase64": "iVBORw0KGgoAAAANSUhEUgAAAlgAAAJYCAMAAA...K5CYII="
    }
  ],
  "metadata": {
    "filesInfo": [
      {
        "fieldname": "foto",
        "name": "foto.jpg",
        "size": 196965,
        "mimetype": "image/jpeg",
        "encoding": "7bit",
        "sha256": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
      }
    ],
    "timeSpent": 1230
  }
}
  1. No face found
Status Code: 200
json
{
  "id": "6a1d1e8c-4a7d-4a5e-9f2c-1b0f2a9c7e11",
  "version": "v1",
  "data": [],
  "metadata": {
    "filesInfo": [
      {
        "fieldname": "foto",
        "name": "paisagem.jpg",
        "size": 152064,
        "mimetype": "image/jpeg",
        "encoding": "7bit",
        "sha256": "2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"
      }
    ],
    "timeSpent": 640
  }
}
  1. With shouldReturnConfidence=true
Status Code: 200
json
{
  "id": "a7f0c3d2-9e51-4b8a-8f31-2d4c6b9e0a77",
  "version": "v1",
  "data": [
    {
      "confidence": 0.97,
      "age": 29,
      "gender": {
        "value": "Female",
        "confidence": 98.4
      },
      "boundingBox": {
        "top": 0.2237228155136108,
        "left": 0.2856607735157013,
        "width": 0.1555942893028259,
        "height": 0.1687679588794708
      },
      "croppedBase64": "iVBORw0KGgoAAAANSUhEUgAAAlgAAAJYCAMAAA...SuQmCC"
    }
  ],
  "metadata": {
    "filesInfo": [
      {
        "fieldname": "foto",
        "name": "foto.png",
        "size": 210433,
        "mimetype": "image/png",
        "encoding": "7bit",
        "sha256": "fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9"
      }
    ],
    "timeSpent": 1410
  }
}

Response headers

HeaderWhen it appears
Nextid-ReqIdOn every response. Carries the request identifier, the same one as the id field in the body.

Errors

CodeWhen it happens
401 UnauthorizedAPI key or JWT token missing, invalid, or without permission for this endpoint.
404 Not FoundThe version given in the URL does not exist. Only v1 is accepted.
406 Not AcceptableThe body was sent as JSON, but without the base64 field.
413 Payload Too LargeThe file sent as multipart/form-data is larger than 15 MB.
415 Unsupported Media TypeThe Content-Type header is missing or is not supported.
422 Unprocessable EntityThe file format is not accepted, or more than one file was sent in the same call.
500 Internal Server ErrorUnexpected failure during processing.

The error response format is described in HTTP response codes.

Versions

This endpoint has a single version, v1. It is the default when the version is omitted from the URL.

VersionStatusWhat changes
v1RecommendedThe only version. Serves both /face and /face/v1.

Any other value in the URL — /face/v2, for example — returns 404.

Nextcode | Identity Verification Solutions