Skip to content

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.

Authorization and scope

The endpoint requires the balances:read scope. A key without it is rejected with INSUFFICIENT_SCOPE, and the error body lists the scopes the request needs. The key owner's role also limits which users the key can reach; a user outside that reach is reported as not found rather than forbidden. See the authentication and scopes sections of the API documentation for how keys are created and how roles constrain them.

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.

Hidden leave types

If the key does not have leave-types:read-hidden, any leave type hidden by the policy of the user's location comes back with the name Hidden Leave Type. The leaveTypeId and every amount stay unchanged, so totals still reconcile; only the label is masked. Do not treat the masked name as a distinct leave type when you join or group results.

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

  1. Confirm the key has balances:read and, 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 is current. 3. Pick the unit from the leave type's unit field and read only that amount. 4. Treat null quota fields as unlimited, not as zero. 5. Distinguish 404 (unknown or out-of-reach user) from 400 (bad period) in your error handling. 6. Do not paginate — the full list arrives in one response.
Choosing the period parameter
period valueReturnsWhen to use
current (default)The leave year containing today, or the latest leave year if none doesDashboard-style display of the user's active balance
allEvery leave yearHistory views, reconciliation, exports

The isCurrent flag identifies which returned entry contains today.

Telling common failures apart
StatusCodeLikely causeFix
400VALIDATION_ERRORInvalid period valueUse current or all
401UNAUTHORIZEDMissing, malformed or unrecognized keySend a valid Bearer token
403INSUFFICIENT_SCOPEKey lacks balances:readAdd the scope in the dashboard
404RESOURCE_NOT_FOUNDUser does not exist or is outside the key's reachCheck the ID and the key owner's visibility
429RATE_LIMITEDToo many requests in a short timeWait and retry
500INTERNAL_ERRORServer-side faultRetry 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

FieldTypeRequiredDescriptionConstraints
idstringYesresource ID.

period

FieldTypeRequiredDescriptionConstraints
periodstringNocurrent 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

FieldTypeRequiredDescriptionConstraints
responseobject
response.dataarray<Balance>No
response.data[]object
response.data[].userIdstringNothe ID of the user
response.data[].yearStartstringNofirst day of the leave year in YYYY-MM-DD formatFormat: date
response.data[].yearEndstringNolast day of the leave year in YYYY-MM-DD formatFormat: date
response.data[].isCurrentbooleanNotrue if today is within this leave year
response.data[].leaveTypesarray<LeaveTypeBalance>Nobalances of the active leave types, in the order shown in the dashboard
response.data[].leaveTypes[]object
response.data[].leaveTypes[].leaveTypeIdstringNothe ID of the leave type
response.data[].leaveTypes[].leaveTypeNamestringNoleave type name
response.data[].leaveTypes[].leavePolicyIdstringNothe ID of the leave policy the balance is calculated from
response.data[].leaveTypes[].accrualTypestringNothe accrual type of the leave policy
response.data[].leaveTypes[].unitstringNothe unit the leave policy uses. Read the amounts in this unit.Allowed values: "days" | "hours"
response.data[].leaveTypes[].hasUnlimitedDaysbooleanNotrue if the leave policy has unlimited days
response.data[].leaveTypes[].quotasobjectNothe 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.baseQuotaBalanceAmount | nullNothe 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]objectthe 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].daysnumberNothe 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].hoursnumberNothe 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].isNegativebooleanNotrue if the amount is negative
response.data[].leaveTypes[].quotas.baseQuota[variant2]nullthe yearly quota from the leave policy, or the user's custom quota. null for leave types with unlimited days.
response.data[].leaveTypes[].quotas.rolloverFromPreviousYearobjectNothe 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.daysnumberNothe 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.hoursnumberNothe 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.isNegativebooleanNotrue if the amount is negative
response.data[].leaveTypes[].quotas.seniorityEntitlementobjectNothe 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.daysnumberNothe 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.hoursnumberNothe 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.isNegativebooleanNotrue if the amount is negative
response.data[].leaveTypes[].quotas.entitlementByRoleobjectNothe 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.daysnumberNothe 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.hoursnumberNothe 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.isNegativebooleanNotrue if the amount is negative
response.data[].leaveTypes[].quotas.toilobjectNothe 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.daysnumberNothe 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.hoursnumberNothe 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.isNegativebooleanNotrue if the amount is negative
response.data[].leaveTypes[].quotas.toilLapsedobjectNothe 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.daysnumberNothe 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.hoursnumberNothe 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.isNegativebooleanNotrue if the amount is negative
response.data[].leaveTypes[].quotas.earnedBalanceAmount | nullNothe 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]objectthe 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].daysnumberNothe 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].hoursnumberNothe 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].isNegativebooleanNotrue if the amount is negative
response.data[].leaveTypes[].quotas.earned[variant2]nullthe yearly quota from the leave policy, or the user's custom quota. null for leave types with unlimited days.
response.data[].leaveTypes[].quotas.quotaAtYearEndBalanceAmount | nullNothe 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]objectthe 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].daysnumberNothe 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].hoursnumberNothe 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].isNegativebooleanNotrue if the amount is negative
response.data[].leaveTypes[].quotas.quotaAtYearEnd[variant2]nullthe yearly quota from the leave policy, or the user's custom quota. null for leave types with unlimited days.
response.data[].leaveTypes[].quotas.expiredobjectNothe 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.daysnumberNothe 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.hoursnumberNothe 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.isNegativebooleanNotrue if the amount is negative
response.data[].leaveTypes[].quotas.usedobjectNothe 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.daysnumberNothe 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.hoursnumberNothe 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.isNegativebooleanNotrue if the amount is negative
response.data[].leaveTypes[].quotas.scheduledobjectNothe 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.daysnumberNothe 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.hoursnumberNothe 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.isNegativebooleanNotrue if the amount is negative
response.data[].leaveTypes[].quotas.pendingobjectNothe 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.daysnumberNothe 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.hoursnumberNothe 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.isNegativebooleanNotrue if the amount is negative
response.data[].leaveTypes[].quotas.remainingBalanceAmount | nullNothe 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]objectthe 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].daysnumberNothe 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].hoursnumberNothe 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].isNegativebooleanNotrue if the amount is negative
response.data[].leaveTypes[].quotas.remaining[variant2]nullthe yearly quota from the leave policy, or the user's custom quota. null for leave types with unlimited days.

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