Skip to main content

How to Add Selfie Age Verification to Your App (No ID)

Send one selfie to POST /v3/age-estimation/ and receive estimated age, passive liveness, and Approved or Declined status for $0.10 per check. No ID or user challenge is required. The estimate is not legal proof of age.

How to Add Selfie Age Verification to Your App (No ID)

Contents

In this guide

Jump to the part you need.

You can add selfie-based age verification to an app with one server-side call to POST /v3/age-estimation/. You send one face photo and get back an estimated age, a passive liveness score and an Approved or Declined status for $0.10 per check. It fits age gates in age-gated services where asking every user for a passport loses sign-ups. The caveat is real: the age is model-predicted, not legal proof of age.

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

Didit Age Estimation API at a glance
ItemWhat you get
EndpointPOST https://verification.didit.me/v3/age-estimation/
InputOne face photo in user_image. tiff, jpg, jpeg, png or webp. Maximum 5 MB. No PDF.
Outputage_estimation in years, a passive liveness score from 0 to 100, an Approved or Declined status, and a warnings array.
User effortNo ID document, no head turn, no challenge. One front-facing photo.
Default age threshold18 years through age_estimation_decline_threshold. Set it to 0 to disable the age check.
Default liveness threshold30 through face_liveness_score_decline_threshold.
Decision ruleStatus is Approved only when the warnings array is empty.
Price$0.10 per check. $0.096 on Growth, $0.09 on Scale.
SandboxStatic Approved mock with age_estimation: 30 and no warnings. No credits used, nothing stored.
AuthenticationYour application API key in the x-api-key header. A missing or invalid key returns 403, never 401.

Start free in the sandbox at business.didit.me, with no sales call. The product documentation is Didit Age Estimation. If you want an AI assistant to write the integration with you, connect Didit through the Didit MCP server. Plans and every unit price are on didit.me/pricing.

What the selfie age check does, and when it is the wrong tool

The endpoint analyzes the faces in the image with age-estimation and passive-liveness models, and the liveness model looks for presentation attacks such as a printed photo, a screen replay or a mask. Didit returns the age of the largest face in the frame, so a bystander in the background does not drive the number. Inference is documented as sub-2-second, and the call is priced at $0.10.

Use it for age gates, not for regulated identity proofing. The documentation states the model's mean absolute error is 1.1 years for 16 and 17-year-olds and 1.9 years for 18 to 20-year-olds, and that it classifies 96% of selfies correctly as under 18 or 18 and over. That is strong for a gate, and still an estimate. Where a rule demands documentary proof of age, or the estimate lands right on your threshold, fall back to a full ID check at $0.33 per completed KYC.

A selfie being captured on a phone with the face inside the capture guide
The only input the endpoint needs: one clear, front-facing, well-lit face photo.

Prerequisites

  • A Didit application. Create one in the Business Console; it comes with a primary API key.
  • An API key from Developers, then API keys. Sandbox keys start with sk_test_ and live keys with sk_live_; serve them from your backend only.
  • A test selfie in jpg, jpeg, png, tiff or webp under 5 MB.
  • For live calls, credit on your plan. Each 200 response consumes one Age Estimation API credit at $0.10.
  • An HTTP client. The examples below use cURL, and the same multipart form works from any language. The integration prompt is the shortcut if a coding agent is writing the code.

Step-by-step: add selfie age verification

  1. Decide the age you gate at. Pick the value you pass in age_estimation_decline_threshold. The default is 18. If you only need the estimate and the liveness score for your own logic, send 0 to disable the age comparison entirely.
  2. Decide how strict liveness is. face_liveness_score_decline_threshold defaults to 30 on a 0 to 100 scale. Raise it if your fraud rate justifies rejecting more borderline captures.
  3. Take the selfie on the client and post it to your server. The image goes to your backend, and your backend calls Didit. Never put the API key in a browser or a mobile bundle.
  4. Call the endpoint with the multipart form below. Add rotate_image=true if captures can arrive sideways or upside down.
  5. Read warnings before you read status. Approved means the array is empty. Any warning, even one you consider minor, produces Declined.
  6. Branch on the warning code, not only on the status: a retake for AGE_NOT_DETECTED, a rejection for AGE_BELOW_MINIMUM, a reject or a document fallback for LOW_LIVENESS_SCORE and LIVENESS_FACE_ATTACK.
  7. Store the decision. With save_api_request=true, which is the default, the returned request_id is a real session id, so you can call GET /v3/session/{sessionId}/decision/ later or listen for the status.updated webhook.
  8. Test in sandbox first. A sandbox key returns a fixed Approved payload, so you can wire your branches without spending credit.

The call, exactly as documented

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=18' \
-F 'save_api_request=true' \
-F 'vendor_data=user-1234'

Add -F 'rotate_image=true' when mobile captures may not be upright, and -F 'face_liveness_score_decline_threshold=30' to set the liveness cut-off explicitly instead of relying on the default.

Inputs you send

Fields on POST /v3/age-estimation/
FieldDefaultWhat it does
user_imageRequiredThe face photo. tiff, jpg, jpeg, png or webp, maximum 5 MB. Submit one front-facing, well-lit face per image.
age_estimation_decline_threshold18Declines with AGE_BELOW_MINIMUM when the estimated age is under this value. Send 0 to disable the age check.
face_liveness_score_decline_threshold30Declines with LOW_LIVENESS_SCORE when the passive liveness score is at or below this value.
rotate_imagefalseHandles sideways and upside-down mobile captures before face analysis.
save_api_requesttruePersists the call as an API-type session in the Business Console, keeps the face crop and reference image, adds the face embedding to your face index and emits a status.updated webhook. Set false for a one-off correlation id that cannot be looked up later.
vendor_dataNoneOptional value included in the documented request example.
Idempotency key headerNoneOptional request-deduplication key.

Outputs you read

Fields in the 200 response
FieldMeaning
request_idThe session id when save_api_request is true, otherwise a one-off correlation UUID.
age_estimation.statusApproved or Declined. Approved only when warnings is empty.
age_estimation.methodPASSIVE for this endpoint. No user challenge is required.
age_estimation.age_estimationThe predicted age in years for the largest detected face, or null when no age could be estimated.
age_estimation.scorePassive liveness score from 0 to 100.
age_estimation.user_image.entitiesThe face entities detected in the image.
age_estimation.warningsRisk codes. Any entry declines the call.

Expected output

The payload below is illustrative. The shape follows the documented response, and the values are example values, not a fixed reply you will always get back.

{
  "request_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "age_estimation": {
    "status": "Approved",
    "method": "PASSIVE",
    "age_estimation": 24.6,
    "score": 94.2,
    "user_image": { "entities": [ ... ] },
    "warnings": []
  }
}

Read as an example: the largest face was estimated at 24.6 years, the passive liveness model scored it 94.2 out of 100, and nothing landed in warnings, so this call is Approved. Flip one warning into the array and the same call comes back Declined with the reason attached.

The liveness section of a verification session in the Didit Business Console
Because save_api_request defaults to true, the call is stored and its liveness and age result can be reviewed in the console.

Failure cases and how to recover

Errors, warning codes and the fix for each
What you seeWhat it meansWhat to do
HTTP 400Missing or oversized user_image, or an unsupported extension.Send one image under 5 MB in tiff, jpg, jpeg, png or webp. PDFs are rejected. Malformed input is validated even in sandbox.
HTTP 403 with the permission detailMissing or invalid API key. This API never returns 401.Send a valid key in x-api-key from your application in the console.
HTTP 403 not-enough-creditsYour balance cannot cover the call. The endpoint refuses before any image processing.Top up or switch to the sandbox key. Top-ups run from $50 to $20,000.
HTTP 429The shared write budget of 300 requests per minute per API key is exhausted.Back off and retry. The limit covers every POST, PATCH and DELETE on that key.
Declined with AGE_BELOW_MINIMUMThe estimated age is under your age_estimation_decline_threshold.Reject the sign-up or gate the feature. If the estimate sits right on the line, offer the document path.
Declined with AGE_NOT_DETECTEDNo estimable face age. age_estimation is null, usually because of image quality, angle, blur, low light or a face too small in frame.Do not reject on this code. Ask for a retake: fill more of the frame, front-facing, even light, no filter.
Declined with LOW_LIVENESS_SCOREThe passive liveness score is at or below face_liveness_score_decline_threshold, 30 by default.Treat as a suspected spoof. Ask for a retake once, then reject, or escalate to the document route.
Declined with LIVENESS_FACE_ATTACKThe liveness model flagged a presentation attack.Reject. This is a strong signal, not a lighting problem.
Declined with NO_FACE_DETECTEDThe liveness model found no face in the image.Reject the upload as unusable and request a new photo.
Declined with MULTIPLE_FACES_DETECTEDMore than one face is in the frame.Ask for a photo of the user alone. Only the largest face drives the age, so a group shot is not a reliable result.

Embedding age estimation inside a hosted flow

If you use Didit hosted sessions rather than the standalone call, age estimation is not a separate workflow step. It is embedded inside the Liveness node. Enable it on that node in the Business Console and set age_estimation_decline_threshold there, create the session with POST /v3/session/, open session.url for the user, then read the result at liveness_checks[].age_estimation from GET /v3/session/{sessionId}/decision/. It is not a top-level age_estimations[] array, which is the most common integration mistake with this product.

In that mode the passive liveness UI shows the user's face blurred on screen, so the person can see that the frame is analysed for age and not for identification.

Sandbox and test mode

Sandbox is per application, not per account. With a sandbox key, the age estimation endpoint validates the request and then returns a static Approved mock with age_estimation: 30 and no warnings. No session is persisted and no webhook fires. So do not expect a session decision in sandbox from this call: the liveness_checks[] entry with features: ["AGE_ESTIMATION"] appears on sessions created in a live application with save_api_request=true.

Sandbox testing is free and unlimited. The static Approved mock tests your request shape and your success path directly, while warning handling has to be tested against the documented warning codes as fixtures or against live outcomes. The full scenario list is in the sandbox testing docs.

A session overview in the Didit Business Console with the warnings raised on that session
Warnings are the decision surface. Approved only ever means the array came back empty.

Worked cost example

Say you run 40,000 age estimations a month and 5% of them land near the threshold and escalate to a full ID check.

  • List price: 40,000 x $0.10 = $4,000.00.
  • Growth: 40,000 x $0.096 = $3,840.00. The $115 monthly credit pays the first $115.00, leaving $3,725.00 from top-up. Add the $99.00 monthly fee for a total of $3,824.00.
  • Scale: 40,000 x $0.09 = $3,600.00 minus the $350.00 monthly credit = $3,250.00 from top-up, plus the $299.00 fee = $3,549.00.
  • Escalations: 2,000 x $0.33 full KYC = $660.00 at list price, on top of whichever plan you choose.
  • For reference, running all 40,000 users through a full ID check at $0.33 would be $13,200.00 before any discount.

The arithmetic is the point: the selfie gate is a third of the price of a document check, and you only pay the document price for the users who need it. Current plans and unit prices are listed on didit.me/pricing.

Every live 200 response consumes one Age Estimation API credit. Sandbox calls are free and do not consume credits. A 400, a 403 or a 429 consumes nothing. The call accepts an optional idempotency key header, documented in the API reference. The 300 requests per minute write budget is shared with your other write calls, so budget it alongside your session creation traffic.

The standalone call returns Approved or Declined and has no human review step inside it. If your policy requires a person to look at borderline ages, route those results into your own queue, or run the user through a document-based session where the console gives your reviewers the full session, the face crop and the warnings. Nothing on this endpoint turns an estimate into proof of age, and no reviewer can change that.

Sources

Next step: create a sandbox application and run one call with rotate_image=true against a real phone photo. It takes about a minute and costs nothing. Start at business.didit.me, with no sales call.

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

Can Didit verify age without an ID document?

Yes. POST /v3/age-estimation/ estimates age from a single selfie using a face model, with passive liveness in the same call. No document is uploaded and the user performs no challenge. The result is an estimate, so it suits age gates, not legal proof of age.

How accurate is selfie age estimation?

Didit documents a mean absolute error of 1.1 years for 16 and 17-year-olds and 1.9 years for 18 to 20-year-olds, with 96% of selfies correctly classified as under 18 or 18 and over. Accuracy is best exactly where age gating matters. Near your threshold the error grows, so add a document fallback for borderline cases.

What does AGE_NOT_DETECTED mean on an age estimation call?

It means the model could not extract an age from the image, so age_estimation comes back null and the call is Declined. The usual cause is image quality: a face too small in the frame, blur, low light, a sharp angle or a heavy filter. Ask for a retake rather than rejecting the user, because this code says nothing about the person's age.

Why did my call return Declined with AGE_BELOW_MINIMUM?

The estimated age was below the value in age_estimation_decline_threshold, which defaults to 18. If you set the threshold yourself, check the value you sent. If you sent 0 to disable the age check, this warning cannot fire. Reject or gate the feature, and offer the document route when the estimate is within a year of the line.

What does LOW_LIVENESS_SCORE mean and should I reject?

The passive liveness score fell at or below face_liveness_score_decline_threshold, 30 by default. That points to a spoof or a poor capture. Ask for one retake in good light, then reject if it repeats, or escalate the user to a document check where the identity is established a different way.

How much does the age estimation API cost?

It is $0.10 per check on the list price, $0.096 on the Growth plan and $0.09 on Scale. Each 200 response consumes one credit, and a call that fails with 400, 403 or 429 consumes nothing. Sandbox calls are free.

How do I set the age threshold or turn the age check off?

Send age_estimation_decline_threshold on the request, or set it on the Liveness node in the console if you use hosted sessions. The default is 18. Send 0 to disable the age comparison completely and keep only the liveness result and the estimate for your own logic.

Does the sandbox return real age results?

No. A sandbox key returns a static Approved mock with age_estimation: 30 and no warnings after request validation, with no session persisted and no credits used. Use it to test your request shape and your success branch, and test your warning branches against the documented warning codes.

Where do I find the age estimation result in a session decision?

It sits at liveness_checks[].age_estimation on each Liveness entry of GET /v3/session/{sessionId}/decision/, with features: ["AGE_ESTIMATION"]. There is no top-level age_estimations[] array, so parsing the wrong path is a common cause of empty results.

How do I handle sideways selfies from mobile cameras?

Send rotate_image=true with the call. The API rotates the image before face analysis, which prevents a correct photo from failing as NO_FACE_DETECTED or AGE_NOT_DETECTED just because the phone was held at an angle.

What happens if there are two people in the photo?

The largest face in the frame drives age_estimation, and MULTIPLE_FACES_DETECTED is added to warnings, which makes the call Declined. Ask for a photo of the user alone, well lit and front-facing, for a reliable result.

Is a selfie age estimate legal proof of age?

No. Didit's documentation is explicit that the age is model-predicted from the face and not verified against a document, so it is meant for gates and low-friction checks. Where a rule requires documentary proof, use a full ID check at $0.33 per completed check, or one of the digital ID wallet methods Didit publishes.

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.