curl --request POST \
--url https://api.absentify.com/api/v1/leave_types \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "<string>",
"color": "<string>",
"needs_approval": true,
"maximum_absent": true,
"position": 123,
"take_from_allowance": true,
"privacy_hide_leavetype": true,
"outlook_synchronization_subject": "<string>",
"reason_mandatory": true,
"reason_hint_text": "<string>",
"allowance_type_id": "<string>",
"ignore_schedule": true,
"ignore_public_holidays": true,
"reason_visibility_public": true,
"counts_as_leave": true,
"allow_representative_overlap": false,
"allow_request_changes": true,
"request_shortening_needs_approval": false,
"request_cancellation_needs_approval": false,
"translations": [
{
"name": "<string>"
}
]
}
'import requests
url = "https://api.absentify.com/api/v1/leave_types"
payload = {
"name": "<string>",
"color": "<string>",
"needs_approval": True,
"maximum_absent": True,
"position": 123,
"take_from_allowance": True,
"privacy_hide_leavetype": True,
"outlook_synchronization_subject": "<string>",
"reason_mandatory": True,
"reason_hint_text": "<string>",
"allowance_type_id": "<string>",
"ignore_schedule": True,
"ignore_public_holidays": True,
"reason_visibility_public": True,
"counts_as_leave": True,
"allow_representative_overlap": False,
"allow_request_changes": True,
"request_shortening_needs_approval": False,
"request_cancellation_needs_approval": False,
"translations": [{ "name": "<string>" }]
}
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>',
color: '<string>',
needs_approval: true,
maximum_absent: true,
position: 123,
take_from_allowance: true,
privacy_hide_leavetype: true,
outlook_synchronization_subject: '<string>',
reason_mandatory: true,
reason_hint_text: '<string>',
allowance_type_id: '<string>',
ignore_schedule: true,
ignore_public_holidays: true,
reason_visibility_public: true,
counts_as_leave: true,
allow_representative_overlap: false,
allow_request_changes: true,
request_shortening_needs_approval: false,
request_cancellation_needs_approval: false,
translations: [{name: '<string>'}]
})
};
fetch('https://api.absentify.com/api/v1/leave_types', 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/leave_types",
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>',
'color' => '<string>',
'needs_approval' => true,
'maximum_absent' => true,
'position' => 123,
'take_from_allowance' => true,
'privacy_hide_leavetype' => true,
'outlook_synchronization_subject' => '<string>',
'reason_mandatory' => true,
'reason_hint_text' => '<string>',
'allowance_type_id' => '<string>',
'ignore_schedule' => true,
'ignore_public_holidays' => true,
'reason_visibility_public' => true,
'counts_as_leave' => true,
'allow_representative_overlap' => false,
'allow_request_changes' => true,
'request_shortening_needs_approval' => false,
'request_cancellation_needs_approval' => false,
'translations' => [
[
'name' => '<string>'
]
]
]),
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/leave_types"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"color\": \"<string>\",\n \"needs_approval\": true,\n \"maximum_absent\": true,\n \"position\": 123,\n \"take_from_allowance\": true,\n \"privacy_hide_leavetype\": true,\n \"outlook_synchronization_subject\": \"<string>\",\n \"reason_mandatory\": true,\n \"reason_hint_text\": \"<string>\",\n \"allowance_type_id\": \"<string>\",\n \"ignore_schedule\": true,\n \"ignore_public_holidays\": true,\n \"reason_visibility_public\": true,\n \"counts_as_leave\": true,\n \"allow_representative_overlap\": false,\n \"allow_request_changes\": true,\n \"request_shortening_needs_approval\": false,\n \"request_cancellation_needs_approval\": false,\n \"translations\": [\n {\n \"name\": \"<string>\"\n }\n ]\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/leave_types")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"color\": \"<string>\",\n \"needs_approval\": true,\n \"maximum_absent\": true,\n \"position\": 123,\n \"take_from_allowance\": true,\n \"privacy_hide_leavetype\": true,\n \"outlook_synchronization_subject\": \"<string>\",\n \"reason_mandatory\": true,\n \"reason_hint_text\": \"<string>\",\n \"allowance_type_id\": \"<string>\",\n \"ignore_schedule\": true,\n \"ignore_public_holidays\": true,\n \"reason_visibility_public\": true,\n \"counts_as_leave\": true,\n \"allow_representative_overlap\": false,\n \"allow_request_changes\": true,\n \"request_shortening_needs_approval\": false,\n \"request_cancellation_needs_approval\": false,\n \"translations\": [\n {\n \"name\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.absentify.com/api/v1/leave_types")
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 \"color\": \"<string>\",\n \"needs_approval\": true,\n \"maximum_absent\": true,\n \"position\": 123,\n \"take_from_allowance\": true,\n \"privacy_hide_leavetype\": true,\n \"outlook_synchronization_subject\": \"<string>\",\n \"reason_mandatory\": true,\n \"reason_hint_text\": \"<string>\",\n \"allowance_type_id\": \"<string>\",\n \"ignore_schedule\": true,\n \"ignore_public_holidays\": true,\n \"reason_visibility_public\": true,\n \"counts_as_leave\": true,\n \"allow_representative_overlap\": false,\n \"allow_request_changes\": true,\n \"request_shortening_needs_approval\": false,\n \"request_cancellation_needs_approval\": false,\n \"translations\": [\n {\n \"name\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body"3c90c3cc-0d44-4b50-8888-8dd25736052a"{
"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 leave type
Create a leave type
curl --request POST \
--url https://api.absentify.com/api/v1/leave_types \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "<string>",
"color": "<string>",
"needs_approval": true,
"maximum_absent": true,
"position": 123,
"take_from_allowance": true,
"privacy_hide_leavetype": true,
"outlook_synchronization_subject": "<string>",
"reason_mandatory": true,
"reason_hint_text": "<string>",
"allowance_type_id": "<string>",
"ignore_schedule": true,
"ignore_public_holidays": true,
"reason_visibility_public": true,
"counts_as_leave": true,
"allow_representative_overlap": false,
"allow_request_changes": true,
"request_shortening_needs_approval": false,
"request_cancellation_needs_approval": false,
"translations": [
{
"name": "<string>"
}
]
}
'import requests
url = "https://api.absentify.com/api/v1/leave_types"
payload = {
"name": "<string>",
"color": "<string>",
"needs_approval": True,
"maximum_absent": True,
"position": 123,
"take_from_allowance": True,
"privacy_hide_leavetype": True,
"outlook_synchronization_subject": "<string>",
"reason_mandatory": True,
"reason_hint_text": "<string>",
"allowance_type_id": "<string>",
"ignore_schedule": True,
"ignore_public_holidays": True,
"reason_visibility_public": True,
"counts_as_leave": True,
"allow_representative_overlap": False,
"allow_request_changes": True,
"request_shortening_needs_approval": False,
"request_cancellation_needs_approval": False,
"translations": [{ "name": "<string>" }]
}
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>',
color: '<string>',
needs_approval: true,
maximum_absent: true,
position: 123,
take_from_allowance: true,
privacy_hide_leavetype: true,
outlook_synchronization_subject: '<string>',
reason_mandatory: true,
reason_hint_text: '<string>',
allowance_type_id: '<string>',
ignore_schedule: true,
ignore_public_holidays: true,
reason_visibility_public: true,
counts_as_leave: true,
allow_representative_overlap: false,
allow_request_changes: true,
request_shortening_needs_approval: false,
request_cancellation_needs_approval: false,
translations: [{name: '<string>'}]
})
};
fetch('https://api.absentify.com/api/v1/leave_types', 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/leave_types",
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>',
'color' => '<string>',
'needs_approval' => true,
'maximum_absent' => true,
'position' => 123,
'take_from_allowance' => true,
'privacy_hide_leavetype' => true,
'outlook_synchronization_subject' => '<string>',
'reason_mandatory' => true,
'reason_hint_text' => '<string>',
'allowance_type_id' => '<string>',
'ignore_schedule' => true,
'ignore_public_holidays' => true,
'reason_visibility_public' => true,
'counts_as_leave' => true,
'allow_representative_overlap' => false,
'allow_request_changes' => true,
'request_shortening_needs_approval' => false,
'request_cancellation_needs_approval' => false,
'translations' => [
[
'name' => '<string>'
]
]
]),
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/leave_types"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"color\": \"<string>\",\n \"needs_approval\": true,\n \"maximum_absent\": true,\n \"position\": 123,\n \"take_from_allowance\": true,\n \"privacy_hide_leavetype\": true,\n \"outlook_synchronization_subject\": \"<string>\",\n \"reason_mandatory\": true,\n \"reason_hint_text\": \"<string>\",\n \"allowance_type_id\": \"<string>\",\n \"ignore_schedule\": true,\n \"ignore_public_holidays\": true,\n \"reason_visibility_public\": true,\n \"counts_as_leave\": true,\n \"allow_representative_overlap\": false,\n \"allow_request_changes\": true,\n \"request_shortening_needs_approval\": false,\n \"request_cancellation_needs_approval\": false,\n \"translations\": [\n {\n \"name\": \"<string>\"\n }\n ]\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/leave_types")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"color\": \"<string>\",\n \"needs_approval\": true,\n \"maximum_absent\": true,\n \"position\": 123,\n \"take_from_allowance\": true,\n \"privacy_hide_leavetype\": true,\n \"outlook_synchronization_subject\": \"<string>\",\n \"reason_mandatory\": true,\n \"reason_hint_text\": \"<string>\",\n \"allowance_type_id\": \"<string>\",\n \"ignore_schedule\": true,\n \"ignore_public_holidays\": true,\n \"reason_visibility_public\": true,\n \"counts_as_leave\": true,\n \"allow_representative_overlap\": false,\n \"allow_request_changes\": true,\n \"request_shortening_needs_approval\": false,\n \"request_cancellation_needs_approval\": false,\n \"translations\": [\n {\n \"name\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.absentify.com/api/v1/leave_types")
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 \"color\": \"<string>\",\n \"needs_approval\": true,\n \"maximum_absent\": true,\n \"position\": 123,\n \"take_from_allowance\": true,\n \"privacy_hide_leavetype\": true,\n \"outlook_synchronization_subject\": \"<string>\",\n \"reason_mandatory\": true,\n \"reason_hint_text\": \"<string>\",\n \"allowance_type_id\": \"<string>\",\n \"ignore_schedule\": true,\n \"ignore_public_holidays\": true,\n \"reason_visibility_public\": true,\n \"counts_as_leave\": true,\n \"allow_representative_overlap\": false,\n \"allow_request_changes\": true,\n \"request_shortening_needs_approval\": false,\n \"request_cancellation_needs_approval\": false,\n \"translations\": [\n {\n \"name\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body"3c90c3cc-0d44-4b50-8888-8dd25736052a"{
"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": []
}Body
When take_from_allowance is true, the unit follows the allowance: an hour or minute unit is saved as days for a days-based allowance, and days or half_days is saved as hours for an hours-based allowance.
days, half_days, hours, minutes_30, minutes_15, minutes_10, minutes_5, minutes_1 NoIcon, Umbrella, Anchor, Archive, Award, Briefcase, Calendar, Cast, Clock, Coffee, Compass, Battery, Emoji, Gift, Frown, Image, Sun, Home, Zap, Users, TreePalm, Plane, Luggage, Tent, Mountain, Bike, Waves, Snowflake, Ship, Map, Camera, Sunset, Thermometer, Pill, Stethoscope, HeartPulse, Hospital, Bandage, Brain, Syringe, Bed, Ambulance, Eye, Accessibility, Activity, Baby, Heart, HeartHandshake, Dog, Truck, Milk, HandHeart, ToyBrick, Cake, Laptop, Building2, Presentation, Car, TrainFront, RotateCcw, Headset, Phone, HardHat, Wrench, Globe, MapPin, GraduationCap, BookOpen, School, Languages, Lightbulb, PenLine, PartyPopper, Gem, Flower2, Landmark, Vote, Shield, Church, HandHelping, Scale, Siren, Trophy, Star, Timer, Hourglass, CalendarOff, Moon, AlarmClock, Sunrise, CalendarDays, CalendarHeart, Megaphone, CloudLightning, Leaf, Lock, Ban, CircleHelp Shortening an approved request needs approval from its approvers when this is on. Off by default: a shortened request applies at once and the days go back to the allowance. Extending or moving always needs approval. When request_cancellation_needs_approval is on and the leave type needs approval (and the cancellation approval feature is on for the workspace), the requester's own shortening needs approval too, whatever this is set to; the stored value is kept. For admins and managers of the requester, shortening follows this setting alone.
A stored setting. It takes effect only when the cancellation approval feature is on for the workspace and the leave type needs approval: then a member who cancels their own approved request (before it starts) asks their approvers instead, and the final approval cancels it. Through the API the requester has to send accepts_cancellation_request: true to POST /requests/{id}/cancel to ask; when nobody other than the requester would have to approve, the request is cancelled at once. An admin, or a manager cancelling for someone in their department, always cancels at once. While it takes effect, the requester's own shortening of an approved request and switch to a leave type without approval need approval too; admins and managers are not affected. Turning it on without the feature is rejected with 403.
Response
Successful response
The response is of type string<uuid>.
^([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})$Was this page helpful?