Create custom holiday year
Creates a custom holiday year configuration for the workspace, allowing you to customize holidays for a specific year and country/region.
What this does: Creates a workspace-specific holiday configuration by copying the default holidays for the specified year and country. Once created, you can add, modify, or delete holidays using the holiday days endpoints.
Important behavior:
- If a custom year already exists for the specified year/country, it will be deleted and recreated
- This effectively resets the year to default holidays
- All existing custom holidays for that year will be lost
- Use this endpoint to start customizing a year or to reset it back to defaults
Validity period (validTill):
The validTill field controls how the custom configuration propagates to future years:
- If
validTillis set (e.g., 2026), the configuration applies to all years from the specified year throughvalidTill - If
validTillisnull, the configuration applies indefinitely to future years - Future years will automatically be created as “derived” configurations
- You can update
validTilllater usingPUT /holidays/years/:yearId
Use cases:
- Adding company-specific holidays (e.g., “Company Outing”, “Festivus”)
- Removing holidays that don’t apply to your organization
- Modifying holiday dates for your specific needs
- Resetting a customized year back to defaults
Next steps: After creating a custom year, use:
POST /holidays/daysto add new holidaysPUT /holidays/days/:dayIdto modify existing holidaysDELETE /holidays/days/:dayIdto remove holidays
POST
/holidays/yearsAuthorization
AuthorizationOAuth2 access token · headerrequiredScopes:
api:writeor
AuthorizationBearer token (JWT) · headerrequiredRequest body
requiredapplication/jsoncountrystringrequiredCountry or region code (e.g., "US", "DE", "US-CA"). Must be one of the available codes from `GET /holidays/countries`.
validTillobjectThe last year this configuration applies to. If `null`, the configuration applies indefinitely to all future years. If set to a specific year (e.g., 2026), the configuration applies from the specified year through that year. Future years within this range will automatically be created as "derived" configurations. You can update this later using `PUT /holidays/years/:yearId`.
yearnumberrequiredThe year to create a custom holiday configuration for. Must be 1900 or later. If a custom year already exists for this year/country combination, it will be deleted and recreated with default holidays.
Responses
201Custom holiday year created successfully
401Unauthorized - Invalid or missing authentication token
403Forbidden - Insufficient API scopes or permissions
Request
curl -X POST "https://leadtime.app/api/public/holidays/years" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"country": "US",
"validTill": 2026,
"year": 2024
}'const response = await fetch("https://leadtime.app/api/public/holidays/years", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"country": "US",
"validTill": 2026,
"year": 2024
})
});import requests
response = requests.post(
"https://leadtime.app/api/public/holidays/years",
headers={
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
json={
"country": "US",
"validTill": 2026,
"year": 2024
},
)Response
Custom holiday year created successfully
Unauthorized - Invalid or missing authentication token
Forbidden - Insufficient API scopes or permissions