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 · Updated 2026-10-26

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 takes four steps. You upload an image. The API finds every face in the frame. A face-analysis model estimates an age for each face from visual cues such as facial structure and skin texture. Finally, each face comes back as an age range (a low and high bound), a single age estimate, and a confidence score, all in one JSON response.
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: people of the same age look very different, and lifestyle, lighting, and make-up all shift the result. Clear, well-lit, front-facing photos of a single subject give the most reliable ranges. Pixicular does not publish an accuracy figure for age estimation, so validate the ranges on photos that look like your own traffic before you set thresholds.
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 JPEG, PNG, WebP, AVIF, and TIFF images up to 10 MB and between 100×100 and 4096×4096 pixels, 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 under services. For detect-age, the value is a list of faces; each face carries an ageRange with a low and high bound, an ageEstimate (the midpoint of that range), and a confidence percentage that the region is a face (it is not a certainty score for the age itself, which is why the range matters). Group photos return one entry per detected face so you can gate on the youngest.
{
"success": true,
"requestId": "req_wUKl0im7IZg4bCefnE",
"services": {
"detect-age": {
"faces": [
{
"ageRange": { "low": 25, "high": 31 },
"ageEstimate": 28,
"confidence": 99.9
},
{
"ageRange": { "low": 38, "high": 46 },
"ageEstimate": 42,
"confidence": 99.7
}
]
}
},
"photo": { "id": "photo_Dy2csYO9nhYgdDxn9B", "status": "COMPLETED" },
"creditCost": 1,
"processingTimeMs": 1250,
"processedAt": "2026-10-26T09:30:00.000Z"
}
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/v1/detect \
-H "Authorization: Bearer $PIXICULAR_API_KEY" \
-F "file=@./profile-photo.jpg" \
-F "services=detect-age"TypeScript — gate a sign-up flow
interface AgeFace {
ageRange: { low: number; high: number };
ageEstimate: number;
confidence: number;
}
// Gate a sign-up flow on an estimated age range.
async function checkAgeGate(file: Blob, minimumAge: number) {
const body = new FormData();
body.append("file", file);
body.append("services", "detect-age");
const res = await fetch("https://api.pixicular.com/v1/detect", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PIXICULAR_API_KEY}` },
body,
});
// 202 means the request was queued under load: poll its statusUrl (see the docs).
if (res.status === 202) return "retry_later";
if (!res.ok) throw new Error(`Pixicular returned ${res.status}`);
const result = await res.json();
const faces: AgeFace[] = result.services["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) => 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?
POST the image to https://api.pixicular.com/v1/detect with services=detect-age. Pixicular finds each face in the photo and returns an estimated age range (a low and a high bound), an age estimate, and a confidence score 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, which is why the API returns a range instead of one number. Clear, well-lit, front-facing photos give the most reliable ranges; poor lighting, low resolution, motion blur, heavy occlusion, extreme angles, and beautification filters make the estimate less reliable. Treat the output as a probabilistic signal and widen your decision margins near a legal threshold rather than gating on the midpoint.
Which image types and formats does the age detection API support?
The API accepts JPEG, PNG, WebP, AVIF, and TIFF images up to 10 MB and between 100×100 and 4096×4096 pixels, sent as a multipart upload to /v1/detect or by public URL to /v1/detect-from-url. It works best on photographs with one or more clearly visible faces. If no face is found, the faces list comes back empty. Illustrations, avatars, and faces hidden 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.
Are the photos I send for age detection stored?
Per the Pixicular privacy policy, uploaded images are retained for 30 days after analysis and detection results for the life of your account plus 90 days. Estimating age from a face is also biometric processing under the GDPR and similar regimes, so you need a lawful basis and, in many cases, explicit consent and a data protection impact assessment. On your side, keep only the minimum an audit requires, typically the decision and a coarse age bucket rather than the photo or an exact age tied to a user.
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.