Get a user's leave balances
This endpoint returns a single user's leave balances, grouped by leave year and calculated the same way the dashboard calculates them. It requires the balances:read scope and returns the full list in one response — there is no pagination. Use it when you need to display or reconcile a person's remaining leave, not to change it.
Request
The request is a GET to /v2/users/{id}/balances. The id path parameter is the user's resource ID and is required. An optional period query parameter selects which leave years come back: current (the default) returns only the leave year that contains today, or the latest leave year when none does; all returns every leave year. The isCurrent flag in each entry tells you which one contains today. Send the API key in the Authorization header as Bearer <token>. The exact request shape, path and query schema are supplied in the protected contract modules and should be treated as authoritative.
What the response contains
The response wraps an array of balance entries in a data field. Each entry carries the user ID, the leave year's start and end dates in YYYY-MM-DD format, an isCurrent boolean, and a leaveTypes array. Only active leave types appear, in the order the dashboard shows them. For each leave type you get its ID, name, the ID of the leave policy the balance is calculated from, the accrual type, the unit, an unlimited-days flag, and a quotas object.
Reading the quota fields
Each amount in quotas is an object with days, hours and isNegative. Read the value that matches the leave type's unit; the other is a conversion using the user's average working hours per day. The arithmetic the API documents is: remaining = rolloverFromPreviousYear + earned - used - expired, plus toil - toilLapsed when accrualType is not NONE (for NONE, TOIL is already part of earned). Pending requests are not subtracted. For leave types with unlimited days, baseQuota, earned, quotaAtYearEnd and remaining are null. A negative amount is flagged by isNegative rather than by a sign convention you have to infer.
Errors and how to tell them apart
A 400 VALIDATION_ERROR means the period value is invalid. A 404 RESOURCE_NOT_FOUND means the user does not exist or sits outside the key's data reach — the two cases are deliberately indistinguishable. Authentication failures (401) and scope failures (403) are separate and should be handled differently: retrying will not fix a missing scope. Rate limiting returns 429, and server faults return 500. Every error uses the same envelope with code, name, description, resolution and requestId; quote the requestId when contacting support.
Before you ship the call
- Confirm the key has
balances:readand, if hidden leave types must be named,leave-types:read-hidden. 2. Decide whether you need the current leave year only or every year; default iscurrent. 3. Pick the unit from the leave type'sunitfield and read only that amount. 4. Treatnullquota fields as unlimited, not as zero. 5. Distinguish 404 (unknown or out-of-reach user) from 400 (badperiod) in your error handling. 6. Do not paginate — the full list arrives in one response.
| period value | Returns | When to use |
|---|---|---|
| current (default) | The leave year containing today, or the latest leave year if none does | Dashboard-style display of the user's active balance |
| all | Every leave year | History views, reconciliation, exports |
The isCurrent flag identifies which returned entry contains today.
| Status | Code | Likely cause | Fix |
|---|---|---|---|
| 400 | VALIDATION_ERROR | Invalid period value | Use current or all |
| 401 | UNAUTHORIZED | Missing, malformed or unrecognized key | Send a valid Bearer token |
| 403 | INSUFFICIENT_SCOPE | Key lacks balances:read | Add the scope in the dashboard |
| 404 | RESOURCE_NOT_FOUND | User does not exist or is outside the key's reach | Check the ID and the key owner's visibility |
| 429 | RATE_LIMITED | Too many requests in a short time | Wait and retry |
| 500 | INTERNAL_ERROR | Server-side fault | Retry later; quote requestId to support |
The 403 example in the documentation shows a different required scope; the scope for this endpoint is balances:read.
Frequently asked questions
What happens if no leave year contains today?
With period=current, the API returns the latest leave year instead, and isCurrent is false for that entry. Use period=all if you need the full history.
Why are some quota fields null?
Leave types with unlimited days have no fixed quota, so baseQuota, earned, quotaAtYearEnd and remaining are null. The other fields still describe usage.
Why is a leave type named 'Hidden Leave Type'?
The key does not have leave-types:read-hidden, and the user's location policy hides that leave type. The ID and amounts are unchanged; only the name is masked.
Is the balances list paginated?
No. The full list of leave years and leave types arrives in a single response.
curl -X GET "$API_BASE_URL/v2/users/string/balances" \
-H "Authorization: Bearer "{
"data": [
{
"userId": "user-63b17e97-d38b-4586-8498-bb4f5d2e2c14",
"yearStart": "2026-01-01",
"yearEnd": "2026-12-31",
"isCurrent": true,
"leaveTypes": [
{
"leaveTypeId": "leaveType-fcc1e5c5-ba93-479d-bd58-8f860ba10615",
"leaveTypeName": "Vacation",
"leavePolicyId": "leavePolicy-2d7c1b9e-5a4f-4c3b-8e1d-7f6a5b4c3d2e",
"accrualType": "NONE",
"unit": "days",
"hasUnlimitedDays": false,
"quotas": {
"baseQuota": {
"days": 20,
"hours": 160,
"isNegative": false
},
"rolloverFromPreviousYear": {
"days": 3,
"hours": 24,
"isNegative": false
},
"seniorityEntitlement": {
"days": 0,
"hours": 0,
"isNegative": false
},
"entitlementByRole": {
"days": 0,
"hours": 0,
"isNegative": false
},
"toil": {
"days": 1,
"hours": 8,
"isNegative": false
},
"toilLapsed": {
"days": 0,
"hours": 0,
"isNegative": false
},
"earned": {
"days": 21,
"hours": 168,
"isNegative": false
},
"quotaAtYearEnd": {
"days": 20,
"hours": 160,
"isNegative": false
},
"expired": {
"days": 0,
"hours": 0,
"isNegative": false
},
"used": {
"days": 8,
"hours": 64,
"isNegative": false
},
"scheduled": {
"days": 5,
"hours": 40,
"isNegative": false
},
"pending": {
"days": 0,
"hours": 0,
"isNegative": false
},
"remaining": {
"days": 16,
"hours": 128,
"isNegative": false
}
}
}
]
}
]
}{
"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": "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. |
period
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| period | string | No | current returns only the leave year that contains today (or the latest year if none does), all returns every leave year. Default is current . | "current" Allowed values: "current" | "all" |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | |||
| response.data | array<Balance> | No | ||
| response.data[] | object | |||
| response.data[].userId | string | No | the ID of the user | |
| response.data[].yearStart | string | No | first day of the leave year in YYYY-MM-DD format | Format: date |
| response.data[].yearEnd | string | No | last day of the leave year in YYYY-MM-DD format | Format: date |
| response.data[].isCurrent | boolean | No | true if today is within this leave year | |
| response.data[].leaveTypes | array<LeaveTypeBalance> | No | balances of the active leave types, in the order shown in the dashboard | |
| response.data[].leaveTypes[] | object | |||
| response.data[].leaveTypes[].leaveTypeId | string | No | the ID of the leave type | |
| response.data[].leaveTypes[].leaveTypeName | string | No | leave type name | |
| response.data[].leaveTypes[].leavePolicyId | string | No | the ID of the leave policy the balance is calculated from | |
| response.data[].leaveTypes[].accrualType | string | No | the accrual type of the leave policy | |
| response.data[].leaveTypes[].unit | string | No | the unit the leave policy uses. Read the amounts in this unit. | Allowed values: "days" | "hours" |
| response.data[].leaveTypes[].hasUnlimitedDays | boolean | No | true if the leave policy has unlimited days | |
| response.data[].leaveTypes[].quotas | object | No | the amounts that make up the balance. remaining = rolloverFromPreviousYear + earned - used - expired , plus toil - toilLapsed when accrualType is not NONE (for NONE , TOIL is already part of earned ). Pending requests are not subtracted. | |
| response.data[].leaveTypes[].quotas.baseQuota | BalanceAmount | null | No | the yearly quota from the leave policy, or the user's custom quota. null for leave types with unlimited days. | |
| response.data[].leaveTypes[].quotas.baseQuota[variant1] | object | the same amount in days and in hours. Read the one that matches the leave type's unit ; the other is a conversion. | ||
| response.data[].leaveTypes[].quotas.baseQuota[variant1].days | number | No | the amount in days. When the leave type's unit is hours , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.baseQuota[variant1].hours | number | No | the amount in hours. When the leave type's unit is days , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.baseQuota[variant1].isNegative | boolean | No | true if the amount is negative | |
| response.data[].leaveTypes[].quotas.baseQuota[variant2] | null | the yearly quota from the leave policy, or the user's custom quota. null for leave types with unlimited days. | ||
| response.data[].leaveTypes[].quotas.rolloverFromPreviousYear | object | No | the amount brought forward from the previous leave year. Can be negative when the policy allows a negative balance to roll over. | |
| response.data[].leaveTypes[].quotas.rolloverFromPreviousYear.days | number | No | the amount in days. When the leave type's unit is hours , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.rolloverFromPreviousYear.hours | number | No | the amount in hours. When the leave type's unit is days , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.rolloverFromPreviousYear.isNegative | boolean | No | true if the amount is negative | |
| response.data[].leaveTypes[].quotas.seniorityEntitlement | object | No | the amount brought forward from the previous leave year. Can be negative when the policy allows a negative balance to roll over. | |
| response.data[].leaveTypes[].quotas.seniorityEntitlement.days | number | No | the amount in days. When the leave type's unit is hours , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.seniorityEntitlement.hours | number | No | the amount in hours. When the leave type's unit is days , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.seniorityEntitlement.isNegative | boolean | No | true if the amount is negative | |
| response.data[].leaveTypes[].quotas.entitlementByRole | object | No | the amount brought forward from the previous leave year. Can be negative when the policy allows a negative balance to roll over. | |
| response.data[].leaveTypes[].quotas.entitlementByRole.days | number | No | the amount in days. When the leave type's unit is hours , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.entitlementByRole.hours | number | No | the amount in hours. When the leave type's unit is days , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.entitlementByRole.isNegative | boolean | No | true if the amount is negative | |
| response.data[].leaveTypes[].quotas.toil | object | No | the amount brought forward from the previous leave year. Can be negative when the policy allows a negative balance to roll over. | |
| response.data[].leaveTypes[].quotas.toil.days | number | No | the amount in days. When the leave type's unit is hours , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.toil.hours | number | No | the amount in hours. When the leave type's unit is days , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.toil.isNegative | boolean | No | true if the amount is negative | |
| response.data[].leaveTypes[].quotas.toilLapsed | object | No | the amount brought forward from the previous leave year. Can be negative when the policy allows a negative balance to roll over. | |
| response.data[].leaveTypes[].quotas.toilLapsed.days | number | No | the amount in days. When the leave type's unit is hours , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.toilLapsed.hours | number | No | the amount in hours. When the leave type's unit is days , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.toilLapsed.isNegative | boolean | No | true if the amount is negative | |
| response.data[].leaveTypes[].quotas.earned | BalanceAmount | null | No | the yearly quota from the leave policy, or the user's custom quota. null for leave types with unlimited days. | |
| response.data[].leaveTypes[].quotas.earned[variant1] | object | the same amount in days and in hours. Read the one that matches the leave type's unit ; the other is a conversion. | ||
| response.data[].leaveTypes[].quotas.earned[variant1].days | number | No | the amount in days. When the leave type's unit is hours , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.earned[variant1].hours | number | No | the amount in hours. When the leave type's unit is days , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.earned[variant1].isNegative | boolean | No | true if the amount is negative | |
| response.data[].leaveTypes[].quotas.earned[variant2] | null | the yearly quota from the leave policy, or the user's custom quota. null for leave types with unlimited days. | ||
| response.data[].leaveTypes[].quotas.quotaAtYearEnd | BalanceAmount | null | No | the yearly quota from the leave policy, or the user's custom quota. null for leave types with unlimited days. | |
| response.data[].leaveTypes[].quotas.quotaAtYearEnd[variant1] | object | the same amount in days and in hours. Read the one that matches the leave type's unit ; the other is a conversion. | ||
| response.data[].leaveTypes[].quotas.quotaAtYearEnd[variant1].days | number | No | the amount in days. When the leave type's unit is hours , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.quotaAtYearEnd[variant1].hours | number | No | the amount in hours. When the leave type's unit is days , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.quotaAtYearEnd[variant1].isNegative | boolean | No | true if the amount is negative | |
| response.data[].leaveTypes[].quotas.quotaAtYearEnd[variant2] | null | the yearly quota from the leave policy, or the user's custom quota. null for leave types with unlimited days. | ||
| response.data[].leaveTypes[].quotas.expired | object | No | the amount brought forward from the previous leave year. Can be negative when the policy allows a negative balance to roll over. | |
| response.data[].leaveTypes[].quotas.expired.days | number | No | the amount in days. When the leave type's unit is hours , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.expired.hours | number | No | the amount in hours. When the leave type's unit is days , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.expired.isNegative | boolean | No | true if the amount is negative | |
| response.data[].leaveTypes[].quotas.used | object | No | the amount brought forward from the previous leave year. Can be negative when the policy allows a negative balance to roll over. | |
| response.data[].leaveTypes[].quotas.used.days | number | No | the amount in days. When the leave type's unit is hours , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.used.hours | number | No | the amount in hours. When the leave type's unit is days , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.used.isNegative | boolean | No | true if the amount is negative | |
| response.data[].leaveTypes[].quotas.scheduled | object | No | the amount brought forward from the previous leave year. Can be negative when the policy allows a negative balance to roll over. | |
| response.data[].leaveTypes[].quotas.scheduled.days | number | No | the amount in days. When the leave type's unit is hours , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.scheduled.hours | number | No | the amount in hours. When the leave type's unit is days , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.scheduled.isNegative | boolean | No | true if the amount is negative | |
| response.data[].leaveTypes[].quotas.pending | object | No | the amount brought forward from the previous leave year. Can be negative when the policy allows a negative balance to roll over. | |
| response.data[].leaveTypes[].quotas.pending.days | number | No | the amount in days. When the leave type's unit is hours , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.pending.hours | number | No | the amount in hours. When the leave type's unit is days , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.pending.isNegative | boolean | No | true if the amount is negative | |
| response.data[].leaveTypes[].quotas.remaining | BalanceAmount | null | No | the yearly quota from the leave policy, or the user's custom quota. null for leave types with unlimited days. | |
| response.data[].leaveTypes[].quotas.remaining[variant1] | object | the same amount in days and in hours. Read the one that matches the leave type's unit ; the other is a conversion. | ||
| response.data[].leaveTypes[].quotas.remaining[variant1].days | number | No | the amount in days. When the leave type's unit is hours , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.remaining[variant1].hours | number | No | the amount in hours. When the leave type's unit is days , this is converted with the user's average working hours per day. | |
| response.data[].leaveTypes[].quotas.remaining[variant1].isNegative | boolean | No | true if the amount is negative | |
| response.data[].leaveTypes[].quotas.remaining[variant2] | null | the yearly quota from the leave policy, or the user's custom quota. null for leave types with unlimited days. |
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 |
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 |