Skip to Content
API ReferenceTime Off

Create Time Off Request

POST
/api/v1/time-off/requests

Creates a request for employee_id and sends it through the organization's approval flow; the API user is saved as its author. Requires permission employee_time_off=edit or approve_leaves_as_admin=edit for the employee. A request that breaks the leave policy is 422 with the reason code.

Authorization

HttpBearerAuth
headerAuthorizationBearer <JWT>

Request Body

application/json
  1. body
employee_id*Employee Id
Range0 < value
category_id*Category Id
Range0 < value
date_from*Date From
Formatdate
date_to*Date To
Formatdate
comment?string|null

Response Body

Successful Response

application/json
  1. response
approval_request_details*|null
time_off_log*
Example Request
curl -X POST 'https://api.skailer.com/api/v1/time-off/requests' \  -H 'Content-Type: application/json' \  -d '{  "employee_id": 1,  "category_id": 1,  "date_from": "2019-08-24",  "date_to": "2019-08-24"}'
Example Response
{  "approval_request_details": {    "id": 1,    "datetime_created_at": "string",    "employee_id": 0,    "type": "time_off",    "status": "awaiting",    "confirmations": [      {        "created_at": "string",        "updated_at": "string",        "from_employee_id": 0,        "status": "queued",        "confirmed_at": "string",        "rejected_at": "string",        "is_bypass_approval_flow": true,        "approver_employee_id": 0,        "substitutor_employee_id": 0,        "comment": "string"      }    ],    "created_by_id": 0  },  "time_off_log": {    "id": 1,    "date_adjustment": "string",    "employee_id": 0,    "category": {      "id": 1,      "title": "string",      "description": "string",      "category_type": "accrues_time",      "paid_type": "not_working_paid",      "emoji": "string",      "color": "string",      "policies_count": 0,      "period_track_type": "days",      "sort": 0,      "is_archived": true,      "is_parental_leave": true    },    "balance": "string",    "action": "initial_balance",    "balance_type": "earnings",    "date_expire": "string",    "created_by_id": 0,    "date_created": "string",    "date_from": "string",    "date_to": "string",    "comment": "string",    "files": [      {        "name": "string",        "file_type": "string",        "size": 0,        "mime_type": "string",        "uuid": "string",        "url": "string"      }    ]  }}