Get a location's leave policy for a leave type
This endpoint returns the active leave policy that a single leave type has inside a single location. Use it when you already know both IDs and need the policy's quota, rollover, approval and accrual settings rather than a full list. The request requires the leave-policies:read scope.
Request contract
The method is GET on /v2/locations/{id}/leave-policies/{leaveTypeId}. Both path parameters are required strings: id identifies the location, and leaveTypeId identifies the leave type. Send the API key in the Authorization header as a Bearer token. The operation is scoped to leave-policies:read.
The exact request shape, authentication header and generated client examples are provided in the accompanying contract modules code0001 and hidden-sdk-0-_default. The parameter definitions are in schema0001 and schema0002.
Reading the response
A successful response wraps a single policy object in a data field. The policy carries the location and leave type IDs, an isActive flag that is always true because only active policies are returned, and the quota unit. The quota is expressed in days and, where relevant, in hours.
The policy also reports rollover limits, whether leave is unlimited, whether approval or a reason is required, whether the leave type is hidden from users, whether past-dated leave is allowed, whether a negative balance is permitted, and the smallest requestable interval. Accrual, brought-forward expiration and TOIL each appear as nested objects; fields that are not set are omitted.
The complete field list, types, requiredness and enum values are in schema0005. A sample success body is in code0002.
Field-group map
The response is easier to consume if you group fields by the decision they support:
- Quota: quotaUnit, daysPerYear, hoursPerYear, hasUnlimitedDays. Use quotaUnit to know which yearly figure is authoritative.
- Rollover: maxRolloverDays, maxRolloverHours, negativeBroughtForwardAllowed, broughtForwardExpiration. The expiration object may be empty of date fields when the policy follows its location's expiry or expires at the end of the leave year.
- Request rules: isApprovalRequired, isReasonRequired, allowLeaveInPast, negativeBalanceAllowed, shortestLeaveInterval, hideLeaveType.
- Accrual: accrual.type, capRate, firstEarningDate, periodStart, allowAdvanceUsage, pauseWhenUserDeactivated. A type of NONE means the full quota is available at the start of the leave year.
- TOIL: toil.enabled and, when set, shortestInterval, requestsAllowedForUsers, expiration, expirationDate and expirationMonths.
These groupings are a reading aid; the authoritative field definitions and requiredness remain in schema0005.
Worked example
The sample response in code0002 shows a policy for location-79c77ac8-e5bf-479f-9488-648a58379ff1 and leaveType-fcc1e5c5-ba93-479d-bd58-8f860ba10615. Its quotaUnit is days, with daysPerYear 20 and hoursPerYear 160. Rollover is capped at 5 days or 40 hours. Approval is required, a reason is not, past-dated leave is not allowed, and a negative balance is not permitted. The smallest requestable interval is HALF-DAY.
Accrual is MONTHLY with a capRate of 2, a firstEarningDate and periodStart of 2026-01-01, advance usage disallowed and accrual paused while the user is deactivated. Brought-forward expiration is enabled for month 3, day 31. TOIL is disabled.
Treat the sample as an illustration of shape, not as default values for your own location.
Errors and troubleshooting
A 404 RESOURCE_NOT_FOUND can mean the location does not exist, the location is outside the key's data reach, or the leave type has no active policy in that location. The details.resource field distinguishes the case: it is location or leavePolicy. Check the ID named there first, then confirm that the key owner can see the location and that the leave type is enabled with an active policy.
Other statuses follow the shared error envelope: 401 for a missing, malformed or unrecognized key; 403 for a key that lacks a required scope or whose acting user may not perform the action; 429 for rate limiting; and 500 for an internal error. The error envelope structure is in schema0006 through schema0010, and the public error examples are in code0003, code0005 and code0006.
Frequently asked questions
Which scope does this endpoint require?
It requires leave-policies:read. The key is sent as a Bearer token in the Authorization header.
Why does the request return 404 RESOURCE_NOT_FOUND?
The location may not exist or may be outside the key's data reach, or the leave type may have no active policy in that location. Check details.resource to see whether location or leavePolicy is named.
Why are some fields absent from the response?
Fields inside the accrual, broughtForwardExpiration and TOIL objects that are not set are omitted. For example, a brought-forward expiration with enabled true but no date or afterDays means rolled-over leave expires at the end of the leave year.
How is this different from listing a location's leave policies?
The list operation returns every active policy for a location, one per enabled leave type, without pagination. This operation returns only the policy for the specified leave type.
curl -X GET "$API_BASE_URL/v2/locations/string/leave-policies/string" \
-H "Authorization: Bearer "{
"data": {
"locationId": "location-79c77ac8-e5bf-479f-9488-648a58379ff1",
"leaveTypeId": "leaveType-fcc1e5c5-ba93-479d-bd58-8f860ba10615",
"isActive": true,
"quotaUnit": "days",
"daysPerYear": 20,
"hoursPerYear": 160,
"maxRolloverDays": 5,
"maxRolloverHours": 40,
"hasUnlimitedDays": false,
"isApprovalRequired": true,
"isReasonRequired": false,
"hideLeaveType": false,
"allowLeaveInPast": false,
"negativeBalanceAllowed": false,
"shortestLeaveInterval": "HALF-DAY",
"negativeBroughtForwardAllowed": false,
"accrual": {
"type": "MONTHLY",
"capRate": 2,
"firstEarningDate": "2026-01-01",
"periodStart": "2026-01-01",
"allowAdvanceUsage": false,
"pauseWhenUserDeactivated": true
},
"broughtForwardExpiration": {
"enabled": true,
"month": 3,
"day": 31
},
"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. |
leaveTypeId
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| leaveTypeId | string | Yes | leave type ID. |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | |||
| response.data | object | Yes | ||
| 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 | Format: 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 |