Skip to main content

Set an Age Estimation Buffer and Route Uncertain Results to ID Checks

Set the decline threshold to the bottom of your buffer, read the predicted age float, and route the band around your legal age to ID verification. Didit Age Estimation is $0.10 per check.

Set an Age Estimation Buffer and Route Uncertain Results to ID Checks

Contents

In this guide

Jump to the part you need.

This guide is for teams that gate an age-restricted product with a selfie instead of a document, and want the borderline cases handled properly. The method sets a buffer around your legal age and sends that band to ID verification. Didit Age Estimation costs $0.10 per check. The caveat up front: the age is model-predicted from a face, not verified against a document, so the buffer marks where the estimate stops being enough.

Last updated: November 26, 2026. Prices checked against the live Didit price feed on November 26, 2026.

Three zones for an 18+ gate with a two-year buffer (an example policy, not a platform default)
ZonePredicted ageWhat the call returnsYour route
Clear minorUnder 16Declined with AGE_BELOW_MINIMUMReject on the selfie, no document needed
Buffer band16 to under 20No age warning fires, your code reads the floatID verification, then decide on the document
Clear adult20 and overApproved, empty warningsApprove on the selfie

Start free in the sandbox at business.didit.me; there is no sales call and sandbox calls are not billed. Developers who want an assistant to wire this up can connect Didit to an AI assistant through the Didit MCP server. The step is documented at the Age Estimation overview, and every unit price is on the pricing page.

The outcome you are building

An age gate built on a selfie usually has one cut: predicted age above 18, let them in; below, turn them away. That single cut is wrong in both directions near the line. A 17-year-old who reads at 18.4 walks into an 18+ product. An 18-year-old who reads at 17.6 is turned away and has to appeal. That reading should route to a document check instead of a rejection.

A buffer adds a third zone. Clear minors are rejected on the selfie alone. Clear adults are approved on the selfie alone. The band between them goes to ID verification, where a document and a face match decide. You keep the cheap selfie path for most traffic and spend the document check only where the estimate cannot carry the decision.

Didit Business Console: session detail liveness
Didit Business Console: session detail liveness

The standalone POST /v3/age-estimation/ call takes age_estimation_decline_threshold, default 18. The easy mistake is to leave that at 18 and treat the returned status as the whole decision. The status is a two-way answer, so the band disappears and the decline bucket doubles as your buffer, at a width you did not choose.

Set the threshold to the bottom of your buffer instead. For an 18+ product with a two-year buffer, that is 16. The call then declines only the selfies it places under 16, and everything from 16 upward comes back without an age warning. Your code reads the predicted age float and picks the zone. The threshold stays a safety net for obvious minors; it is not the decision.

The 18+ gate, the two-year width and the 16 to 20 band are an example you can copy, not a platform setting. The legal minimum comes from the markets you sell in, and the buffer width is your own policy decision. The API enforces only the decline threshold you pass; the band above it is routing logic you own.

In this article we use a two-year buffer as an example policy, because the published error is concentrated there. That width is our own example, not a Didit recommendation. Didit's Age Estimation documentation states it directly:

Its mean absolute error is 1.1 years for 16 and 17-year-olds and 1.9 years for 18 to 20-year-olds, and it correctly classifies 96% of selfies as under 18 or 18 and over.

The same page adds the operating rule: borderline ages near your threshold deserve a fallback to document-based verification, because the error grows for faces close to the limit. A two-year band is a practical policy choice for handling estimates near the threshold.

If you cannot add routing code yet, keep the default 18 and treat Declined plus AGE_BELOW_MINIMUM as "send to ID verification" rather than "reject". That works, but read the warnings array first. A decline for LOW_LIVENESS_SCORE or LIVENESS_FACE_ATTACK is a spoof signal, not an age signal, and must not be pushed into a document fallback. If you are rebuilding an existing flow, the switch guide covers what changes.

Prerequisites

  • A Didit account and an application API key, sent in the x-api-key header.
  • Credit on the organization. Each 200 response on the age endpoint consumes one Age Estimation check at $0.10. When the balance cannot cover the call, the endpoint returns 403 before any image processing.
  • For the standalone route, a selfie as jpg, jpeg, png, tiff or webp, maximum 5 MB. PDFs are not accepted.
  • For the session route, a workflow whose Liveness node has age estimation enabled, with age_estimation_decline_threshold set on that node.
  • An ID Verification step in the same workflow, or a second workflow you can start when the band is hit.
  • The fallback workflow must include a Face Match step if you plan to read face_matches[]. Without that step the array is absent from the decision, and you have no document-to-selfie comparison to decide on.

Step-by-step

  1. Fix two numbers. The legal minimum for your market, 18 here, and the buffer width in years, 2 here. Write them as constants. Every later step reads them, so you change them in one place when you enter a market with a different age.

  2. Set the decline threshold to the bottom of the band. 18 minus 2 is 16. Pass age_estimation_decline_threshold=16. Keep save_api_request=true so the call is stored as an API-type session, its request_id becomes a real session id, and the result is readable later at liveness_checks[] with features: ["AGE_ESTIMATION"].

  3. Make the call. Server to server, with a selfie already captured. The documented request:

    curl -X POST 'https://verification.didit.me/v3/age-estimation/' \
      -H 'x-api-key: YOUR_API_KEY' \
      -F 'user_image=@./selfie.jpg' \
      -F 'age_estimation_decline_threshold=16' \
      -F 'save_api_request=true' \
      -F 'vendor_data=user-1234'

    In a hosted flow, enable age estimation on the Liveness node in the workflow and skip to step 5. There is no separate age estimation workflow feature; it runs inside the Liveness step and the result lands at liveness_checks[].age_estimation.

    Didit workflow builder showing the simple template mode and the advanced graph mode side by side
    Simple mode and advanced mode in the Didit workflow builder. Age estimation is enabled on the Liveness node, not as a separate workflow feature.

Passive liveness runs in the same call and can flag presentation attacks such as photos, screens, or masks.

  1. Read the predicted age, not just the status. The float at age_estimation.age_estimation drives the routing. Check the warnings first, then the float. The minimum glue, using the documented response fields:

    // response = parsed body of POST /v3/age-estimation/
    const AGE_MIN = 18;        // your legal minimum
    const BUFFER_YEARS = 2;    // your policy choice
    const DECLINE_THRESHOLD = AGE_MIN - BUFFER_YEARS;  // 16, sent as the threshold
    const BAND_TOP = AGE_MIN + BUFFER_YEARS;           // 20
    
    const result = response.age_estimation;
    const warnings = result.warnings || [];
    
    if (warnings.includes("AGE_NOT_DETECTED") || warnings.includes("NO_FACE_DETECTED")
        || warnings.includes("MULTIPLE_FACES_DETECTED")) {
      return "retake";            // no usable age, never a rejection
    }
    if (warnings.includes("LOW_LIVENESS_SCORE") || warnings.includes("LIVENESS_FACE_ATTACK")) {
      return "reject_spoof";      // spoof signal, never a document fallback
    }
    if (warnings.includes("AGE_BELOW_MINIMUM")) {
      return "reject_age";        // under the bottom of the band
    }
    const predicted = result.age_estimation;
    if (predicted === null) return "retake";
    if (predicted >= DECLINE_THRESHOLD && predicted < BAND_TOP) return "id_verification";
    return "approve";

    Each warning code gets its own route. A missing age is a retake, a liveness warning is a reject, and only a clean estimate inside the band goes to the document check. This table is the whole rule set:

    Warning to route mapping
    ConditionWhat it meansRoute
    AGE_NOT_DETECTEDThe model found no estimable age, so age_estimation is nullRetake, front-facing and well lit. Do not record a rejection.
    NO_FACE_DETECTEDThe liveness model found no face in the frameRetake
    MULTIPLE_FACES_DETECTEDMore than one person in the frameRetake alone in the frame
    LOW_LIVENESS_SCOREPassive liveness score at or below the liveness thresholdReject or redo liveness. Never send to a document check.
    LIVENESS_FACE_ATTACKA presentation attack was suspectedReject
    AGE_BELOW_MINIMUMPredicted age below the decline threshold you passedReject on the selfie
    Clean estimate inside the band16 to under 20 in this exampleID verification
    Clean estimate at or above the band20 and over in this exampleApprove on the selfie
  2. Send the band to ID verification. On the API route, create a session with a workflow that contains ID Verification and Face Match, sending workflow_id, vendor_data and a callback, then open session.url for the user. On the workflow route, open the graph in Advanced mode and put a Branch node after the Liveness node: the builder lists age among its branch conditions, so the band routes to an ID Verification node and the rest of the traffic completes.

  1. Read the fallback decision. Pull the session decision and branch on session_kind before anything else.

    curl https://verification.didit.me/v3/session/<SESSION_ID>/decision/ \
      -H "x-api-key: <API_KEY>"

    The key needs the read:sessions privilege. The document result sits in id_verifications[] and the face comparison in face_matches[], which is present only when the workflow runs Face Match.

  2. Subscribe to status.updated. Read the raw request body before parsing, verify X-Signature-V2 against the destination secret, reject a timestamp older than 300 seconds, then process. Return 2xx quickly and update state idempotently. The envelope carries session_id, status, vendor_data and, for terminal states, the decision.

  3. Set the review boundaries. A person should see the cases code cannot settle: a document that reads as expired, a face match that fails on the fallback, or an appeal from a user the selfie placed under 16. The workflow builder can route an outcome to manual review, and when a reviewer changes a status the decision records status_override with the automatic_status it replaced, plus decision_trace.decided_by.

What the response looks like

The shape of a successful call, as valid JSON with example values in place of live ones. A real call returns a UUID in request_id and a filled entities list.

{
  "request_id": "b3f1c2d4-0000-4000-8000-000000000000",
  "age_estimation": {
    "status": "Approved",
    "method": "PASSIVE",
    "age_estimation": 22.4,
    "score": 87.5,
    "user_image": { "entities": [] },
    "warnings": []
  }
}

Two field notes. score is the passive liveness score, a number from 0 to 100, not a string. age_estimation is the predicted age in years as a float, or null when no age could be read. Status is Approved only when warnings is empty.

In the sandbox, the endpoint validates the request and then returns a static Approved payload with an age of 30 and no warnings: nothing is processed, no session is persisted and no credit is used. That also means a sandbox run never lands in the band, so test your zone logic with your own fixtures rather than waiting for the mock to change.

Inputs and outputs

Request fields on POST /v3/age-estimation/
FieldTypeRequiredNotes
user_imageBinaryYestiff, jpg, jpeg, png or webp, maximum 5 MB. One front-facing, well-lit face. The largest face wins if several are present.
age_estimation_decline_thresholdNumber, yearsNoDefault 18. Set it to the bottom of your buffer so the band stays available.
face_liveness_score_decline_thresholdNumber 0-100NoDefault 30. A score at or below it adds LOW_LIVENESS_SCORE.
save_api_requestBooleanNoDefault true. Persists the call as an API-type session you can query later. False stores nothing and the id cannot be looked up.
vendor_dataStringNoYour own identifier for the person, echoed back on the session and in webhooks.
rotate_imageBooleanNoSet true when captures may arrive sideways or upside down.
Response fields you route on
FieldWhat it gives youHow to use it
age_estimation.statusApproved or DeclinedTerminal reject or approve signal, never the whole decision
age_estimation.age_estimationPredicted age in years as a float, or nullDrives the three-zone routing
age_estimation.scorePassive liveness score, a number from 0 to 100Below the liveness threshold means spoof risk, not age risk
age_estimation.warnings[]Risk codes such as AGE_BELOW_MINIMUM, AGE_NOT_DETECTED, NO_FACE_DETECTED, LIVENESS_FACE_ATTACK, MULTIPLE_FACES_DETECTEDTells a retake from a reject from a document fallback
request_idSession id when save_api_request is trueRead the stored result with the decision endpoint

Failure cases and recovery

What to do when the call or the route does not go as planned
CaseWhat you seeRecovery
Missing, oversized or wrong-format imageHTTP 400Resend one face, 5 MB or less, in an accepted extension. A PDF is never valid here.
No credit on the organizationHTTP 403, not enough creditsTop up. No image was processed and nothing was billed.
Bad or missing keyHTTP 403 with a permission detailFix the x-api-key header. This API never returns 401.
Write burstHTTP 429The write budget is shared, 300 requests per minute per key across POST, PATCH and DELETE. Slow the caller.
Clear minorDeclined with AGE_BELOW_MINIMUMReject. Send to the document route only if your policy allows an appeal path.
No estimable ageDeclined with AGE_NOT_DETECTED, age nullAsk for a retake, front-facing and well lit. Do not record a rejection.
Spoof suspectedDeclined with LOW_LIVENESS_SCORE or LIVENESS_FACE_ATTACKReject or redo liveness. Never route a spoof signal into the document fallback.
Several people in frameMULTIPLE_FACES_DETECTEDAsk the user to be alone in the frame. The largest face drives the estimate.

Age Estimation is $0.10 per check, one check per 200 response, so a retake after AGE_NOT_DETECTED is a second billable call. The fallback is billed per completed step: ID Verification $0.15 and Face Match $0.05, plus Device and IP Analysis at $0.03 if your workflow runs it. If you run the fallback as a full KYC workflow that repeats passive liveness, that line is charged again at $0.10. The sandbox is free on every plan.

Keep the boundary clean in both directions. The call decides nothing final about a person inside the band; it only routes. A human decides when the workflow sends the session to review, and the console records who decided and what the automatic status would have been. Didit serves 4,000+ active customers. The console shows each session with its warnings, so a reviewer can see why the machine hesitated.

Worked cost example

Assume 10,000 age gates a month and 12% landing inside the band. The 12% is an assumption for the arithmetic, not a Didit figure.

  • 10,000 age gates x $0.10 = $1,000.00
  • 1,200 fallbacks x ($0.15 ID Verification + $0.05 Face Match) = 1,200 x $0.20 = $240.00
  • Total $1,240.00, or $0.124 per gate
  • Same volume running a full KYC check on every gate: 10,000 x $0.33 = $3,300.00, where $0.33 covers ID document $0.15, passive liveness $0.10, Face Match $0.05 and Device and IP $0.03

On the Scale plan the Didit discount is 10%, so Age Estimation is $0.09, ID Verification is $0.135 and Face Match is $0.045. That gives 10,000 x $0.09 = $900.00, and 1,200 x $0.18 = $216.00, for $1,116.00 for the month. A loose retake policy moves the number: if one in five selfies needs a second age call, add 2,000 x $0.10 = $200.00 at list price. A wider buffer also moves it, because every extra year of band adds fallbacks at $0.20 each instead of $0.10.

Sources

Next step: open the sandbox at business.didit.me, enable age estimation on a Liveness node, and run the band logic with sandbox keys before you spend a credit. No sales call is needed.

Try it

Try this in the sandbox

Run the check this guide describes, free.

ID Verification

The product this post is about, taken from its topic. Run it free in the sandbox.

$0.15 per checkStart free

Author

Alberto Rosas

Co-founder and CEO

Alberto Rosas

Alberto Rosas

Co-founder and CEO

About Didit

Questions

Frequently asked questions

What is an age estimation buffer?

A buffer is a band of predicted ages around your legal minimum where you refuse to decide from the selfie alone. Instead of one cut at 18, you approve clearly above the band, reject clearly below it, and send the band itself to ID verification. On Didit you build it by setting the decline threshold to the bottom of the band and routing on the predicted age float.

What should I set age_estimation_decline_threshold to for an 18+ product?

Set it to the bottom of your buffer, which is 16 for a two-year buffer around 18. The default is 18, and leaving it there makes the decline bucket double as your buffer, at a width the model picks rather than one you chose. Keep your own routing on the returned age, because the status alone is a two-way answer.

When should a facial age estimate fall back to ID verification?

Whenever the predicted age lands inside the band you set around the legal minimum. The published error is the reason: a mean absolute error of 1.9 years for 18 to 20-year-olds means a face near the line cannot be settled on the estimate alone. The fallback is also the right route for an appeal from someone the selfie placed just under the line.

How accurate is Didit Age Estimation?

Didit publishes a mean absolute error of 1.1 years for 16 and 17-year-olds and 1.9 years for 18 to 20-year-olds, and states the model classifies 96% of selfies correctly as under 18 or 18 and over. Passive liveness runs in the same call, so presentation attacks can be flagged without a second request. The price is $0.10 per check.

Can I route the band inside the workflow builder without writing routing code?

Yes. The workflow builder lists age among its branch conditions, so a Branch node after the Liveness node can send the band to an ID Verification node and let the rest of the traffic complete. Build it in Advanced mode, publish the version, and run the flow in the sandbox before you take live sessions. Age estimation itself is enabled on the Liveness node, not as a separate workflow feature.

What does AGE_NOT_DETECTED mean and what should I do?

The model could not extract an age from the image, usually because the photo is blurry, dark or the face is angled away, and the predicted age comes back null. Ask for a retake with a single front-facing, well-lit face. Do not record it as a rejection, and remember the retake is another billed call at $0.10.

Does a Declined status always mean the user is underage?

No. A decline fires on any of four conditions: predicted age below your threshold, a passive liveness score at or below the liveness threshold, no face detected, or a suspected presentation attack. Read the warnings array to tell them apart. An age warning and a spoof warning need opposite handling, and only the age warning can go to a document check.

How much does an age gate with an ID fallback cost?

Age Estimation is $0.10 per check. The document route adds ID Verification at $0.15 and Face Match at $0.05 per fallback if the workflow bills those steps separately. At 10,000 gates with 12% falling back, that is $1,240.00 a month at list price, against $3,300.00 if every gate ran a full KYC check at $0.33.

What happens to age estimation calls in the sandbox?

Sandbox keys validate the request and return a static Approved payload with an age of 30 and no warnings. Nothing is processed, no session is stored and no credit is consumed. Test your zone logic with your own fixtures, because the sandbox answer never lands inside the band.

Can I use the age estimate as legal proof of age?

No. The age is model-predicted from the face, not verified against a document, and Didit's own documentation says to use it for age gates and low-friction checks rather than as legal proof of age. Use document-based verification when your policy requires document evidence, and confirm applicable legal requirements for each market.

Compliance built in

Audited, certified and attested.

We hold the certifications and build each country's rules into your flows, so you can launch anywhere without worrying. Security and Compliance center

  • Regulation encoded into your flows

    Tell us what you do and where. Didit lists the rules that apply to you, with sources, and builds the checks each country needs into one workflow.

  • Ready for AMLR

    Every requirement of the new EU anti-money laundering rules, from checking customers to human review, is already covered by a Didit check.

  • Tested in Spain's Treasury sandbox

    Spain's Treasury published its supervised sandbox report on Didit's NFC plus active liveness onboarding; SEPBLAC took part and valued the added measures positively.

  • Audited, not self-declared

    iBeta Level 1 and Level 2. Liveness tested under ISO/IEC 30107-3.

Compliance assistant

Your obligations · 3 regions

EU · AMLRCustomer due diligence, human reviewCovered
Illinois, Texas, ColoradoExplicit biometric consentCovered
Germany · Youth protectionVerified adults only (JMStV)Covered
Workflow checked. Every obligation is met
  • SOC 2 Type 2
  • ISO 27001
  • iBeta Level 1 and Level 2
  • EU regulator attestation
  • FSM youth protection
  • GDPR
  • EBA remote onboarding
  • MiCA compatible
  • FIDO Alliance member
  • AMLREU AML Regulation ready

Integration · Didit MCP

Run Didit from your own AI agent

Connect Didit to Claude, Cursor, VS Code or ChatGPT and just ask in plain words. Your agent can do anything you can do in the console, with the same permissions you have.

Add to ClaudeChatGPT
Didit Academy · Lesson 04 · Use Didit with MCP
  • Build workflowsDescribe the checks you need. The agent creates and publishes the flow.
  • Run investigationsAsk why a session was declined, review cases, search people and companies.
  • Change rulesCreate payment rules, test them on past data and switch them on.
  • Pull reportsAsk for numbers, exports or the audit log.

Verify your first user today.

Start free

Free sandbox. Credit applies to work-email sign-ups.