DateDelta API Documentation
Integrate DateDelta's powerful date calculations into your applications with our RESTful API.
Base URL
https://datedelta.com/api
Headers
Content-Type: application/json
Authentication
The API supports both anonymous access and authenticated requests with API keys.
🔑 API Keys Now Available!
Create an API key in your dashboard to unlock premium features:
- Up to 10,000 requests/day (vs 100/min for anonymous)
- Customizable rate limits per key
- Usage analytics and monitoring
- Priority support
Calculate days between dates
Add 30 days to a date
Get US holidays
Calculate business days
Endpoints
/api/calculate/date-difference
Basic Example
{
"startDate": "2024-01-01",
"endDate": "2024-12-31",
"includeEndDate": false
}
Include End Date
{
"startDate": "2024-03-15",
"endDate": "2024-03-20",
"includeEndDate": true
}
Date-Time Format
{
"startDate": "2024-01-01T09:00:00Z",
"endDate": "2024-01-01T17:30:00Z",
"includeEndDate": false
}
/api/calculate/date-arithmetic
Add Days
{
"date": "2024-01-01",
"operation": "add",
"value": 30,
"unit": "days"
}
Subtract Months
{
"date": "2024-06-15",
"operation": "subtract",
"value": 3,
"unit": "months"
}
Add Years
{
"date": "2024-02-29",
"operation": "add",
"value": 1,
"unit": "years"
}
/api/calculate/business-days
With US Holidays
{
"startDate": "2024-01-01",
"endDate": "2024-01-31",
"skipWeekends": true,
"holidays": [
{
"date": "2024-01-01",
"name": "New Year's Day",
"type": "federal"
},
{
"date": "2024-01-15",
"name": "Martin Luther King Jr. Day",
"type": "federal"
}
]
}
Without Holidays
{
"startDate": "2024-03-01",
"endDate": "2024-03-31",
"skipWeekends": true,
"holidays": []
}
Custom Weekend Days
{
"startDate": "2024-01-01",
"endDate": "2024-01-31",
"skipWeekends": true,
"weekendDays": [5, 6],
"holidays": []
}
/api/calculate/batch
Mixed Calculations
{
"calculations": [
{
"type": "date-difference",
"params": {
"startDate": "2024-01-01",
"endDate": "2024-12-31",
"includeEndDate": false
}
},
{
"type": "date-arithmetic",
"params": {
"date": "2024-01-01",
"operation": "add",
"value": 30,
"unit": "days"
}
}
]
}
Multiple Date Differences
{
"calculations": [
{
"type": "date-difference",
"params": {
"startDate": "2024-01-01",
"endDate": "2024-03-31"
}
},
{
"type": "date-difference",
"params": {
"startDate": "2024-04-01",
"endDate": "2024-06-30"
}
},
{
"type": "date-difference",
"params": {
"startDate": "2024-07-01",
"endDate": "2024-09-30"
}
}
]
}
/api/holidays/[country]
US Holidays 2024
Current Year (Default)
Future Year
All endpoints return errors in a consistent format:
{
"success": false,
"error": "Validation error",
"details": [
{
"path": ["startDate"],
"message": "Invalid date format"
}
]
}
Current Limits
Anonymous Users
100 requests/min
Per IP address
API Key Holders
Customizable
Up to 10,000/day
Rate Limit Headers
Rate limit information is included in all API responses:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 99
X-RateLimit-Reset: 1672531200
Retry-After: 60 (when rate limited)
⚡ Need Higher Limits?
Create an API key in your dashboard to customize your rate limits. Contact support for enterprise-level limits.
Create API KeyAuthenticate your requests with an API key to unlock higher rate limits and track usage.
Authentication Methods
Header Authentication (Recommended)
curl -X POST https://datedelta.com/api/calculate/date-difference \
-H "Content-Type: application/json" \
-H "X-API-Key: your_api_key_here" \
-d '{"startDate": "2024-01-01", "endDate": "2024-12-31"}'
Query Parameter (Alternative)
GET https://datedelta.com/api/holidays/us?year=2024&apiKey=your_api_key_here
🔐 Security Best Practices
- Never expose your API key in client-side code
- Use environment variables to store keys
- Rotate keys regularly
- Use header authentication over query parameters