Skip to main content

Age Estimation

In FACIA, our Age Estimation service offers a nuanced understanding of an individual's age. This sophisticated feature utilizes advanced algorithms, analyzing facial features and patterns to provide precise age estimations. It stands as a dynamic tool within our system, contributing not only to insightful age assessments but also enhancing the overall versatility of FACIA's facial analysis capabilities.

Create Age Estimation Transaction​

This endpoint initiates a transaction request and returns a reference_id if the request includes proper authentication and valid fields, as mentioned below in the request parameters, using the POST method:


Endpoint

POSThttps://api.facia.ai/age-estimation

Authorization:​

Token Type: Bearer
Description:

This API utilizes Access token or Client-Secret key in header for authentication.

You can use your client_id and client_secret key when using the "/request-access-token" endpoint to obtain a Bearer token for authorization while connecting to this API. For additional details on Authorization, click Here

Run in Postman

Request Body Samples:​

//POST /age-estimation HTTP/1.1
//Host: api.facia.ai
//Content-Type: application/json
//Authorization: Bearer <access-token-here>

{
"type": "age_estimation",
"enroll_face": true,
"wait_for_result": 0,
"file": "data:image/png;base64,your_image_base64_here"
}

Request Parameter​

ParametersDescription
type
Required: Yes
Type: string
Example: type=age_estimation
Type must be age_estimation.
enroll_face
Required: No
Type: boolean
Example: enroll_face=true
Default value: true
If you do not want the system to enroll the face then set the value of the key as false.
fileRequired: Yes
Type: file or string
multipart/form-data: the image file (.jpg, .jpeg, .png).
application/json: a Base64 data URI including the prefix, e.g. data:image/jpeg;base64,/9j/4AAQ.... Plain Base64 without the data:image/...;base64, prefix is rejected.
wait_for_resultRequired: No
Type: boolean / integer
Accepted values: 1 / 0 (integer) or true / false (boolean)
Default: 0 (false)
Set to 1 or true to wait for the processing result in the same response. Set to 0 or false (or omit it) to receive only the reference_id and fetch the result later.

Multipart Upload Sample​

Image fields can also be sent as files with multipart/form-data instead of Base64 JSON:

curl -X POST https://api.facia.ai/age-estimation \
-H "Authorization: Bearer <token>" \
-F "type=age_estimation" \
-F "file=@/path/to/photo.jpg"

Response Sample​


{
"status": true,
"message": "Transaction Created",
"result": {
"data": {
"reference_id": "your_reference_id_here"
}
}
}


Response Parameter​

ParametersDescription
reference_id Type: string
Example: reference_id=your_reference_id_here
message Type: string
Example: message=Transaction created

Age Estimation Result​

This endpoint accepts a single field in the body request payload: reference_id (String). Once the backend finalizes the response, this endpoint returns a result object containing an 'age' variable, which is an estimated age of type integer. Failure to provide a valid reference_id will result in a 422 status code.

Endpoint

POSThttps://api.facia.ai/result

Authorization:​

Token Type: Bearer
Description:

This API utilizes Access token or Client-Secret key in header for authentication.

You can use your client_id and client_secret key when using the "/request-access-token" endpoint to obtain a Bearer token for authorization while connecting to this API. For additional details on Authorization, click Here

Run in Postman

Request Body Samples:​

//POST /result HTTP/1.1
//Host: api.facia.ai
//Content-Type: application/json
//Authorization: Bearer <access-token-here>

{
"reference_id": "your_reference_id_here"
}

Request Parameter​

ParametersDescription
reference_idRequired: Yes
Type: string
Example: reference_id=your_reference_id_here
The unique identifier associated with the created transaction.

Response Sample​



{
"status": true,
"message": "Success",
"result": {
"data": {
"reference_id": "your_reference_id_here",
"age": 24,
"is_age_detected": 1,
"age_txt": "21 to 27 years",
"under_18": 0,
"under_21": 50
}
}
}



Response Parameter​

ParametersDescription
reference_id
Required: Yes
Type: string
Example: reference_id=your_reference_id_here
age Type: integer
Example: age=30
Includes the estimated age from the provided image.
is_age_detected Type: boolean (0,1)
Example: is_age_detected=1
Is 1, if face is found and age is estimated, otherwise 0.
age_txt Type: string
Example: age_txt=21 to 27 years
Includes a range of estimated age
under_18 Type: integer
Example: under_18=0
Range: 0 to 100
Includes the probability percentage of being under 18.
under_21 Type: integer
Example: under_21=0
Range: 0 to 100
Includes the probability percentage of being under 21.