Skip to content

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

FieldTypeRequiredDescriptionConstraints
startDatestringYesdate in YYYY-MM-DD format.Format: 2023-02-03

endDate

FieldTypeRequiredDescriptionConstraints
endDatestringYesdate in YYYY-MM-DD format, cant be before the startDate.Format: 2023-03-03

nextToken

FieldTypeRequiredDescriptionConstraints
nextTokenstringNoThe nextToken returned by the previous API call.

limit

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

FieldTypeRequiredDescriptionConstraints
statusstringNoleave request status, by default 'APPROVED'Allowed values: "APPROVED" | "OPEN" | "DENIED" | "CANCELLED" | "EXPIRED" | "DELETED"

expand

FieldTypeRequiredDescriptionConstraints
expandstringNoexpand leave requestAllowed values: "user" | "approver" | "leaveType"

response

FieldTypeRequiredDescriptionConstraints
responseobject
response.statusstringNoAllowed values: "ok" | "error"
response.nextTokenstringNo
response.dataarray<Leaves>No
response.data[]object
response.data[].idstringNoleave IDFormat: UUID
response.data[].userIdstringNoan ID of the user on leave
response.data[].approverIdstringNoan ID of the approver (only if the leave request is approved)
response.data[].autoApprovedbooleanNois the leave request automatically approved or not
response.data[].durationCalendarDaysnumberNothe duration of a leave in calendar days
response.data[].durationWorkingDaysnumberNothe duration of a leave in working/business days
response.data[].startDatestringNodate in YYYY-MM-DD format
response.data[].endDatestringNodate in YYYY-MM-DD format
response.data[].isFullDayLeavebooleanNoif 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[].startHournumberNostart hour in users time zone (in 24h format) for the part day leave, returned only when the isFullDayLeave is equal to false
response.data[].endHournumberNoend hour in users time zone (in 24h format) for the part day leave, returned only when the isFullDayLeave is equal to false
response.data[].startMinutenumberNostart minutes in the users time zone for the part-day leave, returned only when isFullDayLeave is equal to false.
response.data[].endMinutenumberNoend minutes in the users time zone for the part-day leave, returned only when isFullDayLeave is equal to false.
response.data[].leaveTypeIdstringNothe ID of a leave type of the selected leave
response.data[].locationIdstringNothe ID of the users location when the leave request was sent
response.data[].departmentIdstringNothe ID of the users department when the leave request was sent
response.data[].statusstringNoleave request statusAllowed values: "APPROVED" | "OPEN" | "DENIED" | "CANCELLED" | "EXPIRED" | "DELETED"
response.data[].createdAtstringNoa timestamp in the ISO 8601 format
response.data[].leaveTypeobjectNo
response.data[].leaveType.idstringNoFormat: UUID
response.data[].leaveType.namestringNo
response.data[].leaveType.colorstringNo
response.data[].leaveType.isActivebooleanNo
response.data[].userobjectNo
response.data[].user.idstringNouser IDUUID
response.data[].user.namestringNouser name
response.data[].user.emailstringNouser email
response.data[].user.isAdminbooleanNoa boolean that tells you if the selected user is an admin
response.data[].user.locationIdstringNothe ID of the user's location
response.data[].user.departmentIdstringNothe ID of the user's department
response.data[].user.labelsarray<string>Nolabels
response.data[].user.labels[]string
response.data[].user.statusstringNousers status, one of the following"ACTIVE" | "INACTIVE" | "DELETED"
response.data[].user.employeeIdstringNoan employee ID if it is set on the user profile page
response.data[].user.startDatestringNoa timestamp in the ISO 8601 format
response.data[].user.endDatestringNoa timestamp in the ISO 8601 format, if the end date is set on the user profile page
response.data[].user.locationobjectNo
response.data[].user.location.idstringNolocation IDUUID
response.data[].user.location.namestringNolocation name
response.data[].user.location.timezonestringNolocation time zone
response.data[].user.location.isDefaultbooleanNoa boolean that tells you if the location is default or not
response.data[].user.location.createdAtstringNoa timestamp in the ISO 8601 formatDate ISO 8601 format
response.data[].user.departmentobjectNo
response.data[].user.department.idstringNodepartment IDUUID
response.data[].user.department.namestringNodepartment name
response.data[].user.department.isDefaultbooleanNoa boolean that tells you if the department is default or not
response.data[].user.department.createdAtstringNoa timestamp in the ISO 8601 formatDate ISO 8601 format
response.data[].user.holidaysarray<PublicHolidaysByYear>Nopublic holidays for the user's location, grouped by year (only when expand=holidays)
response.data[].user.holidays[]object
response.data[].user.holidays[].yearintegerNothe year for the holidays
response.data[].user.holidays[].holidaysarray<PublicHoliday>No
response.data[].user.holidays[].holidays[]object
response.data[].user.holidays[].holidays[].idstringNoholiday ID
response.data[].user.holidays[].holidays[].namestringNoholiday name
response.data[].user.holidays[].holidays[].datestringNodate in YYYY-MM-DD format
response.data[].user.holidays[].holidays[].isHalfDaybooleanNowhether it is a half-day holiday
response.data[].approverobjectNo
response.data[].approver.idstringNouser IDUUID
response.data[].approver.namestringNouser name
response.data[].approver.emailstringNouser email
response.data[].approver.isAdminbooleanNoa boolean that tells you if the selected user is an admin
response.data[].approver.locationIdstringNothe ID of the user's location
response.data[].approver.departmentIdstringNothe ID of the user's department
response.data[].approver.labelsarray<string>Nolabels
response.data[].approver.labels[]string
response.data[].approver.statusstringNousers status, one of the following"ACTIVE" | "INACTIVE" | "DELETED"
response.data[].approver.employeeIdstringNoan employee ID if it is set on the user profile page
response.data[].approver.startDatestringNoa timestamp in the ISO 8601 format
response.data[].approver.endDatestringNoa timestamp in the ISO 8601 format, if the end date is set on the user profile page
response.data[].approver.locationobjectNo
response.data[].approver.location.idstringNolocation IDUUID
response.data[].approver.location.namestringNolocation name
response.data[].approver.location.timezonestringNolocation time zone
response.data[].approver.location.isDefaultbooleanNoa boolean that tells you if the location is default or not
response.data[].approver.location.createdAtstringNoa timestamp in the ISO 8601 formatDate ISO 8601 format
response.data[].approver.departmentobjectNo
response.data[].approver.department.idstringNodepartment IDUUID
response.data[].approver.department.namestringNodepartment name
response.data[].approver.department.isDefaultbooleanNoa boolean that tells you if the department is default or not
response.data[].approver.department.createdAtstringNoa timestamp in the ISO 8601 formatDate ISO 8601 format
response.data[].approver.holidaysarray<PublicHolidaysByYear>Nopublic holidays for the user's location, grouped by year (only when expand=holidays)
response.data[].approver.holidays[]object
response.data[].approver.holidays[].yearintegerNothe year for the holidays
response.data[].approver.holidays[].holidaysarray<PublicHoliday>No
response.data[].approver.holidays[].holidays[]object
response.data[].approver.holidays[].holidays[].idstringNoholiday ID
response.data[].approver.holidays[].holidays[].namestringNoholiday name
response.data[].approver.holidays[].holidays[].datestringNodate in YYYY-MM-DD format
response.data[].approver.holidays[].holidays[].isHalfDaybooleanNowhether it is a half-day holiday

response

FieldTypeRequiredDescriptionConstraints
responseobjectStandard error body returned by all validated endpoints.
response.statusstringYesAllowed values: "error"
response.messagestringYesHuman-readable description of what went wrong.

response

FieldTypeRequiredDescriptionConstraints
responseGatewayErrorResponse | ErrorResponse
response[variant1]objectError body returned when the request is rejected before reaching the endpoint (missing API key, unknown path).
response[variant1].messagestringYes
response[variant2]objectStandard error body returned by all validated endpoints.
response[variant2].statusstringYesAllowed values: "error"
response[variant2].messagestringYesHuman-readable description of what went wrong.

response

FieldTypeRequiredDescriptionConstraints
responseobjectError body returned when the request is rejected before reaching the endpoint (missing API key, unknown path).
response.messagestringYes

response

FieldTypeRequiredDescriptionConstraints
responseobjectStandard error body returned by all validated endpoints.
response.statusstringYesAllowed values: "error"
response.messagestringYesHuman-readable description of what went wrong.