List leaves Beta

GET /leaves

Query parameters

  • type array[string]

    One or more types to filter leaves by.

    Values are paid, unpaid, sick, or absence.

  • status array[string]

    One or more statuses to filter leaves by.

    Values are draft, cancelled, pending_approval, approved, or rejected.

  • code array[string]

    One or more codes to filter leaves by.

  • person array[string]

    One or more person IDs to filter the results by. This is the people[].person._id value.

  • overlapsDateRangeFrom string

    Limit the results by an overlapping date range. This is the date range start value. The overlapsDateRangeTo is required as well. Format is overlapsDateRangeFrom=<date>, e.g. overlapsDateRangeFrom=2025-02-24T00:00:00.000Z. The date is in ISOString.

  • overlapsDateRangeTo string

    Limit the results by an overlapping date range. This is the date range end value. The overlapsDateRangeFrom is required as well. Format is overlapsDateRangeTo=<date>, e.g. overlapsDateRangeTo=2025-02-28T00:00:00.000Z. The date is in ISOString.

  • select array[string]

    One or more properties to be included in the response, instead of the full payload. E.g. select=endDate,projectStatus. You can also exclude fields by prefixing with a minus sign, e.g. select=-endDate,-projectStatus, but you cannot mix both.

  • sortBy string

    Optionally, the field to sort the results by. By default, results are sorted by created date. Only updatedAt is supported at this moment (Note: updatedAt equals to createdAt for documents that have never been updated).

    Value is updatedAt.

  • sortDirection string

    Optionally, the direction to sort the documents by. For ascending (oldest first) use either 1 or asc. By default sorting is descending (latest first), -1 or desc.

    Values are 1, asc, -1, or desc.

  • limit integer

    Optionally, change the default document response limit of 40.

    Minimum value is 1, maximum value is 100. Default value is 40.

  • count boolean | number

    Includes a count property in the response, which holds the total number of results matching the query. The value does not change between pages and represents the accurate, total number of results to be expected.

    Note: The use of this parameter will have a performance impact on the first paginated request.

    Values are false, true, 0, or 1.

Responses

  • 200 application/json

    Successful response

    Hide response attributes Show response attributes object
    • value array[object]
      Hide value attributes Show value attributes object
      • _id string(ObjectId)

        The unique document ID.

      • createdBy string(ObjectId)

        The creator's unique document ID.

      • createdAt string(date-time)

        The date the document was created in ISOString format. See .toISOString().

      • updatedAt string(date-time)

        The date the document was last updated in ISOString format. See .toISOString().

      • person string

        The reference to the organization's person ID. This is the people[].person._id value.

      • type string

        The type of leave. The absence value refers to long term absences, such as parental and medical leaves.

        Values are paid, unpaid, sick, or absence.

      • status string

        The current status of the leave.

        Values are draft, cancelled, pending_approval, approved, or rejected.

      • code string

        A custom code for the leave.

      • reason string

        Free form text to describe the leave.

      • dates array[object]
        Hide dates attributes Show dates attributes object
        • _id string(ObjectId)

          The unique document ID.

        • date string(date-time)

          The date of the leave in ISOString format.

        • hours number

          The total hours of absence for the specified date.

      • reviews array[object]
        Hide reviews attributes Show reviews attributes object
        • _id string(ObjectId)

          The unique document ID.

        • person string

          The reviewer's ID. This is the people[].person._id value.

        • action string

          The reviewer's action for this leave.

          Values are cancelled, approved, or rejected.

        • actionedAt string(date-time)

          The date the review was submitted in ISOString format.

    • count number

      The total count of results for the specific request. It's included in the response only when the count boolean query parameter is provided and truthy, e.g. ?count=1. The value is being calculated only during the first request and then repeated on the subsequent paginated responses.

GET /leaves
curl \
 --request GET 'https://open.api.missionx.ai/v2/leaves' \
 --header "Authorization: Bearer $ACCESS_TOKEN"
Response examples (200)
{
  "value": [
    {
      "_id": "string",
      "createdBy": "string",
      "createdAt": "2025-05-04T09:42:00Z",
      "updatedAt": "2025-05-04T09:42:00Z",
      "person": "string",
      "type": "paid",
      "status": "draft",
      "code": "string",
      "reason": "string",
      "dates": [
        {
          "_id": "string",
          "date": "2025-05-04T09:42:00Z",
          "hours": 42.0
        }
      ],
      "reviews": [
        {
          "_id": "string",
          "person": "string",
          "action": "cancelled",
          "actionedAt": "2025-05-04T09:42:00Z"
        }
      ]
    }
  ],
  "nextLink": "string",
  "count": 42.0
}