Skip to content

Upload Image ​

Uploads an image to FaceAuthen and returns an image_id. This is the mandatory first step for every other service — all downstream APIs take an image_id rather than raw image bytes.

Endpoint ​

http
POST /v1/images
Content-Type: multipart/form-data

Parameters:

ParamTypeRequiredDefaultDescription
filefileYes—The image file to be uploaded. JPG or PNG, max 15MB.
labelstringYes—The image label. Must be one of the values in Usage Recommendations.
metadatastring_jsonNo{}JSON string of key/value pairs. Keys are strings; values are string, int, float or bool. Example: {"id":"<ID>","type":1}

Returns: UploadImageResponse

Use portrait for a selfie captured by the camera and portrait_nfc for a portrait read from the NFC chip.

Sample Request ​

bash
curl -X POST \
  '<BASE_URL>/v1/images' \
  -H 'Authorization: ATV <ACCESS_ID>:<SIGNATURE>' \
  -H 'X-TV-Timestamp: <TIMESTAMP>' \
  -F 'file=@"images/portrait.jpg"' \
  -F 'label="portrait"'

Device Signature (SDK Requests) ​

When the Mobile SDK uploads with the transaction token (Authorization: Bearer …), it also sends Device-Id, X-Device-Key-Id and X-Device-Signature on a tenant with the device signature check enabled, signed over the raw multipart body exactly as sent. The credential named by X-Device-Key-Id must be ACTIVE and registered for the same Device-Id; otherwise the request is rejected with access_denied_exception. See Request Signing.

Response ​

json
{
  "data": {
    "image_id": "20b457d2-cf11-4c2b-a491-8137ae6b0bc8"
  },
  "errors": [],
  "success": true,
  "code": 0,
  "message": "Success"
}
FieldTypeDescription
data.image_idstringUUID of the uploaded image in StoreDB. Pass this to every other API.
errorsarrayDetail of each failure. Empty on success.
successboolWhether the call succeeded.
codeintNumeric status code — 0 on success.
messagestringStatus message.

On success the HTTP status is 200. An HTTP 200 alone is not enough — check success and data.status before treating the upload as complete.

Errors ​

When success is false, one of these numeric codes is returned:

CodeMessage
2001010Access ID not found.
2001014Register rate limit exceeded.
2001015Register brute force limit exceeded.
401100You are not authorized to perform the action.
4001000Input parameter violates a constraint.
4001001The X-TV-Timestamp header is expired, need a newer one.
4041001User not found.
4091000The cus_user_id has been registered.
4291000The number of requests exceeded your throughput limit.
5001000Some unexpected error occurs while processing the request.

The errors array carries one or more detailed error codes:

CodeDescription
invalid_parameter_exceptionInput parameter violates a constraint.
request_time_too_skewedThe X-TV-Timestamp header is expired, need a newer one.
access_denied_exceptionYou are not authorized to perform the action.
image_not_found_exceptionThe image ID is not found in DB.
image_too_large_exceptionThe input image size exceeds the allowed limit (15MB).
invalid_image_format_exceptionThe provided image format is not supported (JPG/PNG).
rate_limit_exceptionThe number of requests exceeded your throughput limit.
internal_server_errorSome unexpected error occurs while processing the request.

Next Steps ​

Developers