> ## Documentation Index
> Fetch the complete documentation index at: https://venator-06aff335.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Age Estimation

Estimate a person’s age from a face image using AI-based facial analysis.\
This service analyzes facial features and returns an approximate age range or numeric age estimate for identity verification, fraud detection, and age-restricted access control.

<div
  style={{
display: "inline-flex",
alignItems: "center",
background: "#fff",
borderRadius: "12px",
padding: "16px 24px",
border: "1px solid #e5e7eb",
boxShadow: "0 1px 3px rgba(0,0,0,0.05)",
fontFamily: "monospace",
gap: "16px"
}}
>
  <span
    style={{
color: "#2563eb",
fontWeight: "700",
fontSize: "18px",
letterSpacing: "0.5px"
}}
  >
    POST
  </span>

  <span
    style={{
fontSize: "14px",
color: "#4b5563"
}}
  >
    /api/gw/services/age\_estimation
  </span>
</div>

***

### Authorizations

<ResponseField name="x-api-key" type="string" required>
  API key used to authenticate the request.
</ResponseField>

***

### Body

<ResponseField name="faceImageBase64" type="string" required>
  Base64-encoded face image used for age estimation.
</ResponseField>

<ResponseField name="faceImageFileName" type="string">
  Original filename of the uploaded image.
</ResponseField>

<ResponseField name="faceImageBytes" type="string">
  Raw image bytes (optional alternative to Base64 input).
</ResponseField>

***

### Response

<Tabs>
  <Tab title="200">
    <ResponseField name="success" type="boolean">
      Indicates whether the request was processed successfully.
    </ResponseField>

    <ResponseField name="requestId" type="string">
      Unique identifier for the API request.
    </ResponseField>

    <ResponseField name="correlationId" type="string">
      Identifier used for tracing the request across systems.
    </ResponseField>

    <ResponseField name="data" type="object">
      Contains age estimation and face analysis results.
    </ResponseField>

    <ResponseField name="data.status" type="string">
      Overall decision status (e.g., Approved, Rejected).
    </ResponseField>

    <ResponseField name="data.estimatedAge" type="number">
      Predicted age of the individual.
    </ResponseField>

    <ResponseField name="data.confidenceScore" type="number">
      Confidence score of the age estimation.
    </ResponseField>

    <ResponseField name="data.gender" type="string">
      Detected gender of the individual.
    </ResponseField>

    <ResponseField name="data.faceQuality" type="number">
      Quality score of the detected face image.
    </ResponseField>

    <ResponseField name="data.faceLuminance" type="number">
      Luminance/brightness score of the face image.
    </ResponseField>

    <ResponseField name="data.isApproved" type="boolean">
      Indicates whether the result meets approval criteria.
    </ResponseField>

    <ResponseField name="error" type="object | null">
      Contains error details if the request fails; otherwise null.
    </ResponseField>

    <ResponseField name="durationMs" type="number">
      Time taken to process the request in milliseconds.
    </ResponseField>

    <ResponseField name="processedAt" type="string">
      Timestamp when the request was processed (ISO 8601 format).
    </ResponseField>
  </Tab>

  <Tab title="400">
    <ResponseField name="error" type="string">
      Error message describing why the request failed.
    </ResponseField>

    <ResponseField name="code" type="string">
      Machine-readable error code for debugging.
    </ResponseField>
  </Tab>
</Tabs>

***

<RequestExample>
  ```bash Curl theme={null}
  curl -X POST "https://dev-idf-gw.cognetlabs.org/api/gw/services/age-estimation" \
    -H "Content-Type: application/json" \
    -H "x-api-key: YOUR_API_KEY" \
    -d '{
      "faceImageBase64": "<base64-face>",
      "faceImageFileName": "selfie.jpg"
    }'
  ```

  ```python Python theme={null}
  import requests

  url = "https://dev-idf-gw.cognetlabs.org/api/gw/services/age-estimation"

  headers = {
      "Content-Type": "application/json",
      "x-api-key": "YOUR_API_KEY"
  }

  payload = {
      "faceImageBase64": "<base64-face>",
      "faceImageFileName": "selfie.jpg"
  }

  response = requests.post(url, json=payload, headers=headers)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  fetch("https://dev-idf-gw.cognetlabs.org/api/gw/services/age-estimation", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "x-api-key": "YOUR_API_KEY"
    },
    body: JSON.stringify({
      faceImageBase64: "<base64-face>",
      faceImageFileName: "selfie.jpg"
    })
  })
  .then(res => res.json())
  .then(console.log);
  ```

  ```php PHP theme={null}
  <?php
  $url = "https://dev-idf-gw.cognetlabs.org/api/gw/services/age-estimation";

  $data = [
    "faceImageBase64" => "<base64-face>",
    "faceImageFileName" => "selfie.jpg"
  ];

  $options = [
    "http" => [
      "header"  => "Content-Type: application/json\r\nx-api-key: YOUR_API_KEY",
      "method"  => "POST",
      "content" => json_encode($data),
    ],
  ];

  $context = stream_context_create($options);
  $result = file_get_contents($url, false, $context);

  echo $result;
  ?>
  ```

  ```go Go theme={null}
  package main

  import (
  	"bytes"
  	"net/http"
  )

  func main() {
  	jsonData := []byte(`{
  		"faceImageBase64":"<base64-face>"
  	}`)

  	req, _ := http.NewRequest("POST",
  		"https://dev-idf-gw.cognetlabs.org/api/gw/services/age-estimation",
  		bytes.NewBuffer(jsonData),
  	)

  	req.Header.Set("Content-Type", "application/json")
  	req.Header.Set("x-api-key", "YOUR_API_KEY")

  	client := &http.Client{}
  	client.Do(req)
  }
  ```

  ```java Java theme={null}
  import okhttp3.*;

  public class Main {
      public static void main(String[] args) throws Exception {

          OkHttpClient client = new OkHttpClient();

          String json = "{\"faceImageBase64\":\"<base64-face>\", \"faceImageFileName\":\"selfie.jpg\" }";

          RequestBody body = RequestBody.create(
              json, MediaType.parse("application/json")
          );

          Request request = new Request.Builder()
              .url("https://dev-idf-gw.cognetlabs.org/api/gw/services/age-estimation")
              .addHeader("x-api-key", "YOUR_API_KEY")
              .post(body)
              .build();

          Response response = client.newCall(request).execute();

          System.out.println(response.body().string());
      }
  }
  ```

  ```ruby Ruby theme={null}
  require 'net/http'
  require 'uri'
  require 'json'

  uri = URI.parse("https://dev-idf-gw.cognetlabs.org/api/gw/services/age-estimation")

  header = {
    'Content-Type': 'application/json',
    'x-api-key': 'YOUR_API_KEY'
  }

  payload = {
    faceImageBase64: "<base64-face>",
    faceImageFileName: "selfie.jpg"
  }

  http = Net::HTTP.new(uri.host, uri.port)
  request = Net::HTTP::Post.new(uri.request_uri, header)
  request.body = payload.to_json

  response = http.request(request)
  puts response.body
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
  "success":true,
  "requestId":"ddf222a706d3",
  "correlationId":"corr-1777470099227",
  "data":{
  "status":"Approved",
  "estimatedAge":26.5,
  "confidenceScore":77.87,
  "gender":"male",
  "faceQuality":2522.575892886491,
  "faceLuminance":2798.226405264767,
  "isApproved":true
  },
  "error":null,
  "durationMs":2360,
  "processedAt":"2026-04-29T13:41:41.9113966Z"
  }
  ```

  ```json 400 theme={null}
  {
    "error": "FaceImageBase64 is required"
  }
  ```
</ResponseExample>
