Embedded HR
Create Accrual Policy Usage
Apply accrual usage (or a correction) for one or more employees under a given accrual policy.
POST
/
accrualPolicy
/
{policyCode}
/
usage
Create Accrual Policy Usage
curl --request POST \
--url https://api.zeal.com/accrualPolicy/{policyCode}/usage \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"companyID": "6181b78dba43479c8dc23f046b32bc28",
"employees": [
{
"employeeID": "66c7738bbabb2213d7628c02",
"start_date": "2024-12-10",
"end_date": "2024-12-11",
"amount": 4
}
]
}
'import requests
url = "https://api.zeal.com/accrualPolicy/{policyCode}/usage"
payload = {
"companyID": "6181b78dba43479c8dc23f046b32bc28",
"employees": [
{
"employeeID": "66c7738bbabb2213d7628c02",
"start_date": "2024-12-10",
"end_date": "2024-12-11",
"amount": 4
}
]
}
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: '6181b78dba43479c8dc23f046b32bc28',
employees: [
{
employeeID: '66c7738bbabb2213d7628c02',
start_date: '2024-12-10',
end_date: '2024-12-11',
amount: 4
}
]
})
};
fetch('https://api.zeal.com/accrualPolicy/{policyCode}/usage', 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/{policyCode}/usage",
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' => '6181b78dba43479c8dc23f046b32bc28',
'employees' => [
[
'employeeID' => '66c7738bbabb2213d7628c02',
'start_date' => '2024-12-10',
'end_date' => '2024-12-11',
'amount' => 4
]
]
]),
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/{policyCode}/usage"
payload := strings.NewReader("{\n \"companyID\": \"6181b78dba43479c8dc23f046b32bc28\",\n \"employees\": [\n {\n \"employeeID\": \"66c7738bbabb2213d7628c02\",\n \"start_date\": \"2024-12-10\",\n \"end_date\": \"2024-12-11\",\n \"amount\": 4\n }\n ]\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/{policyCode}/usage")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"companyID\": \"6181b78dba43479c8dc23f046b32bc28\",\n \"employees\": [\n {\n \"employeeID\": \"66c7738bbabb2213d7628c02\",\n \"start_date\": \"2024-12-10\",\n \"end_date\": \"2024-12-11\",\n \"amount\": 4\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zeal.com/accrualPolicy/{policyCode}/usage")
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\": \"6181b78dba43479c8dc23f046b32bc28\",\n \"employees\": [\n {\n \"employeeID\": \"66c7738bbabb2213d7628c02\",\n \"start_date\": \"2024-12-10\",\n \"end_date\": \"2024-12-11\",\n \"amount\": 4\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"companyID": "6181b78dba43479c8dc23f046b32bc28",
"policyID": "66c8cb269d0072479db7c7e",
"employeeID": "66c7738bbabb2213d7628c02",
"correction": false,
"amount": 4,
"start_date": "2024-12-10",
"end_date": "2024-12-11"
}
],
"success": true,
"testMode": true
}{
"success": false,
"errors": [
{
"message": "Accrual policy with this policy code not found",
"code": 109,
"status": 404,
"correlationId": "fedfd6fd-c689-40d1-8d80-f9e3c4efceba"
}
],
"testMode": true
}Authorizations
Path Parameters
The unique identifier for the accrual policy under which the usage is being applied
Body
application/json
Response
200
⌘I
Create Accrual Policy Usage
curl --request POST \
--url https://api.zeal.com/accrualPolicy/{policyCode}/usage \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"companyID": "6181b78dba43479c8dc23f046b32bc28",
"employees": [
{
"employeeID": "66c7738bbabb2213d7628c02",
"start_date": "2024-12-10",
"end_date": "2024-12-11",
"amount": 4
}
]
}
'import requests
url = "https://api.zeal.com/accrualPolicy/{policyCode}/usage"
payload = {
"companyID": "6181b78dba43479c8dc23f046b32bc28",
"employees": [
{
"employeeID": "66c7738bbabb2213d7628c02",
"start_date": "2024-12-10",
"end_date": "2024-12-11",
"amount": 4
}
]
}
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: '6181b78dba43479c8dc23f046b32bc28',
employees: [
{
employeeID: '66c7738bbabb2213d7628c02',
start_date: '2024-12-10',
end_date: '2024-12-11',
amount: 4
}
]
})
};
fetch('https://api.zeal.com/accrualPolicy/{policyCode}/usage', 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/{policyCode}/usage",
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' => '6181b78dba43479c8dc23f046b32bc28',
'employees' => [
[
'employeeID' => '66c7738bbabb2213d7628c02',
'start_date' => '2024-12-10',
'end_date' => '2024-12-11',
'amount' => 4
]
]
]),
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/{policyCode}/usage"
payload := strings.NewReader("{\n \"companyID\": \"6181b78dba43479c8dc23f046b32bc28\",\n \"employees\": [\n {\n \"employeeID\": \"66c7738bbabb2213d7628c02\",\n \"start_date\": \"2024-12-10\",\n \"end_date\": \"2024-12-11\",\n \"amount\": 4\n }\n ]\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/{policyCode}/usage")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"companyID\": \"6181b78dba43479c8dc23f046b32bc28\",\n \"employees\": [\n {\n \"employeeID\": \"66c7738bbabb2213d7628c02\",\n \"start_date\": \"2024-12-10\",\n \"end_date\": \"2024-12-11\",\n \"amount\": 4\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zeal.com/accrualPolicy/{policyCode}/usage")
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\": \"6181b78dba43479c8dc23f046b32bc28\",\n \"employees\": [\n {\n \"employeeID\": \"66c7738bbabb2213d7628c02\",\n \"start_date\": \"2024-12-10\",\n \"end_date\": \"2024-12-11\",\n \"amount\": 4\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"companyID": "6181b78dba43479c8dc23f046b32bc28",
"policyID": "66c8cb269d0072479db7c7e",
"employeeID": "66c7738bbabb2213d7628c02",
"correction": false,
"amount": 4,
"start_date": "2024-12-10",
"end_date": "2024-12-11"
}
],
"success": true,
"testMode": true
}{
"success": false,
"errors": [
{
"message": "Accrual policy with this policy code not found",
"code": 109,
"status": 404,
"correlationId": "fedfd6fd-c689-40d1-8d80-f9e3c4efceba"
}
],
"testMode": true
}