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

MethodNameEndpoint
POSTCreate Time Off Request Typehttps://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

FieldTypeRequiredDescription
namestringYesName of the time off request type, e.g. "On Vacation".
payCodeTypeinteger (enum)YesPay code category this request type maps to. See Pay Code Type values below.
customPayCodestring | nullNoA custom pay code label for this type.
incrementinteger (enum)YesThe unit employees request time off in under this type. See Increment values below.
allowHalfDaybooleanNoWhether employees can request a half-day increment. Only applies when increment is Days (3).
durationLimitinteger (minutes) | nullNoMaximum duration allowed per request under this type, in minutes.

Pay Code Type values

ValueName
1PaidTimeOff
2SickTime
3Custom
4UnpaidTimeOff

Increment values

ValueName
1UnlimitedWithinDay
2Hours
3Days

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.


Did this page help you?