Embedded HR
Create Accrual Policy
Create a new PTO, sick leave, or custom accrual policy for a company.
POST
/
accrualPolicy
Create Accrual 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"
}Body
application/json
⌘I
Create Accrual 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"
}