TimeOff Policies

Time Off Policies

A time off policy defines the rules for how employees accrue and use paid time off: what they accrue against (hours worked, pay period, calendar month, etc.), how much, any waiting period before newly-accrued time can be used, and limits on balance and rollover. You can create multiple policies to cover different types of time off or different employee groups within a company.

Once a policy exists, employees are assigned to it (see employee setup) and start accruing time off under its rules. Employees submit time off requests against a policy's balance — see Time Off Requests and Time Off Balances for that side of the flow.

Auth

Requires a bearer access token (see How to Get API Access). Creating, listing, and reading policies requires a System-wide or Admin-level token — a call made with an employee-level token returns a 403.

Endpoints overview

MethodNameEndpoint
POSTCreate Time Off Policyhttps://api.worklio.com/wep/companies/{CLIENT_ID}/timeoff-policies
GETList Time Off Policieshttps://api.worklio.com/wep/companies/{CLIENT_ID}/timeoff-policies
GETGet Time Off Policyhttps://api.worklio.com/wep/companies/{CLIENT_ID}/timeoff-policies/{POLICY_ID}
PUTDeactivate Time Off Policyhttps://api.worklio.com/wep/companies/{CLIENT_ID}/timeoff-policy-deactivations/{POLICY_ID}
GETList Time Off Policy Presetshttps://api.worklio.com/wep/timeoff-policy-presets

CLIENT_ID is the company identifier returned as id when you create the company. POLICY_ID is the policy identifier returned as id when you create a policy (below).

Create Time Off Policy

POST https://api.worklio.com/wep/companies/{CLIENT_ID}/timeoff-policies

You can create a policy two ways:

  • From a preset. Pass presetId alone.
  • From scratch. Pass presetId alongside other fields. If otherfields are present, every field you send rewrites field in preset. Call List Time Off Policy Presets first to see the available presets and their values.

Request fields

FieldTypeRequiredDescription
presetIdinteger | nullSee aboveID of a preset from List Time Off Policy Presets. If present, all other fields below are ignored and the policy is created from the preset's values instead.
namestring | nullNoName of the policy.
accrualYearTypeinteger (enum)YesWhen the accrual year begins. See Accrual Year Type values below.
accrualYearStartOnMonthinteger | nullRequired if accrualYearType is 1Month (112) the accrual year starts on. Only applies to accrualYearType: 1 (Calendar Year).
accrualStartOnDelayinteger | null (≥ 0)NoDays after hire before a new employee starts accruing time off under this policy.
accrualAvailableOnDelayinteger | null (≥ 0)NoDays after hire before a new employee can use time off they've already accrued under this policy.
serviceYearobjectYesAccrual amount and limits. See Service Year object below.
legislativeinteger (enum)NoLegislative region this policy applies to. See Legislative values below.

Service Year object

FieldTypeRequiredDescription
accrualAmountnumber (0–1000)YesHours accrued per period, where the period is defined by periodLength/periodUnit.
periodLengthinteger (1–31000)YesNumber of periodUnit units per accrual period.
periodUnitinteger (enum)YesThe unit periodLength is counted in. See Period Unit values below.
annualLimitnumber | nullNoMaximum hours an employee can accrue under this policy within one accrual year.
balanceLimitnumber | nullNoMaximum hours an employee can have available at any time under this policy.
rolloverLimitnumber | nullNoMaximum hours that carry over into the next accrual year.

Accrual Year Type values

ValueNameMeaning
1CalendarYearAccrual year runs on a fixed calendar schedule, starting on accrualYearStartOnMonth.
2EmploymentAnniversaryAccrual year is anchored to each employee's hire date.

Period Unit values

ValueName
1HoursWorked
2PayPeriod
3CalendarMonthFirstDay
4AccrualYearFirstDay
5CalendarMonthLastDay
6CalendarQuarterFirstDay
7CalendarQuarterLastDay
8RolloverYear_DailyAccruals

Legislative values

ValueName
1US
255Global

Example requests and their responses

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-policies`;

// Using a preset — call "List Time Off Policy Presets" first to get a presetId
const payload = {
  presetId: 1,
  name: "MY POLICY"
};

async function createTimeOffPolicy() {
  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());
}

createTimeOffPolicy();
curl -s -X POST "https://api.worklio.com/wep/companies/$CLIENT_ID/timeoff-policies" \
  -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 '{
    "presetId": 1,
    "name": "MY POLICY"
  }' | jq .
{
  "accrualYearType": 1,
  "accrualYearStartOnMonth": 1,
  "accrualStartOnDelay": 0,
  "accrualAvailableOnDelay": 90,
  "serviceYear": {
    "accrualAmount": 80,
    "periodLength": 1,
    "periodUnit": 4,
    "balanceLimit": 80,
    "rolloverLimit": 0
  },
  "employeeRules": [],
  "id": 61,
  "code": "PTO_1",
  "name": "MY POLICY",
  "payCodeType": 1,
  "legislative": 1
}
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-policies`;

// Using a preset — call "List Time Off Policy Presets" first to get a presetId
const payload = {
  presetId: 1,
  "name": "Standard PTO",
  "accrualYearType": 1,
  "accrualYearStartOnMonth": 1,
  "accrualStartOnDelay": 0,
  "accrualAvailableOnDelay": 90,
  "serviceYear": {
    "accrualAmount": 6.67,
    "periodLength": 1,
    "periodUnit": 2,
    "annualLimit": 80,
    "balanceLimit": 80,
    "rolloverLimit": 0
  },
  "legislative": 1
};

async function createTimeOffPolicy() {
  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());
}

createTimeOffPolicy();
curl -s -X POST "https://api.worklio.com/wep/companies/$CLIENT_ID/timeoff-policies" \
  -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 '{
    "presetId": 1,
    "name": "Standard PTO",
    "accrualYearType": 1,
    "accrualYearStartOnMonth": 1,
    "accrualStartOnDelay": 0,
    "accrualAvailableOnDelay": 90,
    "serviceYear": {
      "accrualAmount": 6.67,
      "periodLength": 1,
      "periodUnit": 2,
      "annualLimit": 80,
      "balanceLimit": 80,
      "rolloverLimit": 0
    },
    "legislative": 1
  }' | jq .
{
  "accrualYearType": 1,
  "accrualYearStartOnMonth": 1,
  "accrualStartOnDelay": 0,
  "accrualAvailableOnDelay": 90,
  "serviceYear": {
    "accrualAmount": 6.67,
    "periodLength": 1,
    "periodUnit": 2,
    "annualLimit": 80,
    "balanceLimit": 80,
    "rolloverLimit": 0
  },
  "employeeRules": [],
  "id": 62,
  "code": "PTO_2",
  "name": "Standard PTO",
  "payCodeType": 1,
  "legislative": 1
}

id is the policy's unique identifier — this is the POLICY_ID used in the other endpoints below, and what you'll assign employees to.

code is a short policy code Worklio generates automatically (e.g. PTO_1); it isn't a request field.

payCodeType identifies the pay code this policy's hours are transferred to in a payroll run. It's set from the preset (or company defaults) rather than passed directly in the request — it isn't in the request fields list above.


List Time Off Policies

GET https://api.worklio.com/wep/companies/{CLIENT_ID}/timeoff-policies

Returns an array of the company's time off policies.

Get Time Off Policy

GET https://api.worklio.com/wep/companies/{CLIENT_ID}/timeoff-policies/{POLICY_ID}

Returns a single policy by id.

Deactivate Time Off Policy

PUT https://api.worklio.com/wep/companies/{CLIENT_ID}/timeoff-policy-deactivations/{POLICY_ID}

Deactivates a policy. A successful call returns the deactivated policy.

List Time Off Policy Presets

GET https://api.worklio.com/wep/timeoff-policy-presets
require("dotenv").config();
const TOKEN = process.env.API_KEY
const CLIENT_ID = process.env.CLIENT_ID
const url  = `https://api.worklio.com/wep/timeoff-policy-presets`; 



async function listTimeoffPresets() {
  const response = await fetch(url, {
    method: "GET",
    headers: {
      accept: "application/json",
      "api-version": "2.0",
      authorization: `Bearer ${TOKEN}`,
      "content-type": "application/json",
      "x-api-version": "2.0"
    },
  });


  console.log(response.status);
  const raw = await response.text();
  console.log(JSON.stringify(JSON.parse(raw), null, 2));

}

listTimeoffPresets();

Example response

{
  "items": [
    {
      "id": 1,
      "name": "Vacation",
      "code": "PTO",
      "payCodeType": 1,
      "accrualYearType": 1,
      "accrualYearStartOnMonth": 1,
      "accrualStartOnDelay": 0,
      "accrualAvailableOnDelay": 90,
      "serviceYear": {
        "accrualAmount": 80,
        "periodLength": 1,
        "periodUnit": 4,
        "balanceLimit": 80,
        "rolloverLimit": 0
      }
    },
    {
      "id": 2,
      "name": "Sick Time",
      "code": "SICK",
      "payCodeType": 2,
      "accrualYearType": 1,
      "accrualYearStartOnMonth": 1,
      "accrualStartOnDelay": 0,
      "accrualAvailableOnDelay": 90,
      "serviceYear": {
        "accrualAmount": 24,
        "periodLength": 1,
        "periodUnit": 4,
        "balanceLimit": 24
      }
    },
    {
      "id": 3,
      "name": "Unpaid Time Off",
      "code": "UNPAID",
      "payCodeType": 4,
      "accrualYearType": 1,
      "accrualYearStartOnMonth": 1,
      "accrualStartOnDelay": 0,
      "accrualAvailableOnDelay": 90,
      "serviceYear": {
        "accrualAmount": 90,
        "periodLength": 1,
        "periodUnit": 4
      }
    },
    {
      "id": 4,
      "name": "TEST RULE",
      "code": "TEST",
      "payCodeType": 3,
      "accrualYearType": 2,
      "accrualStartOnDelay": 0,
      "accrualAvailableOnDelay": 0,
      "serviceYear": {
        "accrualAmount": 1,
        "periodLength": 1,
        "periodUnit": 1,
        "annualLimit": 1,
        "balanceLimit": 1
      }
    }
  ]
}

Returns the available presets and their policy values, for use as presetId when creating a policy.


Did this page help you?