Age Detection API
Estimate age from a photo with one API call — an age range per face, returned as structured JSON for age-gating and compliance flows.
Published 2026-05-17

detect-age service returns structured JSON your application acts on.TL;DR. To detect age from an image with an API, send the photo to Pixicular and request the detect-age service. The API locates each face, estimates an age range per face, and returns it as JSON in one call. Your code reads the range and applies its own age-gating or compliance logic — estimation is a probabilistic signal, not a legal identity check.
How does age estimation from a photo work?
Age detection is a four-step pipeline. First, the API decodes the uploaded image and runs face detection to locate every face in the frame. Second, each detected face is normalised — cropped, aligned, and scaled — so the model sees a consistent input. Third, a model trained on a large, age-labelled face dataset predicts an age distribution from facial structure and skin-texture cues such as bone proportion, wrinkle patterns, and tonal gradients. Fourth, that distribution is reduced to a reported age range (a low and high bound) plus a confidence score, and returned for each face.
The API deliberately returns a range rather than a single number. Faces of the same chronological age vary widely, so a band like 19–27 is a more honest representation of model certainty than a precise "23". Treat the bounds as the operational signal: decisions should be made against the edge of the range nearest your threshold, not its midpoint. Pixicular's image analysis API exposes this as the first-class detect-age service — you do not have to reach for it through a generic face endpoint.

How accurate is photo age estimation?
Estimating age from a single still image is inherently approximate. On clear, well-lit, front-facing photos of a single subject, the predicted range typically lands within a few years of the true age. Accuracy is highest for children and young adults, where growth and ageing cues are strong and well-separated, and lower for middle and older ages, where the visible signal flattens and the natural spread of how people age widens the honest range.
Several factors degrade accuracy: low resolution and motion blur, harsh or low light, extreme head pose, partial occlusion (sunglasses, masks, hair), heavy beautification filters, and very small faces in the frame. Design for this. Near a legal threshold, widen your decision margin: treat a range that straddles the boundary as "uncertain" and escalate it rather than forcing a pass or block on a noisy midpoint. For population-level analytics the errors largely average out; for per-user gating they do not, which is why escalation paths matter.
Which image types are supported?
The age detection API accepts standard web image formats — JPEG, PNG, and WebP — sent as multipart form data. It is designed for photographs containing one or more clearly visible human faces. For the most reliable estimate, each face should be reasonably sharp, roughly front-facing, and a meaningful size within the frame.
- Good inputs: selfies, ID-style portraits, profile photos, and group photos with distinct, unoccluded faces.
- Weak inputs: tiny or blurred faces, extreme angles, heavy filters, masks or sunglasses, and non-photographic images such as illustrations or avatars.
- If no face is detected, the service returns an empty face list — handle that explicitly and prompt the user for a clearer photo rather than failing closed.
What is the JSON response format?
A request returns one JSON document with a key per requested service. For detect-age, the value is a list of faces; each face carries a normalised bounding box, an estimated ageRange with a low and high bound, and a confidence score. Group photos return one entry per detected face so you can gate on the youngest.
{
"detect-age": {
"faces": [
{
"boundingBox": { "x": 0.31, "y": 0.18, "width": 0.22, "height": 0.34 },
"ageRange": { "low": 19, "high": 27 },
"confidence": 0.91
},
{
"boundingBox": { "x": 0.62, "y": 0.21, "width": 0.20, "height": 0.31 },
"ageRange": { "low": 34, "high": 46 },
"confidence": 0.87
}
]
},
"meta": {
"processingTimeMs": 412,
"requestId": "req_8f2c1a9e"
}
}
Field names, bounds behaviour, and exact confidence semantics are defined in the Pixicular API documentation. Note: Pixicular's AI-generated image detection service is currently disabled while accuracy is being improved. The detect-age service described here is live today.
Code: calling the age detection API
One request, one service. The image is uploaded once and the response is a single JSON document you parse for the age range.
curl
curl -X POST https://api.pixicular.com/detect \
-H "Authorization: Bearer $PIXICULAR_API_KEY" \
-F "image=@./profile-photo.jpg" \
-F "services=detect-age"TypeScript — gate a sign-up flow
// Gate a sign-up flow on an estimated age range.
async function checkAgeGate(file: Blob, minimumAge: number) {
const body = new FormData();
body.append("image", file);
body.append("services", "detect-age");
const res = await fetch("https://api.pixicular.com/detect", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PIXICULAR_API_KEY}` },
body,
});
const result = await res.json();
const faces = result["detect-age"]?.faces ?? [];
if (faces.length === 0) return "no_face_retry";
// Use the lower bound and a safety margin near the legal threshold.
const youngest = Math.min(
...faces.map((f: { ageRange: { low: number } }) => f.ageRange.low),
);
const SAFETY_MARGIN = 3;
if (youngest >= minimumAge + SAFETY_MARGIN) return "pass";
if (youngest < minimumAge - SAFETY_MARGIN) return "block";
return "escalate_to_id_check";
}The minimum age and safety margin are policy you own, not the API's. You can request detect-age alongside other services — for example content moderation — in the same call; see the API documentation for authentication and the full multi-service response schema.
Supported use cases
Age estimation fits anywhere you need a fast, low-friction age signal without forcing every user through document verification. In each case the API supplies the range; your service owns the decision.
| Use case | What the API does | Typical decision |
|---|---|---|
| Age-gating sign-up | Estimate age at registration before granting access to an age-restricted product | Pass clear adults, block clear minors, escalate the rest |
| COPPA / GDPR-U compliance | Flag accounts likely below the children's-data age so parental-consent flows trigger | Route likely-under-13 (COPPA) or under-16 (GDPR-U) to consent gate |
| Age-assurance first layer | Cheap, low-friction estimate that filters who actually needs full ID verification | Only ambiguous ranges are sent to document-based KYC |
| Content personalisation | Adapt recommendations or default settings to a coarse age bracket | Map the range to a content tier — not an identity record |
| Marketplace & dating safety | Detect likely-underage profile photos alongside content moderation | Combine age range with moderation flags before a profile goes live |
| Audience analytics | Aggregate age distribution across opted-in user photos for reporting | Store only anonymised, bucketed counts — never per-user ages |
For stricter regulated contexts, pair estimation with a stronger check — see age verification for age-restricted platforms for how estimation feeds a gating decision, and image moderation for dating apps for combining age signals with content moderation on profile photos.
Age estimation, compliance, and data minimisation
Estimating age from a face is biometric processing under the GDPR and comparable regimes, which means you need a lawful basis and, in many cases, explicit consent, a data protection impact assessment, and a clear retention policy. The practical pattern is data minimisation: send the image, read the age range, make the decision, and discard the photo. Persist only what an audit genuinely requires — typically the decision and a coarse bucket, not the raw image or an exact predicted age tied to a user.
For children's-data regimes — COPPA in the US (under-13) and the GDPR's age-of-consent provisions for information society services (commonly 16, lowered to as low as 13 by some member states) — estimation is best used as a trigger: a likely under-threshold result routes the user into a parental-consent or restricted-experience flow rather than silently blocking them. This is general information, not legal advice — confirm your obligations with counsel and the API documentation before deploying age gating in a regulated jurisdiction.
Frequently asked questions
How do you detect age from an image with an API?
You POST an image to the age detection API and request the detect-age service. Pixicular finds each face in the photo, analyses facial structure and texture cues, and returns an estimated age — typically as a low and high bound — for every face in a single JSON response. Your application reads that range and applies its own gating or routing logic; the API does not make the policy decision for you.
How accurate is photo age estimation?
Age estimation from a single photo is an estimate, not a measured fact. On clear, well-lit, front-facing photos of a single subject, the predicted range usually lands within a few years of the true age, with accuracy highest for children and young adults and lower for middle and older ages. Accuracy drops with poor lighting, low resolution, heavy occlusion, extreme angles, or heavy filters. Treat the output as a probabilistic signal and widen your decision margins near a legal threshold rather than gating on the exact midpoint.
Which image types and formats does the age detection API support?
The API accepts standard web image formats — JPEG, PNG, and WebP — uploaded as multipart form data. It works best on photographs containing one or more clearly visible human faces. Each face should be reasonably sharp and large within the frame; very small, blurred, or heavily occluded faces may be skipped or returned with a wider range. Non-photographic images, illustrations, and faces obscured by masks or sunglasses are not reliable inputs.
Can I use the age detection API for legal age verification?
Photo age estimation is an age-assurance signal, not a legally binding identity check. It is well suited to low-friction age-gating, risk scoring, and routing ambiguous cases to a stronger check, but it does not replace document-based KYC where a law requires verified identity. Many platforms use estimation as a first layer: clearly-adult and clearly-underage cases are handled automatically, and only borderline ranges are escalated to ID verification.
Is the data processed for age detection stored or used for training?
Estimating age from a face is biometric processing under the GDPR and similar regimes, so it requires a lawful basis and, in many cases, explicit consent and a data protection impact assessment. Pixicular returns the age estimate so your application can act on it and discard the image as soon as the decision is made — keep only the minimum you need for audit. Confirm storage, retention, and training terms against the API documentation and your own compliance requirements before going to production.
Add age detection to your flow
The fastest way to evaluate Pixicular for age estimation is to point a curl request at it with a real photo. Pick a plan on the pricing page and follow the API documentation for authentication and the full response schema for the detect-age service.