Skip to content

Update a holiday with the locations API

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.

curl -X PATCH "$API_BASE_URL/v2/locations/string/holidays/string" \
  -H "Authorization: Bearer " \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Christmas"
  }'
{
  "data": {
    "id": "holiday-4d2b7c1e-9a3f-4e5d-8c6b-1a2f3e4d5c6b",
    "locationId": "location-79c77ac8-e5bf-479f-9488-648a58379ff1",
    "name": "Christmas Day",
    "date": "2026-12-25",
    "isHalfDay": false,
    "type": "custom",
    "recurring": true
  }
}
{
  "operation": {
    "id": "pa_3f1c2b9e-8a47-4d5e-9c61-2b7f0e4a1d93",
    "status": "PENDING",
    "url": "/v2/operations/pa_3f1c2b9e-8a47-4d5e-9c61-2b7f0e4a1d93"
  }
}
{
  "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

FieldTypeRequiredDescriptionConstraints
idstringYesresource ID.

holidayId

FieldTypeRequiredDescriptionConstraints
holidayIdstringYesholiday ID.

Idempotency-Key

FieldTypeRequiredDescriptionConstraints
Idempotency-KeystringNooptional 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

FieldTypeRequiredDescriptionConstraints
X-On-Behalf-OfstringNoID 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

FieldTypeRequiredDescriptionConstraints
bodyobjectYesThe 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.namestringNoholiday name, not blank; leading and trailing spaces are trimmed1 <= length
body.startDatestringNothe first day, a calendar date in YYYY-MM-DD formatFormat: date
body.endDatestringNothe last day, a calendar date in YYYY-MM-DD format in the same year as startDateFormat: date
body.isHalfDaybooleanNowhether it is a half-day holiday
body.transferIfFallsOnNonWorkingDaybooleanNowhether the holiday moves to the next working day when it falls on a non-working day
body.recurringbooleanNowhether the holiday repeats every year
body.recurringRulesobjectNohow a recurring holiday repeats when it is not on the same calendar date every year
body.recurringRules.exactDatebooleanNowhether the holiday repeats on the same calendar date
body.recurringRules.specificDaySetarray<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.specificDayDurationintegerNothe number of days the holiday lasts from that day1 <= value

response

FieldTypeRequiredDescriptionConstraints
responseobjectReturned 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.operationobjectYes
response.operation.idstringYes
response.operation.statusstringYesoperation 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.Allowed values: "PENDING" | "SUCCEEDED" | "FAILED" | "UNKNOWN"
response.operation.urlstringYes

response

FieldTypeRequiredDescriptionConstraints
responseobjectError envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog .
response.errorobjectYes
response.error.codestringYesstable machine-readable error code
response.error.namestringYesshort human-readable error name
response.error.descriptionstringYeswhat went wrong
response.error.resolutionstringYeshow to fix the problem
response.error.requestIdstringYesrequest ID, include it when contacting support
response.error.detailsobjectNooptional additional information specific to the error code
response.error.details.[key: string]anyNo

response

FieldTypeRequiredDescriptionConstraints
responseobjectError envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog .
response.errorobjectYes
response.error.codestringYesstable machine-readable error code
response.error.namestringYesshort human-readable error name
response.error.descriptionstringYeswhat went wrong
response.error.resolutionstringYeshow to fix the problem
response.error.requestIdstringYesrequest ID, include it when contacting support
response.error.detailsobjectNooptional additional information specific to the error code
response.error.details.[key: string]anyNo

response

FieldTypeRequiredDescriptionConstraints
responseobjectError envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog .
response.errorobjectYes
response.error.codestringYesstable machine-readable error code
response.error.namestringYesshort human-readable error name
response.error.descriptionstringYeswhat went wrong
response.error.resolutionstringYeshow to fix the problem
response.error.requestIdstringYesrequest ID, include it when contacting support
response.error.detailsobjectNooptional additional information specific to the error code
response.error.details.[key: string]anyNo

response

FieldTypeRequiredDescriptionConstraints
responseobjectError envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog .
response.errorobjectYes
response.error.codestringYesstable machine-readable error code
response.error.namestringYesshort human-readable error name
response.error.descriptionstringYeswhat went wrong
response.error.resolutionstringYeshow to fix the problem
response.error.requestIdstringYesrequest ID, include it when contacting support
response.error.detailsobjectNooptional additional information specific to the error code
response.error.details.[key: string]anyNo

response

FieldTypeRequiredDescriptionConstraints
responseobjectError envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog .
response.errorobjectYes
response.error.codestringYesstable machine-readable error code
response.error.namestringYesshort human-readable error name
response.error.descriptionstringYeswhat went wrong
response.error.resolutionstringYeshow to fix the problem
response.error.requestIdstringYesrequest ID, include it when contacting support
response.error.detailsobjectNooptional additional information specific to the error code
response.error.details.[key: string]anyNo

response

FieldTypeRequiredDescriptionConstraints
responseobjectError envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog .
response.errorobjectYes
response.error.codestringYesstable machine-readable error code
response.error.namestringYesshort human-readable error name
response.error.descriptionstringYeswhat went wrong
response.error.resolutionstringYeshow to fix the problem
response.error.requestIdstringYesrequest ID, include it when contacting support
response.error.detailsobjectNooptional additional information specific to the error code
response.error.details.[key: string]anyNo

response

FieldTypeRequiredDescriptionConstraints
responseobjectError envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog .
response.errorobjectYes
response.error.codestringYesstable machine-readable error code
response.error.namestringYesshort human-readable error name
response.error.descriptionstringYeswhat went wrong
response.error.resolutionstringYeshow to fix the problem
response.error.requestIdstringYesrequest ID, include it when contacting support
response.error.detailsobjectNooptional additional information specific to the error code
response.error.details.[key: string]anyNo

response

FieldTypeRequiredDescriptionConstraints
responseobjectError envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog .
response.errorobjectYes
response.error.codestringYesstable machine-readable error code
response.error.namestringYesshort human-readable error name
response.error.descriptionstringYeswhat went wrong
response.error.resolutionstringYeshow to fix the problem
response.error.requestIdstringYesrequest ID, include it when contacting support
response.error.detailsobjectNooptional additional information specific to the error code
response.error.details.[key: string]anyNo