Get list of leaves between two dates
This endpoint returns leave requests that fall within a date range you supply. Both boundary dates are required, and the response can be narrowed by leave status or widened with related user, approver, and leave-type details.
Endpoint and authorization
Send a GET request to the leaves path. The API key goes in the x-api-key request header. The server URL is shown in the interactive panel; use your own base URL value rather than copying a production host from a screenshot.
Query parameters
startDate and endDate are mandatory strings in YYYY-MM-DD format. endDate cannot be earlier than startDate. nextToken carries the continuation value from a previous call. limit controls how many users are returned; the documented range is 25 to 500 with a default of 300, and filters are applied after the limit, so the returned count can be lower than the limit you set. status defaults to APPROVED and accepts APPROVED, OPEN, DENIED, CANCELLED, EXPIRED, or DELETED. expand accepts user, approver, or leaveType.
Request example
The cURL example below uses startDate and endDate placeholders and the x-api-key header. Replace the placeholders with real values and a valid key before sending.
Response shape
A successful response contains status, nextToken, and a data array. Each leave record includes identifiers, duration fields, dates, part-day time fields, status, and timestamps. When expand is used, related leaveType, user, or approver objects appear in the record. The sample below shows a full-day APPROVED leave with expanded relations.
Field and control map
Use this map to decide which inputs to send and which response fields to read. Required fields are marked with an asterisk in the parameter list. Optional filters change the result set; expansion fields change the response depth.
Status and expand checklist
Before calling the endpoint, confirm the following: (1) both dates are present and endDate is not before startDate; (2) the status you want is one of the six documented values, or you accept the APPROVED default; (3) any expand value is one of user, approver, or leaveType; (4) you have stored the nextToken from the previous response if you are continuing a paginated read; (5) your limit is between 25 and 500.
Worked example
The sample response shows a leave from 2022-11-08 to 2022-11-08 with status APPROVED, durationCalendarDays 1, durationWorkingDays 1, and isFullDayLeave true. The startHour, endHour, startMinute, and endMinute fields are present but only meaningful for part-day leaves. The expanded user and approver objects both show the same user record in this example, which is useful for checking how the response nests related data.
Error responses
A 400 response returns a standard error body with status and message, for example when startDate is missing. A 403 response returns a message such as Forbidden when the API key is missing or unrecognized. A 404 response returns Not Found when the key is not authorized for the resource. A 500 response returns a standard error body with a message such as Failed to list users. The exact bodies are shown in the response tabs.
Frequently asked questions
What happens if I omit startDate or endDate?
The endpoint returns a 400 error with a message indicating that the missing field is required. Both dates are mandatory.
Can endDate be earlier than startDate?
No. The documentation states that endDate cannot be before startDate.
How do I get more than one page of results?
Use the nextToken value returned in the previous response as the nextToken query parameter on your next call. The limit parameter controls page size but does not guarantee that many records are returned.
What does expand do?
expand adds related objects to each leave record. Accepted values are user, approver, and leaveType.
curl -X GET "$API_BASE_URL/v1/leaves?startDate=string&endDate=string" \
-H "x-api-key: "{
"status": "ok",
"nextToken": "next-token",
"data": [
{
"id": "leaveRequest-cfe5d39b-f1f0-45aa-85cd-ce93e637a262",
"userId": "user-63b17e97-d38b-4586-8498-bb4f5d2e2c14",
"approverId": "user-63b17e97-d38b-4586-8498-bb4f5d2e2c14",
"autoApproved": false,
"durationCalendarDays": 1,
"durationWorkingDays": 1,
"startDate": "2022-11-08",
"endDate": "2022-11-08",
"isFullDayLeave": true,
"startHour": 0,
"endHour": 0,
"startMinute": 0,
"endMinute": 0,
"leaveTypeId": "leaveType-fcc1e5c5-ba93-479d-bd58-8f860ba10615",
"locationId": "location-79c77ac8-e5bf-479f-9488-648a58379ff1",
"departmentId": "team-0a21c25e-6925-4a5b-90ee-ecf82096c4f6",
"status": "APPROVED",
"createdAt": "2022-11-07T16:29:40.062Z",
"leaveType": {
"id": "88681ca1-4a47-4e4d-bc35-ffff86c0f54e",
"name": "Team B",
"color": "FF0000",
"isActive": true
},
"user": {
"id": "user-cfe5d39b-f1f0-45aa-85cd-ce93e637a262",
"name": "Jomh Chao",
"email": "[email protected]",
"isAdmin": false,
"locationId": "location-79c77ac8-e5bf-479f-9488-648a58379ff1",
"departmentId": "team-0a21c25e-6925-4a5b-90ee-ecf82096c4f6",
"labels": [
"contractor"
],
"status": "ACTIVE",
"employeeId": "uuid-id",
"startDate": "2022-11-08",
"endDate": "2022-11-08",
"location": {
"id": "locations-6ca89536-be55-42c5-8e52-c5c4215afb9f",
"name": "Los Angeles",
"timezone": "America/Los_Angeles",
"isDefault": false,
"createdAt": "2022-08-22T15:00:00.000Z"
},
"department": {
"id": "teams-969f8429-7dc3-48a1-96b1-6049a99dda06",
"name": "Dev Team",
"isDefault": false,
"createdAt": "2022-08-22T15:00:00.000Z"
},
"holidays": [
{
"year": 2025,
"holidays": [
{
"id": "h-12345",
"name": "Christmas Day",
"date": "2025-12-25",
"isHalfDay": false
}
]
}
]
},
"approver": {
"id": "user-cfe5d39b-f1f0-45aa-85cd-ce93e637a262",
"name": "Jomh Chao",
"email": "[email protected]",
"isAdmin": false,
"locationId": "location-79c77ac8-e5bf-479f-9488-648a58379ff1",
"departmentId": "team-0a21c25e-6925-4a5b-90ee-ecf82096c4f6",
"labels": [
"contractor"
],
"status": "ACTIVE",
"employeeId": "uuid-id",
"startDate": "2022-11-08",
"endDate": "2022-11-08",
"location": {
"id": "locations-6ca89536-be55-42c5-8e52-c5c4215afb9f",
"name": "Los Angeles",
"timezone": "America/Los_Angeles",
"isDefault": false,
"createdAt": "2022-08-22T15:00:00.000Z"
},
"department": {
"id": "teams-969f8429-7dc3-48a1-96b1-6049a99dda06",
"name": "Dev Team",
"isDefault": false,
"createdAt": "2022-08-22T15:00:00.000Z"
},
"holidays": [
{
"year": 2025,
"holidays": [
{
"id": "h-12345",
"name": "Christmas Day",
"date": "2025-12-25",
"isHalfDay": false
}
]
}
]
}
}
]
}{
"status": "error",
"message": "\"startDate\" is required"
}{
"message": "Forbidden"
}{
"message": "Not Found"
}{
"status": "error",
"message": "Failed to list users"
}startDate
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| startDate | string | Yes | date in YYYY-MM-DD format. | Format: 2023-02-03 |
endDate
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| endDate | string | Yes | date in YYYY-MM-DD format, cant be before the startDate. | Format: 2023-03-03 |
nextToken
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| nextToken | string | No | The nextToken returned by the previous API call. |
limit
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| limit | string | No | a number of users to return, between 25 and 500, default is 300. If the filters are provided, they'll be applied after the limit. The number of returned users might be less than the provided limit. |
status
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| status | string | No | leave request status, by default 'APPROVED' | Allowed values: "APPROVED" | "OPEN" | "DENIED" | "CANCELLED" | "EXPIRED" | "DELETED" |
expand
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| expand | string | No | expand leave request | Allowed values: "user" | "approver" | "leaveType" |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | |||
| response.status | string | No | Allowed values: "ok" | "error" | |
| response.nextToken | string | No | ||
| response.data | array<Leaves> | No | ||
| response.data[] | object | |||
| response.data[].id | string | No | leave ID | Format: UUID |
| response.data[].userId | string | No | an ID of the user on leave | |
| response.data[].approverId | string | No | an ID of the approver (only if the leave request is approved) | |
| response.data[].autoApproved | boolean | No | is the leave request automatically approved or not | |
| response.data[].durationCalendarDays | number | No | the duration of a leave in calendar days | |
| response.data[].durationWorkingDays | number | No | the duration of a leave in working/business days | |
| response.data[].startDate | string | No | date in YYYY-MM-DD format | |
| response.data[].endDate | string | No | date in YYYY-MM-DD format | |
| response.data[].isFullDayLeave | boolean | No | if the selected leave 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 users time zone (in 24h format) for the part day leave, returned only when the isFullDayLeave is equal to false | |
| response.data[].endHour | number | No | end hour in users time zone (in 24h format) for the part day leave, returned only when the isFullDayLeave is equal to false | |
| response.data[].startMinute | number | No | start minutes in the users time zone for the part-day leave, returned only when isFullDayLeave is equal to false. | |
| response.data[].endMinute | number | No | end minutes in the users time zone for the part-day leave, returned only when isFullDayLeave is equal to false. | |
| response.data[].leaveTypeId | string | No | the ID of a leave type of the selected leave | |
| response.data[].locationId | string | No | the ID of the users location when the leave request was sent | |
| response.data[].departmentId | string | No | the ID of the users department when the leave request was sent | |
| response.data[].status | string | No | leave request status | Allowed values: "APPROVED" | "OPEN" | "DENIED" | "CANCELLED" | "EXPIRED" | "DELETED" |
| response.data[].createdAt | string | No | a timestamp in the ISO 8601 format | |
| response.data[].leaveType | object | No | ||
| response.data[].leaveType.id | string | No | Format: UUID | |
| response.data[].leaveType.name | string | No | ||
| response.data[].leaveType.color | string | No | ||
| response.data[].leaveType.isActive | boolean | No | ||
| response.data[].user | object | No | ||
| response.data[].user.id | string | No | user ID | UUID |
| response.data[].user.name | string | No | user name | |
| response.data[].user.email | string | No | user email | |
| response.data[].user.isAdmin | boolean | No | a boolean that tells you if the selected user is an admin | |
| response.data[].user.locationId | string | No | the ID of the user's location | |
| response.data[].user.departmentId | string | No | the ID of the user's department | |
| response.data[].user.labels | array<string> | No | labels | |
| response.data[].user.labels[] | string | |||
| response.data[].user.status | string | No | users status, one of the following | "ACTIVE" | "INACTIVE" | "DELETED" |
| response.data[].user.employeeId | string | No | an employee ID if it is set on the user profile page | |
| response.data[].user.startDate | string | No | a timestamp in the ISO 8601 format | |
| response.data[].user.endDate | string | No | a timestamp in the ISO 8601 format, if the end date is set on the user profile page | |
| response.data[].user.location | object | No | ||
| response.data[].user.location.id | string | No | location ID | UUID |
| response.data[].user.location.name | string | No | location name | |
| response.data[].user.location.timezone | string | No | location time zone | |
| response.data[].user.location.isDefault | boolean | No | a boolean that tells you if the location is default or not | |
| response.data[].user.location.createdAt | string | No | a timestamp in the ISO 8601 format | Date ISO 8601 format |
| response.data[].user.department | object | No | ||
| response.data[].user.department.id | string | No | department ID | UUID |
| response.data[].user.department.name | string | No | department name | |
| response.data[].user.department.isDefault | boolean | No | a boolean that tells you if the department is default or not | |
| response.data[].user.department.createdAt | string | No | a timestamp in the ISO 8601 format | Date ISO 8601 format |
| response.data[].user.holidays | array<PublicHolidaysByYear> | No | public holidays for the user's location, grouped by year (only when expand=holidays) | |
| response.data[].user.holidays[] | object | |||
| response.data[].user.holidays[].year | integer | No | the year for the holidays | |
| response.data[].user.holidays[].holidays | array<PublicHoliday> | 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 | |
| response.data[].user.holidays[].holidays[].isHalfDay | boolean | No | whether it is a half-day holiday | |
| response.data[].approver | object | No | ||
| response.data[].approver.id | string | No | user ID | UUID |
| response.data[].approver.name | string | No | user name | |
| response.data[].approver.email | string | No | user email | |
| response.data[].approver.isAdmin | boolean | No | a boolean that tells you if the selected user is an admin | |
| response.data[].approver.locationId | string | No | the ID of the user's location | |
| response.data[].approver.departmentId | string | No | the ID of the user's department | |
| response.data[].approver.labels | array<string> | No | labels | |
| response.data[].approver.labels[] | string | |||
| response.data[].approver.status | string | No | users status, one of the following | "ACTIVE" | "INACTIVE" | "DELETED" |
| response.data[].approver.employeeId | string | No | an employee ID if it is set on the user profile page | |
| response.data[].approver.startDate | string | No | a timestamp in the ISO 8601 format | |
| response.data[].approver.endDate | string | No | a timestamp in the ISO 8601 format, if the end date is set on the user profile page | |
| response.data[].approver.location | object | No | ||
| response.data[].approver.location.id | string | No | location ID | UUID |
| response.data[].approver.location.name | string | No | location name | |
| response.data[].approver.location.timezone | string | No | location time zone | |
| response.data[].approver.location.isDefault | boolean | No | a boolean that tells you if the location is default or not | |
| response.data[].approver.location.createdAt | string | No | a timestamp in the ISO 8601 format | Date ISO 8601 format |
| response.data[].approver.department | object | No | ||
| response.data[].approver.department.id | string | No | department ID | UUID |
| response.data[].approver.department.name | string | No | department name | |
| response.data[].approver.department.isDefault | boolean | No | a boolean that tells you if the department is default or not | |
| response.data[].approver.department.createdAt | string | No | a timestamp in the ISO 8601 format | Date ISO 8601 format |
| response.data[].approver.holidays | array<PublicHolidaysByYear> | No | public holidays for the user's location, grouped by year (only when expand=holidays) | |
| response.data[].approver.holidays[] | object | |||
| response.data[].approver.holidays[].year | integer | No | the year for the holidays | |
| response.data[].approver.holidays[].holidays | array<PublicHoliday> | 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 | |
| response.data[].approver.holidays[].holidays[].isHalfDay | boolean | No | whether it is a half-day holiday |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | Standard error body returned by all validated endpoints. | ||
| response.status | string | Yes | Allowed values: "error" | |
| response.message | string | Yes | Human-readable description of what went wrong. |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | GatewayErrorResponse | ErrorResponse | |||
| response[variant1] | object | Error body returned when the request is rejected before reaching the endpoint (missing API key, unknown path). | ||
| response[variant1].message | string | Yes | ||
| response[variant2] | object | Standard error body returned by all validated endpoints. | ||
| response[variant2].status | string | Yes | Allowed values: "error" | |
| response[variant2].message | string | Yes | Human-readable description of what went wrong. |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | Error body returned when the request is rejected before reaching the endpoint (missing API key, unknown path). | ||
| response.message | string | Yes |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | Standard error body returned by all validated endpoints. | ||
| response.status | string | Yes | Allowed values: "error" | |
| response.message | string | Yes | Human-readable description of what went wrong. |