Image upload
The image upload endpoint measures emotional expression on faces in one or more JPEG images. Send the images in one request, and the response has one result per image, listing the faces found in it. A realtime session returns the same measurements for the same images.
Request
The request body has one or more file parts and an optional config part. Authenticate with a credential header, as described in Authentication.
One JPEG image per part, sent with the content type image/jpeg. Repeat the part to send several images.
Settings as a JSON object, sent with the content type application/json. See Configuration. Omit it to use the defaults.
The request below uploads two images, lowers the detection threshold, and asks for a face_state to continue face tracking in a later request.
Images
Each file part holds one complete JPEG image.
The server checks every image before measuring any. An image that is not a JPEG, or that exceeds the size or pixel limit, fails the request with unsupported_media_type or image_too_large. After earlier images are measured, an image that cannot be decoded can still fail the request with image_decode_failed. A request that fails in any of these ways returns no result for any image and is recorded as an errored run.
Detection
The server scans each image for faces and excludes any whose detection confidence is below face.threshold or whose bounding box is shorter than face.min_size pixels on its shorter side. It measures the largest of the remaining faces, up to 2 by default, and lists them first in faces, largest first. The faces that were not measured follow, most confident first, up to 32 faces in all.
A face that was not measured carries its bbox and confidence, with face_id, expressions, and descriptions set to null. The limit on measured faces is set for your organization and does not appear in responses. To raise it, contact support.
Response
The response below is for two images. Three faces appear in the first, and the two largest are measured. One of the measured faces remains in the second.
Identifies the request in Hume’s records. Quote it when contacting support.
Identifies the run the request was recorded as. Pass it to the run endpoints to look the run up.
The number of images measured.
The position of the image’s file part in the request, starting at 0.
Identifies the same face from image to image within the request, and across requests when you pass back face_state. null for a face that was not measured. See Face tracking.
The face’s location in the submitted image as [x0, y0, x1, y1]: the top-left and bottom-right corners in pixels, measured from the top-left of the image. Coordinates are in the pixels as stored in the file: EXIF orientation is not applied.
The detector’s confidence that the box contains a face, from 0 to 1. Never below face.threshold. Unrelated to the expression scores.
The 48 expression names are listed in Video measurements. null for a face that was not measured.
Visible facial actions such as smile or jaw drop. The 27 names are listed in Video measurements. null for a face that was not measured.
Present when face.return_face_state was set. Pass it back in a later request to continue face_id numbering. See Face tracking.
Matching results to images
measurements holds one result per image, in the order the file parts were sent. Each result’s frame_id is the position of its image’s file part, starting at 0. An image with no faces still has a result, with an empty faces array.
Face tracking
face_id links the same face across the images of one request. IDs are assigned from 0 in the order faces are first measured, largest first within an image. A face normally keeps its ID while it is measured, and can get it back after it leaves the view or is no longer among the largest faces. The server remembers up to 32 faces, so a face that returns after many others have been measured may receive a new ID. IDs do not identify a person.
IDs restart at 0 in every request. To continue numbering across requests, set face.return_face_state to true, and pass the face_state from the response as face_state in the next request’s config.
- Treat
face_stateas opaque. Pass it back unchanged. - A state is accepted for 24 hours after it was issued. A state that has expired, was altered, or was issued to another organization is ignored, and numbering starts again from 0.
Configuration
To change the detection settings, send a config part. Fields you omit keep their defaults.
The minimum detection confidence for a face to be measured, from 0 to 1. Lower values include more faces at the risk of false detections. The scale is specific to this API, so thresholds tuned for other face detection APIs do not carry over. Reported rounded to four decimal places.
The smallest face to measure, as the shorter side of its bounding box in pixels of the submitted image. At least 1.
Return a face_state with the response, so a later request can continue face_id numbering.
The face_state from an earlier response, so face_id continues from the faces that request saw.
Errors
A failed request returns an error body with a code, a message, and a request_id. A 401 carries only a message, and a request_id when an API key was rejected. HTTP errors describes the format.

