Create Accrual Policy
Create a new PTO, sick leave, or custom accrual policy for a company.
curl --request POST \
--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": "test name",
"policy_effective_date": "2023-03-01",
"accrual_rate_hours": 10,
"accrual_period_hours": 40,
"immediate_balance": 0,
"include_doubletime": true,
"include_overtime": true,
"accrual_waiting_period": 0,
"accrual_cap": 40,
"rollover_cap": 40,
"rollover_date": "01-01"
}
'import requests
url = "https://api.zeal.com/accrualPolicy"
payload = {
"companyID": "123er534efrerwwe3444e",
"policy_code": "001",
"policy_type": "pto",
"policy_name": "test name",
"policy_effective_date": "2023-03-01",
"accrual_rate_hours": 10,
"accrual_period_hours": 40,
"immediate_balance": 0,
"include_doubletime": True,
"include_overtime": True,
"accrual_waiting_period": 0,
"accrual_cap": 40,
"rollover_cap": 40,
"rollover_date": "01-01"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
companyID: '123er534efrerwwe3444e',
policy_code: '001',
policy_type: 'pto',
policy_name: 'test name',
policy_effective_date: '2023-03-01',
accrual_rate_hours: 10,
accrual_period_hours: 40,
immediate_balance: 0,
include_doubletime: true,
include_overtime: true,
accrual_waiting_period: 0,
accrual_cap: 40,
rollover_cap: 40,
rollover_date: '01-01'
})
};
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 => "POST",
CURLOPT_POSTFIELDS => json_encode([
'companyID' => '123er534efrerwwe3444e',
'policy_code' => '001',
'policy_type' => 'pto',
'policy_name' => 'test name',
'policy_effective_date' => '2023-03-01',
'accrual_rate_hours' => 10,
'accrual_period_hours' => 40,
'immediate_balance' => 0,
'include_doubletime' => true,
'include_overtime' => true,
'accrual_waiting_period' => 0,
'accrual_cap' => 40,
'rollover_cap' => 40,
'rollover_date' => '01-01'
]),
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\": \"test name\",\n \"policy_effective_date\": \"2023-03-01\",\n \"accrual_rate_hours\": 10,\n \"accrual_period_hours\": 40,\n \"immediate_balance\": 0,\n \"include_doubletime\": true,\n \"include_overtime\": true,\n \"accrual_waiting_period\": 0,\n \"accrual_cap\": 40,\n \"rollover_cap\": 40,\n \"rollover_date\": \"01-01\"\n}")
req, _ := http.NewRequest("POST", 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.post("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\": \"test name\",\n \"policy_effective_date\": \"2023-03-01\",\n \"accrual_rate_hours\": 10,\n \"accrual_period_hours\": 40,\n \"immediate_balance\": 0,\n \"include_doubletime\": true,\n \"include_overtime\": true,\n \"accrual_waiting_period\": 0,\n \"accrual_cap\": 40,\n \"rollover_cap\": 40,\n \"rollover_date\": \"01-01\"\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::Post.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\": \"test name\",\n \"policy_effective_date\": \"2023-03-01\",\n \"accrual_rate_hours\": 10,\n \"accrual_period_hours\": 40,\n \"immediate_balance\": 0,\n \"include_doubletime\": true,\n \"include_overtime\": true,\n \"accrual_waiting_period\": 0,\n \"accrual_cap\": 40,\n \"rollover_cap\": 40,\n \"rollover_date\": \"01-01\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"companyID": "123er534efrerwwe3444e",
"policy_type": "pto",
"policy_name": "test name",
"policy_code": "001",
"policy_effective_date": "2023-03-20",
"accrual_rate_hours": 0.5,
"accrual_period_hours": 10,
"immediate_balance": 10,
"include_doubletime": false,
"include_overtime": false,
"accrual_waiting_period": 28,
"accrual_cap": 50,
"rollover_cap": 20,
"rollover_date": "05-01",
"policy_status": "live",
"balance_cap": 50
}
}{
"success": false,
"error": true,
"message": "No company with this companyID exists.",
"timestamp": "2023-03-21T19:13:18Z"
}Authorizations
Body
ID of the company
Unique code to assign to this policy
Type of the accrual policy (accepts: pto, sick_leave, or custom)
The rate at which employees will accrue hours
The number of hours employees need to work to accrue accrual_rate_hours
Include if doubletime work is eligible for hour accrual
Include if overtime work is eligible for hour accrual
Custom name that can be assigned for the policy
The effective start date of the policy
The initial or immediate hour balance of policy
The number of hours the employees need to work before they are eligible to begin accruing time for policy
The maximum number of hours an employee can accrue within a policy year. Once this limit is reached, no additional hours will accrue until the next accrual period or rollover_date.
The maximum number of unused hours an employee is allowed to carry over from one policy year to the next on the specified rollover date.
Required if user passes a value for rollover_cap or accrual_cap
The maximum balance an employee is allowed to hold under this policy
curl --request POST \
--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": "test name",
"policy_effective_date": "2023-03-01",
"accrual_rate_hours": 10,
"accrual_period_hours": 40,
"immediate_balance": 0,
"include_doubletime": true,
"include_overtime": true,
"accrual_waiting_period": 0,
"accrual_cap": 40,
"rollover_cap": 40,
"rollover_date": "01-01"
}
'import requests
url = "https://api.zeal.com/accrualPolicy"
payload = {
"companyID": "123er534efrerwwe3444e",
"policy_code": "001",
"policy_type": "pto",
"policy_name": "test name",
"policy_effective_date": "2023-03-01",
"accrual_rate_hours": 10,
"accrual_period_hours": 40,
"immediate_balance": 0,
"include_doubletime": True,
"include_overtime": True,
"accrual_waiting_period": 0,
"accrual_cap": 40,
"rollover_cap": 40,
"rollover_date": "01-01"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
companyID: '123er534efrerwwe3444e',
policy_code: '001',
policy_type: 'pto',
policy_name: 'test name',
policy_effective_date: '2023-03-01',
accrual_rate_hours: 10,
accrual_period_hours: 40,
immediate_balance: 0,
include_doubletime: true,
include_overtime: true,
accrual_waiting_period: 0,
accrual_cap: 40,
rollover_cap: 40,
rollover_date: '01-01'
})
};
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 => "POST",
CURLOPT_POSTFIELDS => json_encode([
'companyID' => '123er534efrerwwe3444e',
'policy_code' => '001',
'policy_type' => 'pto',
'policy_name' => 'test name',
'policy_effective_date' => '2023-03-01',
'accrual_rate_hours' => 10,
'accrual_period_hours' => 40,
'immediate_balance' => 0,
'include_doubletime' => true,
'include_overtime' => true,
'accrual_waiting_period' => 0,
'accrual_cap' => 40,
'rollover_cap' => 40,
'rollover_date' => '01-01'
]),
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\": \"test name\",\n \"policy_effective_date\": \"2023-03-01\",\n \"accrual_rate_hours\": 10,\n \"accrual_period_hours\": 40,\n \"immediate_balance\": 0,\n \"include_doubletime\": true,\n \"include_overtime\": true,\n \"accrual_waiting_period\": 0,\n \"accrual_cap\": 40,\n \"rollover_cap\": 40,\n \"rollover_date\": \"01-01\"\n}")
req, _ := http.NewRequest("POST", 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.post("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\": \"test name\",\n \"policy_effective_date\": \"2023-03-01\",\n \"accrual_rate_hours\": 10,\n \"accrual_period_hours\": 40,\n \"immediate_balance\": 0,\n \"include_doubletime\": true,\n \"include_overtime\": true,\n \"accrual_waiting_period\": 0,\n \"accrual_cap\": 40,\n \"rollover_cap\": 40,\n \"rollover_date\": \"01-01\"\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::Post.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\": \"test name\",\n \"policy_effective_date\": \"2023-03-01\",\n \"accrual_rate_hours\": 10,\n \"accrual_period_hours\": 40,\n \"immediate_balance\": 0,\n \"include_doubletime\": true,\n \"include_overtime\": true,\n \"accrual_waiting_period\": 0,\n \"accrual_cap\": 40,\n \"rollover_cap\": 40,\n \"rollover_date\": \"01-01\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"companyID": "123er534efrerwwe3444e",
"policy_type": "pto",
"policy_name": "test name",
"policy_code": "001",
"policy_effective_date": "2023-03-20",
"accrual_rate_hours": 0.5,
"accrual_period_hours": 10,
"immediate_balance": 10,
"include_doubletime": false,
"include_overtime": false,
"accrual_waiting_period": 28,
"accrual_cap": 50,
"rollover_cap": 20,
"rollover_date": "05-01",
"policy_status": "live",
"balance_cap": 50
}
}{
"success": false,
"error": true,
"message": "No company with this companyID exists.",
"timestamp": "2023-03-21T19:13:18Z"
}