List a Location's Leave Policies
This endpoint returns the active leave policies configured for one location. Each enabled leave type contributes one policy object, and the whole set arrives in a single response with no pagination. Disabled policies are not included, so the array reflects only what is currently in force for that location.
Request shape and access
The call is a GET to the location leave-policies route, with the location's resource ID in the path. Access is controlled by the leave-policies:read scope on the API key. The key is sent as a bearer token in the Authorization header. If the location does not exist, or lies outside what the key owner can reach, the endpoint answers with a 404 RESOURCE_NOT_FOUND error. The exact request line, header and path parameter contract are provided in the accompanying protected modules; treat those as the source of truth for implementation.
Reading the response
The response is a list of policy objects. Each object ties a leave type to a location and carries the rules that apply there. Group the fields mentally into four blocks: quota and rollover, request behaviour, accrual, and TOIL. The quota block uses quotaUnit to say whether the quota is measured in days or hours, with daysPerYear and maxRolloverDays as the primary numbers and hoursPerYear and maxRolloverHours as optional hour-based counterparts. hasUnlimitedDays overrides the numeric quota when true. The request-behaviour block covers approval, reason, visibility, past-dated requests, negative balances and the smallest requestable interval. The accrual block describes how leave is earned over time. The TOIL block describes time off in lieu. Optional fields are omitted rather than sent as null, so a missing field means the setting was not configured.
Field groups at a glance
Use this checklist when mapping the response into your own model:
- Identity: locationId and leaveTypeId pair the policy to its location and leave type.
- Active flag: isActive is always true here, because only active policies are returned.
- Quota: quotaUnit, daysPerYear, hoursPerYear, maxRolloverDays, maxRolloverHours, hasUnlimitedDays.
- Request rules: isApprovalRequired, isReasonRequired, hideLeaveType, allowLeaveInPast, negativeBalanceAllowed, shortestLeaveInterval, negativeBroughtForwardAllowed.
- Accrual: accrual.type plus optional capRate, firstEarningDate, periodStart, allowAdvanceUsage, pauseWhenUserDeactivated.
- Rollover expiry: broughtForwardExpiration.enabled plus optional month, day or afterDays.
- TOIL: toil.enabled plus optional shortestInterval, requestsAllowedForUsers, expiration, expirationDate, expirationMonths.
The exact field names, types and enum values are defined in the protected schema modules and should be copied from there, not retyped.
Worked example: two policies, two shapes
The sample response shows two policies for the same location. The first has a 20-day yearly quota, a 5-day rollover cap, unlimited days off, approval required, and TOIL enabled at a one-hour minimum. The second has hasUnlimitedDays set to true with a zero numeric quota, no approval requirement, a reason required, past-dated leave allowed, a half-day minimum interval, and TOIL disabled. Reading them side by side shows why you should branch on hasUnlimitedDays before using daysPerYear, and why a zero in daysPerYear does not by itself mean no leave is available. The full sample body is in the protected response module.
Telling the error cases apart
A 401 means the key is missing, malformed or unrecognised. A 403 means the key is valid but lacks the required scope or the acting user is not permitted. A 404 means the location ID is wrong or outside the key owner's data reach. A 429 means too many requests arrived in a short window and the call should be retried after a brief wait. A 500 means something failed on the server side; retry later and quote the requestId if it persists. Each error body carries a code, name, description, resolution and requestId, and the exact envelopes are in the protected error modules.
Frequently asked questions
Why is isActive always true in the response?
Because the endpoint only returns active policies. Disabled policies are filtered out before the response is built, so every object you receive is active by definition.
Does the response paginate?
No. All active policies for the location arrive in one response. If you need a single leave type's policy, use the per-leave-type endpoint instead.
What does a missing optional field mean?
Optional fields such as hoursPerYear, capRate or expirationDate are omitted when not set. A missing field means the setting was not configured, not that it is zero or false.
What happens if the location ID is wrong?
The endpoint returns a 404 RESOURCE_NOT_FOUND error. The same error is returned when the location exists but lies outside the key owner's data reach, so check both the ID and the key's visibility.
How do I get the policy for just one leave type?
Use the per-leave-type endpoint for the location and leave type. This list endpoint returns every active policy for the location in one call.
curl -X GET "$API_BASE_URL/v2/locations/string/leave-policies" \
-H "Authorization: Bearer "{
"data": [
{
"locationId": "location-79c77ac8-e5bf-479f-9488-648a58379ff1",
"leaveTypeId": "leaveType-fcc1e5c5-ba93-479d-bd58-8f860ba10615",
"isActive": true,
"quotaUnit": "days",
"daysPerYear": 20,
"maxRolloverDays": 5,
"hasUnlimitedDays": false,
"isApprovalRequired": true,
"isReasonRequired": false,
"hideLeaveType": false,
"allowLeaveInPast": false,
"negativeBalanceAllowed": false,
"shortestLeaveInterval": "FULL-DAY",
"negativeBroughtForwardAllowed": false,
"accrual": {
"type": "NONE"
},
"broughtForwardExpiration": {
"enabled": false
},
"toil": {
"enabled": true,
"shortestInterval": "ONE-HOUR",
"requestsAllowedForUsers": true,
"expiration": false
}
},
{
"locationId": "location-79c77ac8-e5bf-479f-9488-648a58379ff1",
"leaveTypeId": "leaveType-88681ca1-4a47-4e4d-bc35-ffff86c0f54e",
"isActive": true,
"quotaUnit": "days",
"daysPerYear": 0,
"maxRolloverDays": 0,
"hasUnlimitedDays": true,
"isApprovalRequired": false,
"isReasonRequired": true,
"hideLeaveType": false,
"allowLeaveInPast": true,
"negativeBalanceAllowed": false,
"shortestLeaveInterval": "HALF-DAY",
"negativeBroughtForwardAllowed": false,
"accrual": {
"type": "NONE"
},
"broughtForwardExpiration": {
"enabled": false
},
"toil": {
"enabled": false
}
}
]
}{
"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": "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. |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | |||
| response.data | array<LeavePolicy> | Yes | ||
| response.data[] | object | |||
| response.data[].locationId | string | Yes | the ID of the location this policy applies to | |
| response.data[].leaveTypeId | string | Yes | the ID of the leave type this policy belongs to | |
| response.data[].isActive | boolean | Yes | always true, because only active policies are returned | |
| response.data[].quotaUnit | string | Yes | the unit the quota is set in | Allowed values: "days" | "hours" |
| response.data[].daysPerYear | number | Yes | the yearly quota in days | |
| response.data[].hoursPerYear | number | No | the yearly quota in hours | |
| response.data[].maxRolloverDays | number | Yes | the maximum number of unused days that roll over into the next leave year | |
| response.data[].maxRolloverHours | number | No | the maximum number of unused hours that roll over into the next leave year | |
| response.data[].hasUnlimitedDays | boolean | Yes | whether the leave type grants unlimited leave in this location | |
| response.data[].isApprovalRequired | boolean | Yes | whether leaves of this type need approval in this location | |
| response.data[].isReasonRequired | boolean | Yes | whether a reason is required | |
| response.data[].hideLeaveType | boolean | Yes | whether the leave type is hidden from users in this location when they request leave | |
| response.data[].allowLeaveInPast | boolean | Yes | whether users can request leave for past dates | |
| response.data[].negativeBalanceAllowed | boolean | Yes | whether a user's balance can go negative | |
| response.data[].shortestLeaveInterval | string | Yes | the smallest unit of leave a user can request | Allowed values: "FULL-DAY" | "HALF-DAY" | "ONE-HOUR" | "HALF-HOUR" | "FIFTEEN-MINUTES" |
| response.data[].negativeBroughtForwardAllowed | boolean | Yes | whether a negative balance is brought forward into the next leave year | |
| response.data[].accrual | object | Yes | accrual settings. Fields that are not set are left out. | |
| response.data[].accrual.type | string | Yes | the accrual type, for example NONE , WEEKLY or MONTHLY . NONE means the full quota is available at the start of the leave year. | |
| response.data[].accrual.capRate | number | No | the accrual cap rate, from 0.1 to 10 | |
| response.data[].accrual.firstEarningDate | string | No | the date accrual starts | date |
| response.data[].accrual.periodStart | string | No | the start of the first accrual period | date |
| response.data[].accrual.allowAdvanceUsage | boolean | Yes | whether users can use leave before it is accrued | |
| response.data[].accrual.pauseWhenUserDeactivated | boolean | Yes | whether accrual pauses while the user is deactivated | |
| response.data[].broughtForwardExpiration | object | Yes | when rolled-over leave expires. A policy with no expiry of its own follows its location's; enabled true with neither a date nor afterDays means rolled-over leave expires at the end of the leave year. | |
| response.data[].broughtForwardExpiration.enabled | boolean | Yes | whether rolled-over (brought forward) leave expires | |
| response.data[].broughtForwardExpiration.month | integer | No | month rolled-over leave expires in, for a fixed expiry date; present only when enabled | |
| response.data[].broughtForwardExpiration.day | integer | No | day of the month rolled-over leave expires on, for a fixed expiry date; present only when enabled | |
| response.data[].broughtForwardExpiration.afterDays | integer | No | number of days after the leave year starts that rolled-over leave expires, instead of a fixed date; present only when enabled | |
| response.data[].toil | object | Yes | TOIL settings. Fields that are not set are left out. | |
| response.data[].toil.enabled | boolean | Yes | whether users can request TOIL (time off in lieu) for this leave type in this location | |
| response.data[].toil.shortestInterval | string | No | the smallest unit of leave a user can request | Allowed values: "FULL-DAY" | "HALF-DAY" | "ONE-HOUR" | "HALF-HOUR" | "FIFTEEN-MINUTES" |
| response.data[].toil.requestsAllowedForUsers | boolean | No | whether users can request TOIL themselves, not only approvers | |
| response.data[].toil.expiration | boolean | No | whether earned TOIL expires | |
| response.data[].toil.expirationDate | string | No | the date earned TOIL expires | date |
| response.data[].toil.expirationMonths | integer | No | the number of months after which earned TOIL expires |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | Error envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog . | ||
| response.error | object | Yes | ||
| response.error.code | string | Yes | stable machine-readable error code | |
| response.error.name | string | Yes | short human-readable error name | |
| response.error.description | string | Yes | what went wrong | |
| response.error.resolution | string | Yes | how to fix the problem | |
| response.error.requestId | string | Yes | request ID, include it when contacting support | |
| response.error.details | object | No | optional additional information specific to the error code | |
| response.error.details.[key: string] | any | No |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | Error envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog . | ||
| response.error | object | Yes | ||
| response.error.code | string | Yes | stable machine-readable error code | |
| response.error.name | string | Yes | short human-readable error name | |
| response.error.description | string | Yes | what went wrong | |
| response.error.resolution | string | Yes | how to fix the problem | |
| response.error.requestId | string | Yes | request ID, include it when contacting support | |
| response.error.details | object | No | optional additional information specific to the error code | |
| response.error.details.[key: string] | any | No |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | Error envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog . | ||
| response.error | object | Yes | ||
| response.error.code | string | Yes | stable machine-readable error code | |
| response.error.name | string | Yes | short human-readable error name | |
| response.error.description | string | Yes | what went wrong | |
| response.error.resolution | string | Yes | how to fix the problem | |
| response.error.requestId | string | Yes | request ID, include it when contacting support | |
| response.error.details | object | No | optional additional information specific to the error code | |
| response.error.details.[key: string] | any | No |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | Error envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog . | ||
| response.error | object | Yes | ||
| response.error.code | string | Yes | stable machine-readable error code | |
| response.error.name | string | Yes | short human-readable error name | |
| response.error.description | string | Yes | what went wrong | |
| response.error.resolution | string | Yes | how to fix the problem | |
| response.error.requestId | string | Yes | request ID, include it when contacting support | |
| response.error.details | object | No | optional additional information specific to the error code | |
| response.error.details.[key: string] | any | No |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | Error envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog . | ||
| response.error | object | Yes | ||
| response.error.code | string | Yes | stable machine-readable error code | |
| response.error.name | string | Yes | short human-readable error name | |
| response.error.description | string | Yes | what went wrong | |
| response.error.resolution | string | Yes | how to fix the problem | |
| response.error.requestId | string | Yes | request ID, include it when contacting support | |
| response.error.details | object | No | optional additional information specific to the error code | |
| response.error.details.[key: string] | any | No |