---
title: "Validate age"
description: "If you only need to validate someone's age, you can choose to include only the age field in extractFields while creating the transaction. Only the fields in extractFields will be returned in the transaction results."
canonical: "https://docs.cm.com/verification/id-scan/use-cases/validate-age"
---

# Validate age

> If you only need to validate someone's age, you can choose to include only the age field in extractFields while creating the transaction. Only the fields in extractFields will be returned in the transaction results.

Source: https://docs.cm.com/verification/id-scan/use-cases/validate-age

If you only need to validate someone's age, you can choose to include only the `age` field in `extractFields` while creating the transaction. Only the fields in `extractFields` will be returned in the transaction results.

```text title="Request"
POST https://api.cm.com/id-scan/v1/transactions
```

```text title="Request headers"
Content-Type: application/json
Authorization: Bearer GENERATED_TOKEN_HERE
```

```json title="Request body"
{
    "tasks": [
        "document_scan"
    ],
    "settings": {
        "documentScan": {
            "extractFields": [
                "age"
            ]
        }
    }
}
```

:::note
If you add fields to `extractFields`, the document image url and portrait image file will not be included in the response. To include them, make sure to add `document_image` and/or `portrait` as well.
:::

For a full list of all options see the [API reference](https://docs.cm.com/verification/id-scan/v1/api-reference)

Once the transaction is completed, only the requested field will be returned if it is present in the provided document.

```text title="Request"
GET https://api.cm.com/id-scan/v1/transactions/{transactionId}/results/{resultId}
```

```json title="Response body"
{
    "id": "6e96a20f-193e-4624-bf24-10962ea2eb18",
    "state": "completed",
    "tasks": [
        {
            "type": "document_scan",
            "state": "completed",
            "attempts": 1,
            "score": 0.98,
            "result": [
                {
                    "field": "age",
                    "validity": "valid",
                    "comparison": "match",
                    "locale": null,
                    "values": [
                        {
                            "source": "mrz",
                            "value": "45"
                        },
                        {
                            "source": "visual",
                            "value": "45"
                        }
                    ]
                }
            ],
            "files": [
                {
                    "category": "document",
                    "type": "passport",
                    "name": "Netherlands - ePassport (2024)",
                    "score": 0.98,
                    "url": null
                }
            ]
        }
    ]
}
```
