Get a leave by ID
Use this endpoint when you already have a leave identifier and need its current details, optionally with related people or leave-type information embedded in the same response.
Request basics
Send an authenticated GET request for the leave identifier in the path. The base permission is leaves:read, supplied as a bearer API key in the Authorization header. The key owner's role can further limit what data the key can reach, so a valid scope alone does not guarantee visibility of every record.
Pre-flight checklist
Before calling, confirm the leave ID, the base leaves:read scope, and any additional scopes needed for the fields or expansions you plan to use. Decide whether you need embedded related data or identifiers alone. If reason text matters, include leaves:read-reason from the start rather than treating null reasons as missing data. Finally, check that the key can reach the leave's owner; otherwise the endpoint can return not-found even when the ID itself is well formed.
Choosing expansions
The optional expand query parameter accepts a comma-separated list. user embeds the person taking leave and approver embeds the person who approved or denied it; both require users:read. leaveType embeds the leave type and requires leave-types:read. Each requested expansion must be covered by its own resource scope.
Nested data and reach
Expansion changes how much related detail is returned, not the core leave record. An embedded user can also carry location and department objects that were not named directly in expand. If the key lacks locations:read or departments:read, the request still succeeds but the corresponding nested object is omitted. Likewise, an embedded user or approver outside the key's data reach is omitted, leaving only the identifier.
Hidden leave types
A hidden leave type needs special handling. When expand=leaveType is used and the key lacks leave-types:read-hidden, a policy that hides the type yields Hidden Leave Type as leaveType.name. The leaveTypeId field remains available, so clients should not depend on the display name being the real type name in that case.
Reason fields
The reason supplied by the employee and the reason recorded when a leave was denied or cancelled are gated separately from the main record. Both require leaves:read-reason in addition to leaves:read. Without that extra scope, both fields are null and other fields are unaffected. Treat null here as a permission outcome, not proof that no reason was recorded.
Reading a successful response
A successful response returns the leave under data, including its identifier, owner and approver identifiers, dates, durations, full-day flag, leave-type, location and department identifiers, status, creation timestamp and approval level. Part-day timing fields appear only for part-day leaves. The captured example shows an approved five-day full-day leave, which illustrates the core shape without expansion.
Errors worth distinguishing
An unknown expand value produces 400 VALIDATION_ERROR. Missing scope for an expansion produces 403 INSUFFICIENT_SCOPE, with details.expand naming the values that required it. A leave that does not exist, or belongs to someone outside the key's data reach, produces 404 RESOURCE_NOT_FOUND. Authentication failures, rate limiting and server errors use the shared error envelope, whose requestId should be retained when seeking help.
Practical decision guide
For a detail view, request only the expansions the interface actually displays. That reduces scope requirements and avoids confusing omitted nested objects with absent records. When a person object is missing but the identifier is present, check data reach before assuming the user was deleted. When a leave-type name looks generic, check hidden-type permission before using it for labels or reporting.
Frequently asked questions
Does expand fail if an embedded person is outside the key's reach?
No. The request succeeds, but the embedded object is omitted and only the identifier remains. This applies when the person or approver is outside the key's data reach. For leaveType, a hidden policy can instead produce the name Hidden Leave Type when the key lacks the hidden leave-type scope, while leaveTypeId is still present.
What happens to reason fields without the extra reason scope?
Yes. Both reason and statusReason return null, while the remaining leave fields stay the same. Add leaves:read-reason alongside leaves:read when those explanations are needed.
Why does an expand request return 403?
The request fails with 403 INSUFFICIENT_SCOPE. The error details identify which expand values requested the missing scope, so add the corresponding read scope before retrying.
curl -X GET "$API_BASE_URL/v2/leaves/string?expand=user%2CleaveType" \
-H "Authorization: Bearer "{
"data": {
"id": "leaveRequest-cfe5d39b-f1f0-45aa-85cd-ce93e637a262",
"userId": "user-63b17e97-d38b-4586-8498-bb4f5d2e2c14",
"approverId": "user-0f3a9c1e-6c2b-4a5d-9e7f-1b2c3d4e5f60",
"autoApproved": false,
"durationCalendarDays": 5,
"durationWorkingDays": 5,
"startDate": "2026-11-09",
"endDate": "2026-11-13",
"isFullDayLeave": true,
"leaveTypeId": "leaveType-fcc1e5c5-ba93-479d-bd58-8f860ba10615",
"locationId": "location-79c77ac8-e5bf-479f-9488-648a58379ff1",
"departmentId": "team-0a21c25e-6925-4a5b-90ee-ecf82096c4f6",
"status": "APPROVED",
"reason": "Family trip",
"statusReason": null,
"approvedLevel": null,
"createdAt": "2026-10-01T09:12:40.062Z"
}
}{
"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. |
expand
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| expand | array<string> | No | a comma-separated list of related resources to include in each leave. Options: user (the person on leave, requires users:read ), approver (who approved or denied it, requires users:read ) and leaveType (the leave type, requires leave-types:read ). Each value needs the read scope of the resource it embeds. | Allowed values: "user" | "approver" | "leaveType" |
| expand[] | string | Allowed values: "user" | "approver" | "leaveType" |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | |||
| response.data | object | No | ||
| response.data.id | string | Yes | leave ID | |
| response.data.userId | string | Yes | an ID of the user on leave | |
| response.data.approverId | string | No | an ID of the approver, only when the leave request is approved; absent otherwise | |
| response.data.autoApproved | boolean | No | is the leave request automatically approved or not | |
| response.data.durationCalendarDays | number | Yes | the duration of a leave in calendar days | |
| response.data.durationWorkingDays | number | Yes | the duration of a leave in working/business days | |
| response.data.startDate | string | Yes | date in YYYY-MM-DD format | Format: date |
| response.data.endDate | string | Yes | date in YYYY-MM-DD format | Format: date |
| response.data.isFullDayLeave | boolean | Yes | true if the leave is a full day leave (1 or multiple days), or false if it is a part day leave (half day or hourly) | |
| response.data.startHour | number | No | start hour in the user's time zone (in 24h format) for the part day leave, returned only when isFullDayLeave is false | |
| response.data.endHour | number | No | end hour in the user's time zone (in 24h format) for the part day leave, returned only when isFullDayLeave is false | |
| response.data.startMinute | number | No | start minutes in the user's time zone for the part day leave, returned only when isFullDayLeave is false | |
| response.data.endMinute | number | No | end minutes in the user's time zone for the part day leave, returned only when isFullDayLeave is false | |
| response.data.leaveTypeId | string | Yes | the ID of the leave type of the leave | |
| response.data.locationId | string | Yes | the ID of the user's location when the leave request was sent | |
| response.data.departmentId | string | Yes | the ID of the user's department when the leave request was sent | |
| response.data.status | string | Yes | leave request status | Allowed values: "APPROVED" | "OPEN" | "DENIED" | "CANCELLED" | "EXPIRED" | "DELETED" |
| response.data.reason | string | null | Yes | the reason the user gave for the leave, an empty string when none was given. Requires the leaves:read-reason scope; without it the value is null . | |
| response.data.reason[variant1] | string | the reason the user gave for the leave, an empty string when none was given. Requires the leaves:read-reason scope; without it the value is null . | ||
| response.data.reason[variant2] | null | the reason the user gave for the leave, an empty string when none was given. Requires the leaves:read-reason scope; without it the value is null . | ||
| response.data.statusReason | string | null | Yes | the reason given when the leave was denied or cancelled, null when none was given. Requires the leaves:read-reason scope; without it the value is null . | |
| response.data.statusReason[variant1] | string | the reason given when the leave was denied or cancelled, null when none was given. Requires the leaves:read-reason scope; without it the value is null . | ||
| response.data.statusReason[variant2] | null | the reason given when the leave was denied or cancelled, null when none was given. Requires the leaves:read-reason scope; without it the value is null . | ||
| response.data.approvedLevel | string | null | Yes | the approval level reached in a department with multi-level approval, null otherwise. An OPEN leave with approvedLevel FIRST is waiting for the second-level approver. | "FIRST" | "SECOND" | "THIRD" | null |
| response.data.approvedLevel[variant1] | string | the approval level reached in a department with multi-level approval, null otherwise. An OPEN leave with approvedLevel FIRST is waiting for the second-level approver. | "FIRST" | "SECOND" | "THIRD" | null | |
| response.data.approvedLevel[variant2] | null | the approval level reached in a department with multi-level approval, null otherwise. An OPEN leave with approvedLevel FIRST is waiting for the second-level approver. | "FIRST" | "SECOND" | "THIRD" | null | |
| response.data.createdAt | string | Yes | a timestamp in the ISO 8601 format | date-time |
| response.data.user | object | No | the user on leave (only when expand includes user) | |
| response.data.user.id | string | Yes | user ID | |
| response.data.user.name | string | Yes | user name | |
| response.data.user.email | string | Yes | user email | |
| response.data.user.isAdmin | boolean | Yes | a boolean that tells you if the selected user is an admin | |
| response.data.user.locationId | string | null | Yes | the ID of the user's location, null when the user has none yet | |
| response.data.user.locationId[variant1] | string | the ID of the user's location, null when the user has none yet | ||
| response.data.user.locationId[variant2] | null | the ID of the user's location, null when the user has none yet | ||
| response.data.user.departmentId | string | null | Yes | the ID of the user's department, null when the user has none yet | |
| response.data.user.departmentId[variant1] | string | the ID of the user's department, null when the user has none yet | ||
| response.data.user.departmentId[variant2] | null | the ID of the user's department, null when the user has none yet | ||
| response.data.user.status | string | Yes | user status | "ACTIVE" | "INACTIVE" | "DELETED" |
| response.data.user.employeeId | string | null | Yes | the employee ID set on the user profile page, null when it is not set | |
| response.data.user.employeeId[variant1] | string | the employee ID set on the user profile page, null when it is not set | ||
| response.data.user.employeeId[variant2] | null | the employee ID set on the user profile page, null when it is not set | ||
| response.data.user.startDate | string | null | Yes | employment start date as stored, an ISO 8601 date or timestamp (the same value v1 returns), null when it is not set | |
| response.data.user.startDate[variant1] | string | employment start date as stored, an ISO 8601 date or timestamp (the same value v1 returns), null when it is not set | ||
| response.data.user.startDate[variant2] | null | employment start date as stored, an ISO 8601 date or timestamp (the same value v1 returns), null when it is not set | ||
| response.data.user.endDate | string | null | Yes | employment end date as stored, an ISO 8601 date or timestamp (the same value v1 returns), null when it is not set | |
| response.data.user.endDate[variant1] | string | employment end date as stored, an ISO 8601 date or timestamp (the same value v1 returns), null when it is not set | ||
| response.data.user.endDate[variant2] | null | employment end date as stored, an ISO 8601 date or timestamp (the same value v1 returns), null when it is not set | ||
| response.data.user.labels | array<object> | Yes | labels assigned to the user | |
| response.data.user.labels[] | object | |||
| response.data.user.labels[].id | string | Yes | ||
| response.data.user.labels[].name | string | Yes | ||
| response.data.user.labels[].color | string | Yes | ||
| response.data.user.location | object | No | the user's location (only when expand includes location) | |
| response.data.user.location.id | string | Yes | location ID | |
| response.data.user.location.name | string | Yes | location name | |
| response.data.user.location.timezone | string | No | the location's IANA time zone, left out when none is stored | |
| response.data.user.location.isDefault | boolean | Yes | whether this is the company's default location | |
| response.data.user.location.createdAt | string | Yes | a timestamp in the ISO 8601 format | date-time |
| response.data.user.department | object | No | the user's department (only when expand includes department) | |
| response.data.user.department.id | string | Yes | department ID | |
| response.data.user.department.name | string | Yes | department name | |
| response.data.user.department.isDefault | boolean | Yes | whether this is the company's default department | |
| response.data.user.department.createdAt | string | Yes | a timestamp in the ISO 8601 format | date-time |
| response.data.user.holidays | array<HolidayYear> | No | public holidays for the user's location, grouped by year (only when expand includes holidays) | |
| response.data.user.holidays[] | object | |||
| response.data.user.holidays[].year | integer | No | the year for the holidays | |
| response.data.user.holidays[].holidays | array<object> | No | ||
| response.data.user.holidays[].holidays[] | object | |||
| response.data.user.holidays[].holidays[].id | string | No | holiday ID | |
| response.data.user.holidays[].holidays[].name | string | No | holiday name | |
| response.data.user.holidays[].holidays[].date | string | No | date in YYYY-MM-DD format | date |
| response.data.user.holidays[].holidays[].isHalfDay | boolean | No | whether it is a half-day holiday | |
| response.data.approver | object | No | the approver, including location and department (only when expand includes approver) | |
| response.data.approver.id | string | Yes | user ID | |
| response.data.approver.name | string | Yes | user name | |
| response.data.approver.email | string | Yes | user email | |
| response.data.approver.isAdmin | boolean | Yes | a boolean that tells you if the selected user is an admin | |
| response.data.approver.locationId | string | null | Yes | the ID of the user's location, null when the user has none yet | |
| response.data.approver.locationId[variant1] | string | the ID of the user's location, null when the user has none yet | ||
| response.data.approver.locationId[variant2] | null | the ID of the user's location, null when the user has none yet | ||
| response.data.approver.departmentId | string | null | Yes | the ID of the user's department, null when the user has none yet | |
| response.data.approver.departmentId[variant1] | string | the ID of the user's department, null when the user has none yet | ||
| response.data.approver.departmentId[variant2] | null | the ID of the user's department, null when the user has none yet | ||
| response.data.approver.status | string | Yes | user status | "ACTIVE" | "INACTIVE" | "DELETED" |
| response.data.approver.employeeId | string | null | Yes | the employee ID set on the user profile page, null when it is not set | |
| response.data.approver.employeeId[variant1] | string | the employee ID set on the user profile page, null when it is not set | ||
| response.data.approver.employeeId[variant2] | null | the employee ID set on the user profile page, null when it is not set | ||
| response.data.approver.startDate | string | null | Yes | employment start date as stored, an ISO 8601 date or timestamp (the same value v1 returns), null when it is not set | |
| response.data.approver.startDate[variant1] | string | employment start date as stored, an ISO 8601 date or timestamp (the same value v1 returns), null when it is not set | ||
| response.data.approver.startDate[variant2] | null | employment start date as stored, an ISO 8601 date or timestamp (the same value v1 returns), null when it is not set | ||
| response.data.approver.endDate | string | null | Yes | employment end date as stored, an ISO 8601 date or timestamp (the same value v1 returns), null when it is not set | |
| response.data.approver.endDate[variant1] | string | employment end date as stored, an ISO 8601 date or timestamp (the same value v1 returns), null when it is not set | ||
| response.data.approver.endDate[variant2] | null | employment end date as stored, an ISO 8601 date or timestamp (the same value v1 returns), null when it is not set | ||
| response.data.approver.labels | array<object> | Yes | labels assigned to the user | |
| response.data.approver.labels[] | object | |||
| response.data.approver.labels[].id | string | Yes | ||
| response.data.approver.labels[].name | string | Yes | ||
| response.data.approver.labels[].color | string | Yes | ||
| response.data.approver.location | object | No | the user's location (only when expand includes location) | |
| response.data.approver.location.id | string | Yes | location ID | |
| response.data.approver.location.name | string | Yes | location name | |
| response.data.approver.location.timezone | string | No | the location's IANA time zone, left out when none is stored | |
| response.data.approver.location.isDefault | boolean | Yes | whether this is the company's default location | |
| response.data.approver.location.createdAt | string | Yes | a timestamp in the ISO 8601 format | date-time |
| response.data.approver.department | object | No | the user's department (only when expand includes department) | |
| response.data.approver.department.id | string | Yes | department ID | |
| response.data.approver.department.name | string | Yes | department name | |
| response.data.approver.department.isDefault | boolean | Yes | whether this is the company's default department | |
| response.data.approver.department.createdAt | string | Yes | a timestamp in the ISO 8601 format | date-time |
| response.data.approver.holidays | array<HolidayYear> | No | public holidays for the user's location, grouped by year (only when expand includes holidays) | |
| response.data.approver.holidays[] | object | |||
| response.data.approver.holidays[].year | integer | No | the year for the holidays | |
| response.data.approver.holidays[].holidays | array<object> | No | ||
| response.data.approver.holidays[].holidays[] | object | |||
| response.data.approver.holidays[].holidays[].id | string | No | holiday ID | |
| response.data.approver.holidays[].holidays[].name | string | No | holiday name | |
| response.data.approver.holidays[].holidays[].date | string | No | date in YYYY-MM-DD format | date |
| response.data.approver.holidays[].holidays[].isHalfDay | boolean | No | whether it is a half-day holiday | |
| response.data.leaveType | object | No | the leave type (only when expand includes leaveType) | |
| response.data.leaveType.id | string | Yes | ||
| response.data.leaveType.name | string | Yes | ||
| response.data.leaveType.isDefault | boolean | Yes |
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 |