Update Accrual Policy
Update the configuration of an existing accrual policy, such as its accrual rate, caps, rollover rules, or status.
curl --request PATCH \
--url https://api.zeal.com/accrualPolicy \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"companyID": "123er534efrerwwe3444e",
"policy_code": "001",
"policy_type": "pto",
"policy_name": "Updated name",
"policy_effective_date": "2023-03-01",
"accrual_rate_hours": 10,
"accrual_period_hours": 40,
"immediate_balance": 50,
"include_doubletime": true,
"include_overtime": true,
"accrual_waiting_period": 0,
"accrual_cap": 50,
"rollover_cap": 90,
"rollover_date": "01-01",
"policy_status": "live"
}
'import requests
url = "https://api.zeal.com/accrualPolicy"
payload = {
"companyID": "123er534efrerwwe3444e",
"policy_code": "001",
"policy_type": "pto",
"policy_name": "Updated name",
"policy_effective_date": "2023-03-01",
"accrual_rate_hours": 10,
"accrual_period_hours": 40,
"immediate_balance": 50,
"include_doubletime": True,
"include_overtime": True,
"accrual_waiting_period": 0,
"accrual_cap": 50,
"rollover_cap": 90,
"rollover_date": "01-01",
"policy_status": "live"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
companyID: '123er534efrerwwe3444e',
policy_code: '001',
policy_type: 'pto',
policy_name: 'Updated name',
policy_effective_date: '2023-03-01',
accrual_rate_hours: 10,
accrual_period_hours: 40,
immediate_balance: 50,
include_doubletime: true,
include_overtime: true,
accrual_waiting_period: 0,
accrual_cap: 50,
rollover_cap: 90,
rollover_date: '01-01',
policy_status: 'live'
})
};
fetch('https://api.zeal.com/accrualPolicy', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.zeal.com/accrualPolicy",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'companyID' => '123er534efrerwwe3444e',
'policy_code' => '001',
'policy_type' => 'pto',
'policy_name' => 'Updated name',
'policy_effective_date' => '2023-03-01',
'accrual_rate_hours' => 10,
'accrual_period_hours' => 40,
'immediate_balance' => 50,
'include_doubletime' => true,
'include_overtime' => true,
'accrual_waiting_period' => 0,
'accrual_cap' => 50,
'rollover_cap' => 90,
'rollover_date' => '01-01',
'policy_status' => 'live'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.zeal.com/accrualPolicy"
payload := strings.NewReader("{\n \"companyID\": \"123er534efrerwwe3444e\",\n \"policy_code\": \"001\",\n \"policy_type\": \"pto\",\n \"policy_name\": \"Updated name\",\n \"policy_effective_date\": \"2023-03-01\",\n \"accrual_rate_hours\": 10,\n \"accrual_period_hours\": 40,\n \"immediate_balance\": 50,\n \"include_doubletime\": true,\n \"include_overtime\": true,\n \"accrual_waiting_period\": 0,\n \"accrual_cap\": 50,\n \"rollover_cap\": 90,\n \"rollover_date\": \"01-01\",\n \"policy_status\": \"live\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.zeal.com/accrualPolicy")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"companyID\": \"123er534efrerwwe3444e\",\n \"policy_code\": \"001\",\n \"policy_type\": \"pto\",\n \"policy_name\": \"Updated name\",\n \"policy_effective_date\": \"2023-03-01\",\n \"accrual_rate_hours\": 10,\n \"accrual_period_hours\": 40,\n \"immediate_balance\": 50,\n \"include_doubletime\": true,\n \"include_overtime\": true,\n \"accrual_waiting_period\": 0,\n \"accrual_cap\": 50,\n \"rollover_cap\": 90,\n \"rollover_date\": \"01-01\",\n \"policy_status\": \"live\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zeal.com/accrualPolicy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"companyID\": \"123er534efrerwwe3444e\",\n \"policy_code\": \"001\",\n \"policy_type\": \"pto\",\n \"policy_name\": \"Updated name\",\n \"policy_effective_date\": \"2023-03-01\",\n \"accrual_rate_hours\": 10,\n \"accrual_period_hours\": 40,\n \"immediate_balance\": 50,\n \"include_doubletime\": true,\n \"include_overtime\": true,\n \"accrual_waiting_period\": 0,\n \"accrual_cap\": 50,\n \"rollover_cap\": 90,\n \"rollover_date\": \"01-01\",\n \"policy_status\": \"live\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"companyID": "123er534efrerwwe3444e",
"policy_code": "001",
"policy_type": "pto",
"policy_name": "Updated name",
"policy_effective_date": "2023-03-01",
"accrual_rate_hours": 10,
"accrual_period_hours": 40,
"immediate_balance": 50,
"include_doubletime": true,
"include_overtime": true,
"accrual_waiting_period": 0,
"accrual_cap": 100,
"rollover_cap": 90,
"rollover_date": "01-01",
"policy_status": "live",
"balance_cap": 100
}
}{
"success": false,
"error": true,
"message": "Accrual policy with this policy code not found",
"timestamp": "2023-03-21T19:13:18Z"
}Authorizations
Body
ID of the company
Unique code assigned to the policy
Type of the accrual policy (accepts: pto, sick_leave, or custom)
The effective start date of the policy
The rate at which employees will accrue hours
The number of hours employees need to work to accrue accrual_rate_hours
The initial or immediate hour balance of policy
Include if doubletime work is eligible for hour accrual
Include if overtime work is eligible for hour accrual
The number of hours the employees need to work before they are eligible to begin accruing time for policy
Max hours an employee can accrue in one calendar year
Max hours an employee can rollover from one year to the next year, on specified rollover date
Required if user passes a value for rollover_cap
The status of the policy (accepts live or terminated)
Include if flat earning component is eligible for accrual
The maximum balance an employee is allowed to hold under this policy
curl --request PATCH \
--url https://api.zeal.com/accrualPolicy \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"companyID": "123er534efrerwwe3444e",
"policy_code": "001",
"policy_type": "pto",
"policy_name": "Updated name",
"policy_effective_date": "2023-03-01",
"accrual_rate_hours": 10,
"accrual_period_hours": 40,
"immediate_balance": 50,
"include_doubletime": true,
"include_overtime": true,
"accrual_waiting_period": 0,
"accrual_cap": 50,
"rollover_cap": 90,
"rollover_date": "01-01",
"policy_status": "live"
}
'import requests
url = "https://api.zeal.com/accrualPolicy"
payload = {
"companyID": "123er534efrerwwe3444e",
"policy_code": "001",
"policy_type": "pto",
"policy_name": "Updated name",
"policy_effective_date": "2023-03-01",
"accrual_rate_hours": 10,
"accrual_period_hours": 40,
"immediate_balance": 50,
"include_doubletime": True,
"include_overtime": True,
"accrual_waiting_period": 0,
"accrual_cap": 50,
"rollover_cap": 90,
"rollover_date": "01-01",
"policy_status": "live"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
companyID: '123er534efrerwwe3444e',
policy_code: '001',
policy_type: 'pto',
policy_name: 'Updated name',
policy_effective_date: '2023-03-01',
accrual_rate_hours: 10,
accrual_period_hours: 40,
immediate_balance: 50,
include_doubletime: true,
include_overtime: true,
accrual_waiting_period: 0,
accrual_cap: 50,
rollover_cap: 90,
rollover_date: '01-01',
policy_status: 'live'
})
};
fetch('https://api.zeal.com/accrualPolicy', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.zeal.com/accrualPolicy",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'companyID' => '123er534efrerwwe3444e',
'policy_code' => '001',
'policy_type' => 'pto',
'policy_name' => 'Updated name',
'policy_effective_date' => '2023-03-01',
'accrual_rate_hours' => 10,
'accrual_period_hours' => 40,
'immediate_balance' => 50,
'include_doubletime' => true,
'include_overtime' => true,
'accrual_waiting_period' => 0,
'accrual_cap' => 50,
'rollover_cap' => 90,
'rollover_date' => '01-01',
'policy_status' => 'live'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.zeal.com/accrualPolicy"
payload := strings.NewReader("{\n \"companyID\": \"123er534efrerwwe3444e\",\n \"policy_code\": \"001\",\n \"policy_type\": \"pto\",\n \"policy_name\": \"Updated name\",\n \"policy_effective_date\": \"2023-03-01\",\n \"accrual_rate_hours\": 10,\n \"accrual_period_hours\": 40,\n \"immediate_balance\": 50,\n \"include_doubletime\": true,\n \"include_overtime\": true,\n \"accrual_waiting_period\": 0,\n \"accrual_cap\": 50,\n \"rollover_cap\": 90,\n \"rollover_date\": \"01-01\",\n \"policy_status\": \"live\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.zeal.com/accrualPolicy")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"companyID\": \"123er534efrerwwe3444e\",\n \"policy_code\": \"001\",\n \"policy_type\": \"pto\",\n \"policy_name\": \"Updated name\",\n \"policy_effective_date\": \"2023-03-01\",\n \"accrual_rate_hours\": 10,\n \"accrual_period_hours\": 40,\n \"immediate_balance\": 50,\n \"include_doubletime\": true,\n \"include_overtime\": true,\n \"accrual_waiting_period\": 0,\n \"accrual_cap\": 50,\n \"rollover_cap\": 90,\n \"rollover_date\": \"01-01\",\n \"policy_status\": \"live\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zeal.com/accrualPolicy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"companyID\": \"123er534efrerwwe3444e\",\n \"policy_code\": \"001\",\n \"policy_type\": \"pto\",\n \"policy_name\": \"Updated name\",\n \"policy_effective_date\": \"2023-03-01\",\n \"accrual_rate_hours\": 10,\n \"accrual_period_hours\": 40,\n \"immediate_balance\": 50,\n \"include_doubletime\": true,\n \"include_overtime\": true,\n \"accrual_waiting_period\": 0,\n \"accrual_cap\": 50,\n \"rollover_cap\": 90,\n \"rollover_date\": \"01-01\",\n \"policy_status\": \"live\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"companyID": "123er534efrerwwe3444e",
"policy_code": "001",
"policy_type": "pto",
"policy_name": "Updated name",
"policy_effective_date": "2023-03-01",
"accrual_rate_hours": 10,
"accrual_period_hours": 40,
"immediate_balance": 50,
"include_doubletime": true,
"include_overtime": true,
"accrual_waiting_period": 0,
"accrual_cap": 100,
"rollover_cap": 90,
"rollover_date": "01-01",
"policy_status": "live",
"balance_cap": 100
}
}{
"success": false,
"error": true,
"message": "Accrual policy with this policy code not found",
"timestamp": "2023-03-21T19:13:18Z"
}