Request time-off
curl --request POST \
--url https://a-char.com/api/v1/time-off/requests \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"start_date": "2023-12-25",
"end_date": "2023-12-25",
"policy_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"start_date_type": "FULL_DAY",
"end_date_type": "FULL_DAY",
"note": "<string>",
"employee_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"attachments": []
}
'import requests
url = "https://a-char.com/api/v1/time-off/requests"
payload = {
"start_date": "2023-12-25",
"end_date": "2023-12-25",
"policy_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"start_date_type": "FULL_DAY",
"end_date_type": "FULL_DAY",
"note": "<string>",
"employee_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"attachments": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
start_date: '2023-12-25',
end_date: '2023-12-25',
policy_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
start_date_type: 'FULL_DAY',
end_date_type: 'FULL_DAY',
note: '<string>',
employee_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
attachments: []
})
};
fetch('https://a-char.com/api/v1/time-off/requests', 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://a-char.com/api/v1/time-off/requests",
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([
'start_date' => '2023-12-25',
'end_date' => '2023-12-25',
'policy_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'start_date_type' => 'FULL_DAY',
'end_date_type' => 'FULL_DAY',
'note' => '<string>',
'employee_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'attachments' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://a-char.com/api/v1/time-off/requests"
payload := strings.NewReader("{\n \"start_date\": \"2023-12-25\",\n \"end_date\": \"2023-12-25\",\n \"policy_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"start_date_type\": \"FULL_DAY\",\n \"end_date_type\": \"FULL_DAY\",\n \"note\": \"<string>\",\n \"employee_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"attachments\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://a-char.com/api/v1/time-off/requests")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"start_date\": \"2023-12-25\",\n \"end_date\": \"2023-12-25\",\n \"policy_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"start_date_type\": \"FULL_DAY\",\n \"end_date_type\": \"FULL_DAY\",\n \"note\": \"<string>\",\n \"employee_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"attachments\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://a-char.com/api/v1/time-off/requests")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"start_date\": \"2023-12-25\",\n \"end_date\": \"2023-12-25\",\n \"policy_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"start_date_type\": \"FULL_DAY\",\n \"end_date_type\": \"FULL_DAY\",\n \"note\": \"<string>\",\n \"employee_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"attachments\": []\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}Time off requests
Request time-off
Creates a request and notifies the approvers, or approves it straight away when the policy needs no approval. Rejected when it would take the balance below zero, overlaps another request, misses the policy’s notice period, or falls outside the dates the employee may book — call GET /time-off/preview first to see the days and balance. attachments is optional: images and PDFs, 4 MB in total, sent as multipart/form-data with one attachments[] part per file. Defaults to the caller; employee_id requests for someone else and needs the admin role or being their approver. Requires the time-off:write scope.
POST
/
time-off
/
requests
Request time-off
curl --request POST \
--url https://a-char.com/api/v1/time-off/requests \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"start_date": "2023-12-25",
"end_date": "2023-12-25",
"policy_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"start_date_type": "FULL_DAY",
"end_date_type": "FULL_DAY",
"note": "<string>",
"employee_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"attachments": []
}
'import requests
url = "https://a-char.com/api/v1/time-off/requests"
payload = {
"start_date": "2023-12-25",
"end_date": "2023-12-25",
"policy_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"start_date_type": "FULL_DAY",
"end_date_type": "FULL_DAY",
"note": "<string>",
"employee_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"attachments": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
start_date: '2023-12-25',
end_date: '2023-12-25',
policy_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
start_date_type: 'FULL_DAY',
end_date_type: 'FULL_DAY',
note: '<string>',
employee_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
attachments: []
})
};
fetch('https://a-char.com/api/v1/time-off/requests', 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://a-char.com/api/v1/time-off/requests",
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([
'start_date' => '2023-12-25',
'end_date' => '2023-12-25',
'policy_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'start_date_type' => 'FULL_DAY',
'end_date_type' => 'FULL_DAY',
'note' => '<string>',
'employee_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'attachments' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://a-char.com/api/v1/time-off/requests"
payload := strings.NewReader("{\n \"start_date\": \"2023-12-25\",\n \"end_date\": \"2023-12-25\",\n \"policy_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"start_date_type\": \"FULL_DAY\",\n \"end_date_type\": \"FULL_DAY\",\n \"note\": \"<string>\",\n \"employee_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"attachments\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://a-char.com/api/v1/time-off/requests")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"start_date\": \"2023-12-25\",\n \"end_date\": \"2023-12-25\",\n \"policy_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"start_date_type\": \"FULL_DAY\",\n \"end_date_type\": \"FULL_DAY\",\n \"note\": \"<string>\",\n \"employee_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"attachments\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://a-char.com/api/v1/time-off/requests")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"start_date\": \"2023-12-25\",\n \"end_date\": \"2023-12-25\",\n \"policy_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"start_date_type\": \"FULL_DAY\",\n \"end_date_type\": \"FULL_DAY\",\n \"note\": \"<string>\",\n \"employee_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"attachments\": []\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/jsonmultipart/form-data
Available options:
FULL_DAY, AM, PM Available options:
FULL_DAY, AM, PM Maximum string length:
300Maximum array length:
10Response
201 - application/json
OK