Use this endpoint when a location holiday needs a new name, different dates, half-day status, transfer behaviour, or yearly repetition rules. It is a partial update: include only the properties you intend to change, and the remaining values stay as they are.
Endpoint and authorisation
Call PATCH on the holiday resource under a location, supplying both path identifiers. Authenticate with a bearer API key carrying the holidays:write scope. The key owner is the acting user unless an on-behalf-of header names another user the owner manages and the key has the matching scope.
Path and header inputs
Both identifiers in the path are required strings: the location id and the holidayId. In the header, an optional Idempotency-Key makes retries safe for 24 hours per key; replaying the same request returns the original response, while reusing the key for a different request is rejected. An optional X-On-Behalf-Of header selects the user the write acts for.
What you can change
The JSON body is partial. Available fields are name, startDate, endDate, isHalfDay, transferIfFallsOnNonWorkingDay, recurring, and recurringRules. Names are trimmed and must not be blank. Dates use YYYY-MM-DD, with endDate in the same year as startDate. For a multi-day holiday, the stored start and end span every day in the span, so changing one date moves the whole span. Recurrence rules cover exact-date repetition or a specific weekday pattern such as the fourth Thursday of November, plus how many days the holiday lasts.
Edit limits by holiday type
Check the holiday type before editing. A custom holiday that repeats every year is immutable through this endpoint; delete and recreate it instead. An imported holiday can only be renamed or switched to non-recurring. Attempting anything else, including making a non-recurring imported holiday recurring, returns 409 HOLIDAY_UPDATE_NOT_POSSIBLE.
Reading the response
A completed synchronous update returns 200 with the holiday record, including its id, locationId, name, date, isHalfDay, type, and recurring flag, plus multiDayId or transferredFrom when applicable. If processing continues in the background, the response is 202 with an operation containing an id, status, and polling URL. Poll that URL until the status is SUCCEEDED or FAILED; UNKNOWN means no result arrived within 15 minutes and the holiday should be read directly to confirm the outcome.
Pre-flight checklist and error handling
Before sending, confirm the key has holidays:write, both path IDs are correct and reachable by the key, and the intended edit is allowed for the holiday type. After sending, handle 200 as done, 202 as poll, and errors by code: validation and malformed-body problems need field fixes, 403 covers acting-user and scope problems, 404 covers a missing or unreachable location or holiday, 409 covers update-not-possible, overlapping dates, and idempotency conflicts, and 422 covers invalid dates or idempotency reuse. Rate-limit and server errors should be retried later, reusing the same Idempotency-Key for writes.
Frequently asked questions
What happens if I send no changes?
Send only the fields that should differ. Everything else is kept from the current holiday, and an empty or no-change request returns the existing record without writing.
Why can some holidays not be edited?
A yearly custom holiday cannot be edited in place; remove it and create a replacement. An imported holiday accepts only a rename or setting recurring to false. Other edits return 409 HOLIDAY_UPDATE_NOT_POSSIBLE.
How do I know an asynchronous update finished?
A 200 response returns the holiday directly. A 202 response returns an operation object; poll its URL until the status becomes SUCCEEDED or FAILED. UNKNOWN means no result arrived within 15 minutes, so read the holiday to check whether the change was applied.
{
"error": {
"code": "VALIDATION_ERROR",
"name": "ValidationError",
"description": "Example post details.",
"resolution": "Fix the fields listed in details.fields and send the request again.",
"requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef",
"details": {
"fields": [
{
"path": "startDate",
"message": "\"startDate\" is required"
}
]
}
}
}
{
"error": {
"code": "UNAUTHORIZED",
"name": "Unauthorized",
"description": "Example post details.",
"resolution": "Send a valid API key in the Authorization header as Bearer followed by the full vt_live_ key.",
"requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef"
}
}
{
"error": {
"code": "INSUFFICIENT_SCOPE",
"name": "InsufficientScope",
"description": "Example post details.",
"resolution": "Add the scopes listed in details.requiredScopes to the key in the OnlyLeave dashboard.",
"requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef",
"details": {
"requiredScopes": [
"leaves:write"
]
}
}
}
{
"error": {
"code": "RESOURCE_NOT_FOUND",
"name": "ResourceNotFound",
"description": "Example post details.",
"resolution": "Check the ID of the resource named in details.resource and that the key owner can see it.",
"requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef"
}
}
{
"error": {
"code": "CONFLICT",
"name": "Conflict",
"description": "Example post details.",
"resolution": "Read the resource again and retry with up-to-date values.",
"requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef"
}
}
{
"error": {
"code": "LEAVE_NEGATIVE_BALANCE",
"name": "LeaveNegativeBalance",
"description": "Example post details.",
"resolution": "Shorten the leave, use a different leave type, or ask an admin to adjust the quota.",
"requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef"
}
}
{
"error": {
"code": "RATE_LIMITED",
"name": "RateLimited",
"description": "Example post details.",
"resolution": "Wait a few seconds and retry, using the same Idempotency-Key for writes.",
"requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef"
}
}
{
"error": {
"code": "INTERNAL_ERROR",
"name": "InternalError",
"description": "Example post details.",
"resolution": "Retry later, and if it keeps happening, contact OnlyLeave support and quote the requestId.",
"requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef"
}
}
id
Field
Type
Required
Description
Constraints
id
string
Yes
resource ID.
holidayId
Field
Type
Required
Description
Constraints
holidayId
string
Yes
holiday ID.
Idempotency-Key
Field
Type
Required
Description
Constraints
Idempotency-Key
string
No
optional key (1 to 255 printable ASCII characters) that makes a write request safe to retry. Keys are retained for 24 hours per API key. Retrying with the same key and the same request within those 24 hours replays the original response (with the Idempotent-Replayed header). Reusing the key with a different request returns 422 IDEMPOTENCY_KEY_REUSED ; retrying while the first request is still running returns 409 IDEMPOTENCY_REQUEST_IN_PROGRESS ; an invalid key returns 400 INVALID_IDEMPOTENCY_KEY .
1 <= length <= 255
X-On-Behalf-Of
Field
Type
Required
Description
Constraints
X-On-Behalf-Of
string
No
ID of the user the write is performed for. Requires the users:act-on-behalf scope, and the key owner must manage the target user; otherwise the request fails with 403 ON_BEHALF_OF_NOT_ALLOWED . Ignored on GET requests.
body
Field
Type
Required
Description
Constraints
body
object
Yes
The fields to change; the rest keep their current values. An empty object, or one that changes nothing, returns the unchanged holiday. The current startDate and endDate span every day of a multi-day holiday.
body.name
string
No
holiday name, not blank; leading and trailing spaces are trimmed
1 <= length
body.startDate
string
No
the first day, a calendar date in YYYY-MM-DD format
Format: date
body.endDate
string
No
the last day, a calendar date in YYYY-MM-DD format in the same year as startDate
Format: date
body.isHalfDay
boolean
No
whether it is a half-day holiday
body.transferIfFallsOnNonWorkingDay
boolean
No
whether the holiday moves to the next working day when it falls on a non-working day
body.recurring
boolean
No
whether the holiday repeats every year
body.recurringRules
object
No
how a recurring holiday repeats when it is not on the same calendar date every year
body.recurringRules.exactDate
boolean
No
whether the holiday repeats on the same calendar date
body.recurringRules.specificDaySet
array<integer>
No
[weekOfMonth, dayOfWeek, month] : week of the month 1 to 5, day of the week 0 (Sunday) to 6 (Saturday), month 1 to 12. [4, 4, 11] is the fourth Thursday of November.
3 <= items <= 3
body.recurringRules.specificDaySet[]
integer
body.recurringRules.specificDayDuration
integer
No
the number of days the holiday lasts from that day
1 <= value
response
Field
Type
Required
Description
Constraints
response
object
Returned with HTTP 202 when a write operation is still running, or succeeded but its result could not be read back yet. The Location header carries the same URL as operation.url . Poll it until the status is SUCCEEDED or FAILED .
response.operation
object
Yes
response.operation.id
string
Yes
response.operation.status
string
Yes
operation status. UNKNOWN means no result arrived within 15 minutes; the change may or may not have been applied, so read the resource to check. A result that arrives later still changes it to SUCCEEDED or FAILED.