# Age Estimation Check

## Run an age estimation check

To run an Age Estimation Check, you must [create a check ](https://docs.complycube.com/documentation/api-reference/core-resources/checks/create-a-check)with `type` set to `age_estimation_check`.

This check can only be performed on a [client](https://docs.complycube.com/documentation/api-reference/core-resources/clients) of type `person`. &#x20;

[Learn more about Age Estimation Checks](https://app.gitbook.com/s/KyFKMqftsmT6qln9zo5y/biometric-and-liveness-verification/age-estimation-check).

{% hint style="info" %}
Get in touch with your Account Manager or [contact us](https://www.complycube.com/sales) to enable this service.
{% endhint %}

## Check request

<table><thead><tr><th width="231">Attribute</th><th width="99.4">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>clientId</code></td><td>string</td><td>The ID of the client associated with this check. (<strong>Required</strong>)</td></tr><tr><td><code>livePhotoId</code></td><td>string</td><td>The ID of the live photo. (<strong>Required</strong>)</td></tr></tbody></table>

## Example request

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST https://api.complycube.com/v1/checks \
     -H 'Authorization: <YOUR_API_KEY>' \
     -H 'Content-Type: application/json' \
     -d '{
          "clientId":"CLIENT_ID",
          "livePhotoId":"LIVE_PHOTO_ID",
          "type": "age_estimation_check"
        }'
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const check = await complycube.check.create("CLIENT_ID", {
        livePhotoId: "LIVE_PHOTO_ID",
        type: "age_estimation_check"
});
```

{% endtab %}

{% tab title="Python" %}

```python
check = cc_api.check.create(
    'CLIENT_ID',
    'age_estimation_check',
    livePhotoId='LIVE_PHOTO_ID'
)
```

{% endtab %}

{% tab title="PHP" %}

```php
$result = $ccapi->checks()->create('CLIENT_ID',
                                   ['type' => 'age_estimation_check',
                                   'livePhotoId' => 'LIVE_PHOTO_ID']);
```

{% endtab %}

{% tab title=".NET" %}

```csharp
var checkRequest = new CheckRequest {
  clientId = "CLIENT_ID",
  livePhotoId = "LIVE_PHOTO_ID",
  type = "age_estimation_check"
};

var check = await checkApi.CreateAsync(checkRequest);
```

{% endtab %}
{% endtabs %}

## Result object

The `result` object is only returned when the status of the check is `complete` . It has two components - `outcome` and `breakdown`.

### Outcome

The outcome attribute represents the overall check result. Returned values include:

1. `clear`: Indicates every analysis conducted returned a successful result, and hence the age estimation check is successful.
2. `attention`: Indicates at least one of the analysis results requires attention.

### Breakdown

The breakdown comprises the following objects:

#### `ageEstimationAnalysis` object

&#x20;The age estimation analysis results. It has the following constituents:

* `ageValidation`: Indicates whether the estimated age is greater than or equal to a predefined minimum accepted age.
* `breakdown`: Breakdown related to age estimation analysis.
  * `age`: Indicates the estimated age of the person in the live photo. The age will be in years.
  * `ageMin`: Indicates the minimum estimated age of the person in the live photo. The age will be in years.
  * `ageMax`: Indicates the maximum estimated age of the person in the live photo. The age will be in years.

#### `authenticityAnalysis` object

&#x20;The facial analysis results. It has the following constituents:

* `livenessCheck`: Indicates if the live photo is genuine and not a photo-of-an-image or photo-of-a-screen.
* `breakdown`: Breakdown related to authenticity analysis.
  * `livenessCheckScore`: Indicates the liveness score of the live photo. The score will be 100 when it is assumed to be authentic.

### Sample Response

```json
{
  "id": "6231d54079f59b1530fc76e3",
  "entityName": "John Doe",
  "type": "age_estimation_check",
  "clientId": "6230d4ab58ed4a434afbf2cc",
  "livePhotoId": "6231d137095afa000955ffc2",
  "status": "complete",
  "result": {
    "outcome": "clear",
    "breakdown": {
      "ageEstimationAnalysis": {
        "ageValidation": "clear",
        "breakdown": {
          "age": 33,
          "ageMin": 27,
          "ageMax": 38
        }
      },
      "authenticityAnalysis": {
        "livenessCheck": "clear",
        "breakdown": {
          "livenessCheckScore": 100
        }
      }
    }
  },
  "updatedAt": "2022-03-01T12:17:06.046Z",
  "createdAt": "2022-03-01T12:17:04.809Z"
}
```
