Use our REST API to calculate ages programmatically. All endpoints are free to use with reasonable rate limits.
GET /api/age
Parameter | Type | Required | Description |
---|---|---|---|
dob | string | Yes | Date of birth (YYYY-MM-DD format) |
asof | string | No | Calculate age as of this date (YYYY-MM-DD). Defaults to today. |
leap_policy | string | No | Policy for Feb 29 birthdays: 'us', 'eu', or 'iso' (default: 'iso') |
tz | string | No | Time zone (e.g., 'America/New_York'). Defaults to UTC. |
ga_weeks | number | No | Gestational age in weeks (24-42) for corrected age calculation |
curl "https://agecalculator.pro/api/age?dob=2000-01-15&asof=2025-09-01&leap_policy=us&tz=America/New_York"
{ "years": 25, "months": 7, "days": 17, "totalDays": 9361, "totalWeeks": 1337, "weekRemainderDays": 2, "hours": 224664, "minutes": 13479840, "seconds": 808790400, "totalMonthsInteger": 307, "totalMonthsFloat": 307.48, "nextBirthday": { "date": "2026-01-15", "inDays": 136, "inWeeks": 19 }, "legalAgeNote": null, "correctedAge": null, "paramsEcho": { "dob": "2000-01-15", "timeZone": "America/New_York", "asOf": "2025-09-01", "leapPolicy": "us" } }
POST /api/age/bulk
Content-Type: text/csv
Upload a CSV file with the following columns:
dob
(required): Date of birthasof
(optional): Calculate as of datega_weeks
(optional): Gestational ageleap_policy
(optional): Leap year policytz
(optional): Time zonedob,asof,ga_weeks,leap_policy,tz 2000-01-15,2025-09-01,,us,America/New_York 2016-02-29,2025-02-28,,eu,Europe/London 2025-07-01,2025-09-01,32,iso,UTC
curl -X POST https://agecalculator.pro/api/age/bulk \ -H "Content-Type: text/csv" \ --data-binary @ages.csv
Returns a CSV file with all input columns plus calculated age fields.
Invalid parameters or missing required fields
{ "error": { "fieldErrors": { "dob": ["Date of birth is required"] } } }
Server error during calculation
{ "error": "Failed to calculate age", "details": "Error message" }
For higher limits, please contact us for enterprise access.
const response = await fetch('https://agecalculator.pro/api/age?' + new URLSearchParams({ dob: '2000-01-15', asof: '2025-09-01', leap_policy: 'us', tz: 'America/New_York' }) ); const data = await response.json(); console.log(`Age: ${data.years} years, ${data.months} months, ${data.days} days`);
import requests params = { 'dob': '2000-01-15', 'asof': '2025-09-01', 'leap_policy': 'us', 'tz': 'America/New_York' } response = requests.get('https://agecalculator.pro/api/age', params=params) data = response.json() print(f"Age: {data['years']} years, {data['months']} months, {data['days']} days")