List Leave Types
The leave types endpoint returns every leave type configured for a company, including both active and inactive records, in a single response. There is no pagination.
Endpoint and authorization
Send a GET request to /v2/leave-types. The request requires the leave-types:read scope. The API key is sent as Authorization: Bearer vt_live_<secret>. How keys are created, which scopes exist, and how the key owner's role limits them are covered in the Authentication and Scopes sections of the developer documentation. Leave types are not limited by the key's data reach. Which locations use a leave type is returned by GET /v2/locations/{id}/leave-policies.
Response fields
The response body contains a data array. Each item is a leave type object with the following fields: id (string, leave type ID), name (string, leave type name), isActive (boolean, whether the leave type is active), color (string, leave type color in #RRGGBB format), position (integer, display order, read-only and set in the dashboard), and calendarStatus (string, either "Busy" or "Free", indicating how leaves of this type appear on connected calendars such as Outlook and Google).
Example response
A successful 200 response returns a JSON object with a data array. The example below shows two leave types: one active with a blue color and a calendar status of "Busy", and one active with a red color and no calendar status shown in the sample. Both include an id, name, isActive, color and position.
Error responses
Errors use a consistent envelope with an error object containing code, name, description, resolution and requestId. The endpoint documents 401, 403, 429 and 500 responses. A 401 means the API key is missing, malformed or not recognized. A 403 can mean the key lacks a required scope, the key was revoked, or the acting user may not perform the action. A 429 means too many requests were sent in a short time. A 500 means something went wrong on the server side.
Failure distinction checklist
Before retrying, check the error code. For 401, verify the Authorization header contains a valid bearer token. For 403, confirm the key has leave-types:read and that the acting user has permission. For 429, wait and retry. For 500, retry later and include the requestId if contacting support. Do not retry a 401 or 403 without fixing the underlying cause.
Frequently asked questions
Does this endpoint return inactive leave types?
Yes. The response includes both active and inactive leave types. The isActive field on each item indicates whether that leave type is currently active.
Is there pagination on the leave types endpoint?
No. The endpoint returns all leave types in one response without pagination.
What does calendarStatus mean?
calendarStatus is a string that is either "Busy" or "Free". It controls how leaves of this type appear on connected calendars such as Outlook and Google.
Why does the key's data reach not limit leave types?
The endpoint returns the company's leave types regardless of the key's data reach. Location-level usage is not filtered here; to see which locations use a leave type, call GET /v2/locations/{id}/leave-policies.
curl -X GET "$API_BASE_URL/v2/leave-types" \
-H "Authorization: Bearer "{
"data": [
{
"id": "leaveType-fcc1e5c5-ba93-479d-bd58-8f860ba10615",
"name": "Vacation",
"isActive": true,
"color": "#1E90FF",
"position": 0,
"calendarStatus": "Busy"
},
{
"id": "leaveType-88681ca1-4a47-4e4d-bc35-ffff86c0f54e",
"name": "Sick leave",
"isActive": true,
"color": "#FF6347",
"position": 1
}
]
}{
"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": "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"
}
}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 |