TimeOff Types
A time off request type defines a category of leave employees can submit time off requests under — for example "On Vacation" or "Sick Time." Each type sets the pay code category it maps to, the increment employees request time off in (unlimited-within-day, hours, or whole days), and optional limits like a maximum request duration or whether half-day requests are allowed.
Create a request type once per category your company needs; the id returned is what you'll reference later when creating time off requests for employees under that type (see Time Off Requests).
Endpoints overview
| Method | Name | Endpoint |
|---|---|---|
| POST | Create Time Off Request Type | https://api.worklio.com/wep/companies/{CLIENT_ID}/timeoff-request-types |
CLIENT_ID is the company identifier returned as id when you create the company.
Create Time Off Request Type
POST https://api.worklio.com/wep/companies/{CLIENT_ID}/timeoff-request-types
Request fields
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Name of the time off request type, e.g. "On Vacation". |
payCodeType | integer (enum) | Yes | Pay code category this request type maps to. See Pay Code Type values below. |
customPayCode | string | null | No | A custom pay code label for this type. |
increment | integer (enum) | Yes | The unit employees request time off in under this type. See Increment values below. |
allowHalfDay | boolean | No | Whether employees can request a half-day increment. Only applies when increment is Days (3). |
durationLimit | integer (minutes) | null | No | Maximum duration allowed per request under this type, in minutes. |
Pay Code Type values
| Value | Name |
|---|---|
| 1 | PaidTimeOff |
| 2 | SickTime |
| 3 | Custom |
| 4 | UnpaidTimeOff |
Increment values
| Value | Name |
|---|---|
| 1 | UnlimitedWithinDay |
| 2 | Hours |
| 3 | Days |
Example request
require("dotenv").config();
const TOKEN = process.env.API_KEY;
const CLIENT_ID = process.env.CLIENT_ID;
const url = `https://api.worklio.com/wep/companies/${CLIENT_ID}/timeoff-request-types`;
const payload = {
name: "On Vacation",
payCodeType: 1,
increment: 1
};
async function createTimeOffRequestType() {
const response = await fetch(url, {
method: "POST",
headers: {
accept: "application/json",
"api-version": "2.0",
authorization: `Bearer ${TOKEN}`,
"content-type": "application/json",
"x-api-version": "2.0"
},
body: JSON.stringify(payload)
});
console.log(response.status);
console.log(await response.text());
}
createTimeOffRequestType();curl -s -X POST "https://api.worklio.com/wep/companies/$CLIENT_ID/timeoff-request-types" \
-H "accept: application/json" \
-H "api-version: 2.0" \
-H "authorization: Bearer $API_KEY" \
-H "content-type: application/json" \
-H "x-api-version: 2.0" \
-d '{
"name": "On Vacation",
"payCodeType": 1,
"increment": 1
}' | jq .Example response
{
"id": 9,
"name": "On Vacation",
"payCodeType": 1,
"increment": 1
}id is the request type's unique identifier — this is what you'll use to reference this type when creating time off requests for employees.
Updated 30 minutes ago
