curl --request POST \
--url https://api.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "<string>",
"accrual_month": 5,
"rule_amount": 123,
"accrual_anchor_date": "<string>",
"cycle_on_employment_start": false,
"rule_duration": 600,
"upfront_allocation": true,
"proration_basis": "month",
"max_carry_forward": 50000,
"carry_forward_expiry_months": 600,
"carry_forward_kept_after_expiry": 50000
}
'import requests
url = "https://api.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules"
payload = {
"name": "<string>",
"accrual_month": 5,
"rule_amount": 123,
"accrual_anchor_date": "<string>",
"cycle_on_employment_start": False,
"rule_duration": 600,
"upfront_allocation": True,
"proration_basis": "month",
"max_carry_forward": 50000,
"carry_forward_expiry_months": 600,
"carry_forward_kept_after_expiry": 50000
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
accrual_month: 5,
rule_amount: 123,
accrual_anchor_date: '<string>',
cycle_on_employment_start: false,
rule_duration: 600,
upfront_allocation: true,
proration_basis: 'month',
max_carry_forward: 50000,
carry_forward_expiry_months: 600,
carry_forward_kept_after_expiry: 50000
})
};
fetch('https://api.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules', 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.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules",
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([
'name' => '<string>',
'accrual_month' => 5,
'rule_amount' => 123,
'accrual_anchor_date' => '<string>',
'cycle_on_employment_start' => false,
'rule_duration' => 600,
'upfront_allocation' => true,
'proration_basis' => 'month',
'max_carry_forward' => 50000,
'carry_forward_expiry_months' => 600,
'carry_forward_kept_after_expiry' => 50000
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"accrual_month\": 5,\n \"rule_amount\": 123,\n \"accrual_anchor_date\": \"<string>\",\n \"cycle_on_employment_start\": false,\n \"rule_duration\": 600,\n \"upfront_allocation\": true,\n \"proration_basis\": \"month\",\n \"max_carry_forward\": 50000,\n \"carry_forward_expiry_months\": 600,\n \"carry_forward_kept_after_expiry\": 50000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<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.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"accrual_month\": 5,\n \"rule_amount\": 123,\n \"accrual_anchor_date\": \"<string>\",\n \"cycle_on_employment_start\": false,\n \"rule_duration\": 600,\n \"upfront_allocation\": true,\n \"proration_basis\": \"month\",\n \"max_carry_forward\": 50000,\n \"carry_forward_expiry_months\": 600,\n \"carry_forward_kept_after_expiry\": 50000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"accrual_month\": 5,\n \"rule_amount\": 123,\n \"accrual_anchor_date\": \"<string>\",\n \"cycle_on_employment_start\": false,\n \"rule_duration\": 600,\n \"upfront_allocation\": true,\n \"proration_basis\": \"month\",\n \"max_carry_forward\": 50000,\n \"carry_forward_expiry_months\": 600,\n \"carry_forward_kept_after_expiry\": 50000\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>"
}{
"code": "BAD_REQUEST",
"message": "Invalid input data",
"issues": []
}{
"code": "UNAUTHORIZED",
"message": "Authorization not provided",
"issues": []
}{
"code": "FORBIDDEN",
"message": "Insufficient access",
"issues": []
}{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error",
"issues": []
}Create a new allowance rule
Creates a new allowance rule for the given allowance type. Rules define how much allowance members receive and how it accrues (monthly or yearly).
curl --request POST \
--url https://api.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "<string>",
"accrual_month": 5,
"rule_amount": 123,
"accrual_anchor_date": "<string>",
"cycle_on_employment_start": false,
"rule_duration": 600,
"upfront_allocation": true,
"proration_basis": "month",
"max_carry_forward": 50000,
"carry_forward_expiry_months": 600,
"carry_forward_kept_after_expiry": 50000
}
'import requests
url = "https://api.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules"
payload = {
"name": "<string>",
"accrual_month": 5,
"rule_amount": 123,
"accrual_anchor_date": "<string>",
"cycle_on_employment_start": False,
"rule_duration": 600,
"upfront_allocation": True,
"proration_basis": "month",
"max_carry_forward": 50000,
"carry_forward_expiry_months": 600,
"carry_forward_kept_after_expiry": 50000
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
accrual_month: 5,
rule_amount: 123,
accrual_anchor_date: '<string>',
cycle_on_employment_start: false,
rule_duration: 600,
upfront_allocation: true,
proration_basis: 'month',
max_carry_forward: 50000,
carry_forward_expiry_months: 600,
carry_forward_kept_after_expiry: 50000
})
};
fetch('https://api.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules', 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.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules",
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([
'name' => '<string>',
'accrual_month' => 5,
'rule_amount' => 123,
'accrual_anchor_date' => '<string>',
'cycle_on_employment_start' => false,
'rule_duration' => 600,
'upfront_allocation' => true,
'proration_basis' => 'month',
'max_carry_forward' => 50000,
'carry_forward_expiry_months' => 600,
'carry_forward_kept_after_expiry' => 50000
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"accrual_month\": 5,\n \"rule_amount\": 123,\n \"accrual_anchor_date\": \"<string>\",\n \"cycle_on_employment_start\": false,\n \"rule_duration\": 600,\n \"upfront_allocation\": true,\n \"proration_basis\": \"month\",\n \"max_carry_forward\": 50000,\n \"carry_forward_expiry_months\": 600,\n \"carry_forward_kept_after_expiry\": 50000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<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.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"accrual_month\": 5,\n \"rule_amount\": 123,\n \"accrual_anchor_date\": \"<string>\",\n \"cycle_on_employment_start\": false,\n \"rule_duration\": 600,\n \"upfront_allocation\": true,\n \"proration_basis\": \"month\",\n \"max_carry_forward\": 50000,\n \"carry_forward_expiry_months\": 600,\n \"carry_forward_kept_after_expiry\": 50000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.absentify.com/api/v1/allowance-types/{allowance_type_id}/rules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"accrual_month\": 5,\n \"rule_amount\": 123,\n \"accrual_anchor_date\": \"<string>\",\n \"cycle_on_employment_start\": false,\n \"rule_duration\": 600,\n \"upfront_allocation\": true,\n \"proration_basis\": \"month\",\n \"max_carry_forward\": 50000,\n \"carry_forward_expiry_months\": 600,\n \"carry_forward_kept_after_expiry\": 50000\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>"
}{
"code": "BAD_REQUEST",
"message": "Invalid input data",
"issues": []
}{
"code": "UNAUTHORIZED",
"message": "Authorization not provided",
"issues": []
}{
"code": "FORBIDDEN",
"message": "Insufficient access",
"issues": []
}{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error",
"issues": []
}Authorizations
Path Parameters
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$Body
10 = January, 11 = December
0 <= x <= 11Allowance amount per accrual cycle, must be greater than 0. For day-based allowance types the value is in days; for hour-based allowance types the value is in MINUTES (e.g. 480 = 8 hours). A 0-amount (manual) rule is created by assigning a member to manage manually, not through this endpoint.
x <= 100000month, year, biweek Bi-weekly cycle anchor (YYYY-MM-DD); null = count from each member's start date
^\d{4}-\d{2}-\d{2}$Per-accrual rolling expiry: each accrual is valid for this many months from its accrual date, then expires automatically (like time off in lieu). Min 1; null = off. Cannot be combined with any carry-forward setting, and is not allowed on a 0-amount (manual) rule.
1 <= x <= 1200If true, full allowance is granted at start of cycle
How partial yearly rules are prorated. month = whole months count fully, the partial start or end month is prorated by day; day = calendar-day exact; full_month = only whole months count 1/12 each, a started month counts nothing; none = a rule year in which employment starts or ends grants the full yearly amount; every other partial year, such as a switch to another rule or an assignment that starts or ends during the year while employed, counts its months. Ignored for monthly and biweekly cycles. Defaults to month.
month, day, full_month, none Hard cap on the amount carried into the next fiscal year, applied at the year boundary. null = unlimited (everything carries), 0 = nothing carries. For hour-based allowance types the value is in MINUTES.
0 <= x <= 100000How long carried-forward allowance stays usable in the new fiscal year. null = it never expires; N (>= 1) = usable until the last day of the Nth month after the fiscal year end, then forfeited (except carry_forward_kept_after_expiry).
1 <= x <= 1200Amount of the carried-forward allowance that survives permanently after the expiry deadline. Only allowed when carry_forward_expiry_months is set; must be lower than max_carry_forward when both are set. null/0 = nothing survives. For hour-based allowance types the value is in MINUTES.
0 <= x <= 100000Response
Successful response
Was this page helpful?