Lincoln Cannon LLC

ChronoAge Calculator API

ChronoAge Calculator API

Calculate precise chronological age metrics using our ChronoAge API. This endpoint provides detailed age calculations in years, months, weeks, and days based on birth and test dates. For practical use cases, read more about our ChronoAge Calculator. Or read about our entire Biometric Calculator suite.

API Endpoint

Base URL

https://api.lincolncannon.co/biometric/calculate

Method

Headers

Header Value Description
Content-Type application/json Request body format
x-api-key [your API key] Authentication key

Request Parameters

Parameter Type Required Description
TestType string Yes Must be set to “ChronoAge”
BirthDate string Yes Birth date in YYYY-MM-DD format
TestDate string No Test date in YYYY-MM-DD format (defaults to current date)

Response Structure

Field Type Description
function string Name of the executed function
result object Contains calculated age metrics
result.days number Total number of days
result.months number Total number of months
result.weeks number Total number of weeks
result.years number Total number of years
result.monthsWeeksDays object Detailed breakdown in months, weeks, and days
result.weeksDays object Detailed breakdown in weeks and days
result.yearsMonthsWeeksDays object Detailed breakdown in years, months, weeks, and days
message string Descriptive summary of results

Example Request

{
  "TestType": "ChronoAge",
  "BirthDate": "1974-12-01",
  "TestDate": "2024-01-31"
}

Example Response

{
  "function": "LincolnCannonLLCBiometric-prod-calculate",
  "result": {
    "days": 17958,
    "months": 590,
    "monthsWeeksDays": {
      "months": 589,
      "weeks": 4,
      "days": 2
    },
    "weeks": 2565.43,
    "weeksDays": {
      "weeks": 2565,
      "days": 3
    },
    "years": 49.17,
    "yearsMonthsWeeksDays": {
      "years": 49,
      "months": 1,
      "weeks": 4,
      "days": 2
    }
  },
  "message": "For a person with the specified birth and calculation dates, we calculated a chronological age of 49 years, 1 months, 4 weeks, and 2 days. This is the equivalent of 49.17 years, or 590 months, or 2565.43 weeks, or 17958 days."
}

Implementation Examples

JavaScript Implementation

async function calculateChronoAge(birthDate, testDate = null) {
    const requestBody = {
        TestType: "ChronoAge",
        BirthDate: birthDate,
        ...(testDate && { TestDate: testDate })
    };

    try {
        const response = await fetch('https://api.lincolncannon.co/biometric/calculate', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json',
                'x-api-key': process.env.API_KEY
            },
            body: JSON.stringify(requestBody)
        });

        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }

        const data = await response.json();
        return data;
    } catch (error) {
        console.error('Error calculating ChronoAge:', error);
        throw error;
    }
}

// Usage example
const chronoAgeResult = await calculateChronoAge('1974-12-01', '2024-01-31');
console.log('Chronological Age:', chronoAgeResult.result.years);

Python Implementation

import requests
import os

class ChronoAgeCalculator:
    def __init__(self, api_key):
        self.api_key = api_key
        self.base_url = "https://api.lincolncannon.co/biometric/calculate"
        self.headers = {
            'Content-Type': 'application/json',
            'x-api-key': api_key
        }

    def calculate_chrono_age(self, birth_date, test_date=None):
        """Calculate chronological age"""
        request_body = {
            "TestType": "ChronoAge",
            "BirthDate": birth_date
        }
        
        if test_date:
            request_body["TestDate"] = test_date

        try:
            response = requests.post(
                self.base_url,
                headers=self.headers,
                json=request_body
            )
            response.raise_for_status()
            return response.json()
        except requests.exceptions.RequestException as e:
            print(f"Error calculating ChronoAge: {e}")
            raise

# Usage example
calculator = ChronoAgeCalculator(os.getenv('API_KEY'))
chrono_result = calculator.calculate_chrono_age('1974-12-01', '2024-01-31')
print(f"Chronological Age: {chrono_result['result']['years']} years")

Error Handling

Common Error Responses

HTTP Status Error Code Description
400 INVALID_REQUEST Missing or invalid parameters
401 UNAUTHORIZED Invalid or missing API key
403 FORBIDDEN Access denied
422 VALIDATION_ERROR Invalid date format
500 INTERNAL_ERROR Server processing error

Error Response Format

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid birth date format. Expected YYYY-MM-DD",
    "details": {
      "field": "BirthDate",
      "value": "1974/12/01"
    }
  }
}

Authentication

API Key Requirements

All requests to the ChronoAge API require authentication using an API key:

  1. Obtain API Key: Contact Lincoln Cannon LLC to receive your API key
  2. Include in Headers: Add your API key to the x-api-key header

Security Best Practices

Practice Description
Secure Storage Store API keys securely, never in client-side code
Environment Variables Use environment variables for API key storage
HTTPS Only Always use HTTPS for API communications
Key Rotation Regularly rotate API keys for enhanced security

Support & Troubleshooting

Common Issues

Issue Solution
Invalid date format Ensure dates are in YYYY-MM-DD format
Missing required fields Verify BirthDate is included in the request
API key authentication Check that your API key is valid and included in headers

Testing Your Integration

  1. Validate Date Formats: Ensure all dates use YYYY-MM-DD format
  2. Test with Sample Data: Use the provided examples to verify your implementation
  3. Error Handling: Implement proper error handling for API responses

Getting Help

If you encounter issues with the ChronoAge API:

  1. Check Documentation: Review this guide for parameter requirements
  2. Validate Input Data: Ensure all required fields are provided with correct formats
  3. Test with Sample Data: Use the provided examples to verify your implementation
  4. Contact Support: Reach out to Lincoln Cannon LLC for technical assistance