Leave requests

All the webhooks that are related to leave requests

For leave requests we offer 4 different webhooks for various scenarios:

  • Leave request created
  • Leave request approved
  • Leave request rejected
  • Leave request withdrawn

📘

If leave policy has file attachment enabled or required, attached files will not be shown in webhook.

Leave request created

Webhook will be triggered instantly, as soon as the leave is created.
Action: 'leave_request_create'
Payload example:

{
  "action": "leave_request_create",
  "data": {
    "id": 1062480,
    "attributes": {
      "employee_id": 2632,
      "starts_on": "2024-01-31",
      "ends_on": "2024-02-01",
      "amount": "2.0",
      "description": "Vacation with family",
      "unit": "days",
      "state": "approved"
    },
    "entries": [
      {
        "occurs_on": "2024-01-31",
        "amount": "1.0"
      },
      {
        "occurs_on": "2024-02-01",
        "amount": "1.0"
      }
    ],
    "leave_type": {
      "id": 13289,
      "name": "Vacation"
    },
    "meta": {
      "created_at": "2024-02-01T15:43:50.841+00:00",
      "updated_at": "2024-02-01T15:43:50.878+00:00"
    }
  }
}

Leave request approved

Webhook will be triggered instantly, as soon as the last approver in the approval flow will approve leave request and status changes to Approved.
Action: 'leave_request_approve'
Payload example:

{
  "action": "leave_request_approve",
  "data": {
    "id": 345842,
    "attributes": {
      "employee_id": 2632,
      "starts_on": "2022-09-20",
      "ends_on": "2022-09-23",
      "amount": "32.0",
      "description": "",
      "unit": "hours",
      "state": "approved"
    },
    "entries": [
      {
        "occurs_on": "2022-09-20",
        "amount": "8.0"
      },
      {
        "occurs_on": "2022-09-21",
        "amount": "8.0"
      },
      {
        "occurs_on": "2022-09-22",
        "amount": "8.0"
      },
      {
        "occurs_on": "2022-09-23",
        "amount": "8.0"
      }
    ],
    "leave_type": {
      "id": 4098,
      "name": "Day off"
    },
    "meta": {
      "created_at": "2022-09-21T16:08:31.562+01:00",
      "updated_at": "2022-09-21T16:08:36.540+01:00"
    }
  }
}

Leave request rejected

Webhook will be triggered instantly, as soon as at least one approver in the approval flow will reject leave request and status changes to Rejected.
Action: 'leave_request_reject'
Payload example:

{
  "action": "leave_request_reject",
  "data": {
    "id": 345847,
    "attributes": {
      "employee_id": 2632,
      "starts_on": "2022-09-06",
      "ends_on": "2022-09-11",
      "amount": "32.0",
      "description": "",
      "unit": "hours",
      "state": "rejected"
    },
    "entries": [
      {
        "occurs_on": "2022-09-06",
        "amount": "8.0"
      },
      {
        "occurs_on": "2022-09-07",
        "amount": "8.0"
      },
      {
        "occurs_on": "2022-09-08",
        "amount": "8.0"
      },
      {
        "occurs_on": "2022-09-09",
        "amount": "8.0"
      },
      {
        "occurs_on": "2022-09-10",
        "amount": "0.0"
      },
      {
        "occurs_on": "2022-09-11",
        "amount": "0.0"
      }
    ],
    "leave_type": {
      "id": 4098,
      "name": "Day off"
    },
    "meta": {
      "created_at": "2022-09-21T16:10:25.052+01:00",
      "updated_at": "2022-09-21T16:10:28.284+01:00"
    }
  }

Leave request withdrawn

Webhook will be triggered instantly, as soon as leave request was withdrawn and status changes to Withdrawn.
Action: 'leave_request_withdrawn'
Payload example:

{
  "action": "leave_request_withdraw",
  "data": {
    "id": 345850,
    "attributes": {
      "employee_id": 2632,
      "starts_on": "2022-09-28",
      "ends_on": "2022-09-30",
      "amount": "3.0",
      "description": "",
      "unit": "days",
      "state": "withdrawn"
    },
    "entries": [
      {
        "occurs_on": "2022-09-28",
        "amount": "1.0"
      },
      {
        "occurs_on": "2022-09-29",
        "amount": "1.0"
      },
      {
        "occurs_on": "2022-09-30",
        "amount": "1.0"
      }
    ],
    "leave_type": {
      "id": 3916,
      "name": "Day off"
    },
    "meta": {
      "created_at": "2022-09-21T16:12:48.034+01:00",
      "updated_at": "2022-09-21T16:13:13.260+01:00"
    }
  }
}