AgentSkillsCN

didit-age-estimation

集成Didit年龄估算独立API,通过面部图像估算个人年龄。当用户希望估算年龄、验证年龄、实施年龄限制、检查某人是否年满18岁或21岁、进行合规性年龄验证,或利用Didit的面部分析进行年龄检测时使用此功能。内置被动活体检测功能。支持可配置阈值、基于ID验证的自适应年龄估算,以及各国不同的年龄限制。

SKILL.md
--- frontmatter
name: didit-age-estimation
description: >
  Integrate Didit Age Estimation standalone API to estimate a person's age from a facial image.
  Use when the user wants to estimate age, verify age, implement age gating, check if someone
  is over 18/21, perform age verification for compliance, or use facial analysis for age detection
  using Didit. Includes passive liveness check. Supports configurable thresholds, adaptive age
  estimation with ID verification fallback, and per-country age restrictions.
version: 1.0.0
metadata:
  openclaw:
    requires:
      env:
        - DIDIT_API_KEY
    primaryEnv: DIDIT_API_KEY
    emoji: "🎂"
    homepage: https://docs.didit.me

Didit Age Estimation API

Overview

Estimates a person's age from a facial image using deep learning. Also performs a passive liveness check to prevent spoofing.

Key constraints:

  • Supported formats: JPEG, PNG, WebP, TIFF
  • Maximum file size: 5MB
  • Image must contain one clearly visible face
  • Accuracy: MAE ±3.5 years overall; ±1.5 years for under-18

Capabilities: Age estimation with confidence scoring, gender estimation, passive liveness detection, configurable age thresholds, per-country age restrictions, adaptive mode with ID verification fallback for borderline cases.

Liveness methods (workflow mode):

MethodSecurityBest For
ACTIVE_3D (Action + Flash)HighestBanking, government, healthcare
FLASHING (3D Flash)HighFinancial services, identity verification
PASSIVE (single-frame CNN)StandardLow-friction consumer apps

API Reference: https://docs.didit.me/reference/age-estimation-standalone-api


Authentication

All requests require x-api-key header. Get your key from Didit Business Console → API & Webhooks.


Endpoint

code
POST https://verification.didit.me/v3/age-estimation/

Headers

HeaderValueRequired
x-api-keyYour API keyYes
Content-Typemultipart/form-dataYes

Request Parameters (multipart/form-data)

ParameterTypeRequiredDefaultDescription
user_imagefileYesFacial image (JPEG/PNG/WebP/TIFF, max 5MB)
rotate_imagebooleanNofalseTry 0/90/180/270 rotations for non-upright faces
save_api_requestbooleanNotrueSave in Business Console Manual Checks
vendor_datastringNoYour identifier for session tracking

Example

python
import requests

response = requests.post(
    "https://verification.didit.me/v3/age-estimation/",
    headers={"x-api-key": "YOUR_API_KEY"},
    files={"user_image": ("selfie.jpg", open("selfie.jpg", "rb"), "image/jpeg")},
    data={"vendor_data": "user-123"},
)
print(response.json())
typescript
const formData = new FormData();
formData.append("user_image", selfieFile);

const response = await fetch("https://verification.didit.me/v3/age-estimation/", {
  method: "POST",
  headers: { "x-api-key": "YOUR_API_KEY" },
  body: formData,
});

Response (200 OK)

json
{
  "request_id": "a1b2c3d4-...",
  "liveness": {
    "status": "Approved",
    "method": "PASSIVE",
    "score": 89.92,
    "age_estimation": 24.3,
    "reference_image": "https://example.com/reference.jpg",
    "video_url": null,
    "warnings": []
  },
  "created_at": "2025-05-01T13:11:07.977806Z"
}

Status Values & Handling

StatusMeaningAction
"Approved"Age verified above threshold, liveness passedProceed with your flow
"Declined"Age below minimum or liveness failedCheck warnings for specifics
"In Review"Borderline case, needs reviewTrigger ID verification fallback or manual review

Error Responses

CodeMeaningAction
400Invalid requestCheck file format, size, parameters
401Invalid API keyVerify x-api-key header
403Insufficient creditsTop up at business.didit.me

Response Field Reference

FieldTypeDescription
statusstring"Approved", "Declined", "In Review", "Not Finished"
methodstring"ACTIVE_3D", "FLASHING", or "PASSIVE"
scorefloat0-100 liveness confidence score
age_estimationfloatEstimated age in years (e.g. 24.3). null if no face
reference_imagestringTemporary URL (expires 60 min)
video_urlstringTemporary URL for active liveness video. null for passive
warningsarray{risk, log_type, short_description, long_description}

Accuracy by Age Range

Age RangeMAE (years)Confidence
Under 181.5High
18-252.8High
26-403.2High
41-603.9Medium-High
60+4.5Medium

Warning Tags

Auto-Decline

TagDescription
NO_FACE_DETECTEDNo face found in image
LIVENESS_FACE_ATTACKSpoofing attempt detected
FACE_IN_BLOCKLISTFace matches a blocklist entry

Configurable (Decline / Review / Approve)

TagDescription
AGE_BELOW_MINIMUMEstimated age below configured minimum
AGE_NOT_DETECTEDUnable to estimate age (image quality, lighting)
LOW_LIVENESS_SCORELiveness score below threshold
POSSIBLE_DUPLICATED_FACESignificant similarity with previously verified face

Warning severity: error (→ Declined), warning (→ In Review), information (no effect).


Common Workflows

Basic Age Gate

code
1. Capture user selfie
2. POST /v3/age-estimation/ → {"user_image": selfie}
3. Check liveness.age_estimation >= your_minimum_age
4. If "Approved" → user meets age requirement
   If "Declined" → check warnings for AGE_BELOW_MINIMUM or liveness failure

Adaptive Age Estimation (Workflow Mode)

code
1. Configure workflow with age thresholds in Console
2. POST /v3/session/ → create session with age-estimation workflow
3. User takes selfie → system estimates age
4. Clear pass (well above threshold) → Approved instantly
   Clear fail (well below threshold) → Declined
   Borderline case → automatic ID verification fallback
5. If ID fallback triggered: per-country age restrictions apply

Per-Country Age Restrictions

Configure in Console per issuing country:

CountryMin AgeOverrides
USA18Mississippi: 21, Alabama: 19
KOR19
GBR18
ARE21

Use "Apply age of majority" button in Console to auto-populate defaults.