Skip to content

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

FieldTypeRequiredDescriptionConstraints
idstringYesresource ID.

leaveTypeId

FieldTypeRequiredDescriptionConstraints
leaveTypeIdstringYesleave type ID.

response

FieldTypeRequiredDescriptionConstraints
responseobject
response.dataobjectYes
response.data.locationIdstringYesthe ID of the location this policy applies to
response.data.leaveTypeIdstringYesthe ID of the leave type this policy belongs to
response.data.isActivebooleanYesalways true, because only active policies are returned
response.data.quotaUnitstringYesthe unit the quota is set inAllowed values: "days" | "hours"
response.data.daysPerYearnumberYesthe yearly quota in days
response.data.hoursPerYearnumberNothe yearly quota in hours
response.data.maxRolloverDaysnumberYesthe maximum number of unused days that roll over into the next leave year
response.data.maxRolloverHoursnumberNothe maximum number of unused hours that roll over into the next leave year
response.data.hasUnlimitedDaysbooleanYeswhether the leave type grants unlimited leave in this location
response.data.isApprovalRequiredbooleanYeswhether leaves of this type need approval in this location
response.data.isReasonRequiredbooleanYeswhether a reason is required
response.data.hideLeaveTypebooleanYeswhether the leave type is hidden from users in this location when they request leave
response.data.allowLeaveInPastbooleanYeswhether users can request leave for past dates
response.data.negativeBalanceAllowedbooleanYeswhether a user's balance can go negative
response.data.shortestLeaveIntervalstringYesthe smallest unit of leave a user can requestAllowed values: "FULL-DAY" | "HALF-DAY" | "ONE-HOUR" | "HALF-HOUR" | "FIFTEEN-MINUTES"
response.data.negativeBroughtForwardAllowedbooleanYeswhether a negative balance is brought forward into the next leave year
response.data.accrualobjectYesaccrual settings. Fields that are not set are left out.
response.data.accrual.typestringYesthe 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.capRatenumberNothe accrual cap rate, from 0.1 to 10
response.data.accrual.firstEarningDatestringNothe date accrual startsFormat: date
response.data.accrual.periodStartstringNothe start of the first accrual perioddate
response.data.accrual.allowAdvanceUsagebooleanYeswhether users can use leave before it is accrued
response.data.accrual.pauseWhenUserDeactivatedbooleanYeswhether accrual pauses while the user is deactivated
response.data.broughtForwardExpirationobjectYeswhen 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.enabledbooleanYeswhether rolled-over (brought forward) leave expires
response.data.broughtForwardExpiration.monthintegerNomonth rolled-over leave expires in, for a fixed expiry date; present only when enabled
response.data.broughtForwardExpiration.dayintegerNoday of the month rolled-over leave expires on, for a fixed expiry date; present only when enabled
response.data.broughtForwardExpiration.afterDaysintegerNonumber of days after the leave year starts that rolled-over leave expires, instead of a fixed date; present only when enabled
response.data.toilobjectYesTOIL settings. Fields that are not set are left out.
response.data.toil.enabledbooleanYeswhether users can request TOIL (time off in lieu) for this leave type in this location
response.data.toil.shortestIntervalstringNothe smallest unit of leave a user can requestAllowed values: "FULL-DAY" | "HALF-DAY" | "ONE-HOUR" | "HALF-HOUR" | "FIFTEEN-MINUTES"
response.data.toil.requestsAllowedForUsersbooleanNowhether users can request TOIL themselves, not only approvers
response.data.toil.expirationbooleanNowhether earned TOIL expires
response.data.toil.expirationDatestringNothe date earned TOIL expiresdate
response.data.toil.expirationMonthsintegerNothe number of months after which earned TOIL expires

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