Powerful life calculation and countdown APIs for building applications that help people visualize their time.
The AliveFor API provides programmatic access to life calculation data, real-time countdowns, and sharing capabilities. Perfect for building Mac apps, mobile applications, hardware integrations, and web services.
All API responses are in JSON format with a consistent structure:
{
"success": true|false,
"data": { ... }, // Present on success
"error": "message" // Present on failure
}
Currently, all API endpoints are publicly accessible without authentication. For user-specific data, you'll need to know the username or share ID.
Calculate life statistics including time lived, remaining time, and percentage of life completed.
{
"birthdate": "1981-04-02",
"lifespan": 80
}
{
"success": true,
"data": {
"birthdate": "1981-04-02",
"lifespan": 80,
"lived": {
"years": 43,
"months": 4,
"days_in_month": 27,
"hours_in_day": 14,
"minutes_in_hour": 23,
"seconds_in_minute": 42
},
"remaining": {
"years": 36,
"months": 7,
"days_in_month": 3,
"hours_in_day": 9,
"minutes_in_hour": 36,
"seconds_in_minute": 18
},
"percentage": 54.17,
"death_date": "2061-04-02"
}
}
Retrieve public user profile with real-time life statistics.
{
"success": true,
"data": {
"username": "michelini",
"birthdate": "1981-04-02",
"lifespan": 80,
"created_at": "2024-12-20T10:30:00",
"life_stats": {
"lived": { ... },
"remaining": { ... },
"percentage": 54.17
}
}
}
Get live countdown data for continuous updates. Use user-{username}
for user profiles or share IDs for public calculations.
{
"success": true,
"data": {
"countdown_id": "user-michelini",
"birthdate": "1981-04-02",
"lifespan": 80,
"live_stats": { ... },
"last_updated": "2024-12-20T15:23:45.123Z"
}
}
Get list of users who opted into the public directory. Returns users who have set include_in_directory = true
in their profile settings.
{
"success": true,
"users": [
{
"username": "michelini",
"birthdate": "1981-04-02",
"lifespan": 80,
"created_at": "2025-08-26T15:45:52.405899",
"stats": {
"lived": { "days": 16220, "years": 44, ... },
"remaining": { "days": 13000, "years": 35, ... },
"percent": 55.51,
"birthdate": "1981-04-02",
"lifespan": 80
}
}
],
"total": 1
}
// Calculate life stats
const response = await fetch('/api/v1/calculate', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
birthdate: '1990-01-01',
lifespan: 80
})
});
const data = await response.json();
if (data.success) {
console.log('Life percentage:', data.data.percentage);
}
curl -X POST https://alivefor.com/api/v1/calculate \
-H "Content-Type: application/json" \
-d '{
"birthdate": "1990-01-01",
"lifespan": 80
}'
struct LifeStats: Codable {
let birthdate: String
let lifespan: Int
let percentage: Double
}
func getLifeStats(username: String) async {
let url = URL(string: "https://alivefor.com/api/v1/user/\(username)")!
let (data, _) = try await URLSession.shared.data(from: url)
let response = try JSONDecoder().decode(APIResponse.self, from: data)
if response.success {
updateUI(with: response.data.life_stats)
}
}
Current rate limits per IP address: