Request and approve leave
Make a request, read it with its days counted, decide it, cancel it and see the balance move.
On this page
Leave is a request that waits for a decision. The API counts the days, checks the balance and knows who decides, so your screen only has to show what it returns. Leave kinds and balances says what is counted.
Make the request
Request leave names the person, the kind and the first and last day. A note is for the approver.
curl
curl -X POST "$RDC_BASE_URL/hr/v1/leave-requests" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"employeeId": "1ae6d1c6-00ec-4dfc-82b8-c19a68bc30cd",
"kind": "annual",
"from": "2026-12-14",
"to": "2026-12-16",
"note": "A family event.",
"operationId": "ad35c814-b5ca-467a-9381-c08f55aa20f7"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/hr/v1/leave-requests`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"employeeId": "1ae6d1c6-00ec-4dfc-82b8-c19a68bc30cd",
"kind": "annual",
"from": "2026-12-14",
"to": "2026-12-16",
"note": "A family event.",
"operationId": "ad35c814-b5ca-467a-9381-c08f55aa20f7"
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/hr/v1/leave-requests',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'employeeId': '1ae6d1c6-00ec-4dfc-82b8-c19a68bc30cd',
'kind': 'annual',
'from': '2026-12-14',
'to': '2026-12-16',
'note': 'A family event.',
'operationId': 'ad35c814-b5ca-467a-9381-c08f55aa20f7',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"employeeId": "1ae6d1c6-00ec-4dfc-82b8-c19a68bc30cd",
"kind": "annual",
"from": "2026-12-14",
"to": "2026-12-16",
"note": "A family event.",
"operationId": "ad35c814-b5ca-467a-9381-c08f55aa20f7"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/hr/v1/leave-requests');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/hr/v1/leave-requests");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"employeeId": "1ae6d1c6-00ec-4dfc-82b8-c19a68bc30cd",
"kind": "annual",
"from": "2026-12-14",
"to": "2026-12-16",
"note": "A family event.",
"operationId": "ad35c814-b5ca-467a-9381-c08f55aa20f7"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "ad35c814-b5ca-467a-9381-c08f55aa20f7",
"status": "accepted",
"aggregateRevision": 1
} The answer is the operation result. The request now exists as pending, with its days counted (3, from Monday 14 to Wednesday 16 December), the balanceAfter it leaves and the approverId of the manager of the person. Nothing is taken from the balance yet.
curl
curl "$RDC_BASE_URL/hr/v1/leave-requests/64ea18ca-94e2-4c6e-898b-adff492e472d" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/hr/v1/leave-requests/64ea18ca-94e2-4c6e-898b-adff492e472d`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
},
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'GET',
f'{os.environ["RDC_BASE_URL"]}/hr/v1/leave-requests/64ea18ca-94e2-4c6e-898b-adff492e472d',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/hr/v1/leave-requests/64ea18ca-94e2-4c6e-898b-adff492e472d');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/hr/v1/leave-requests/64ea18ca-94e2-4c6e-898b-adff492e472d");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"id": "64ea18ca-94e2-4c6e-898b-adff492e472d",
"number": "LR-2026-1050",
"employeeId": "1ae6d1c6-00ec-4dfc-82b8-c19a68bc30cd",
"kind": "annual",
"from": "2026-12-14",
"to": "2026-12-16",
"days": 3,
"balanceAfter": 6,
"approverId": "46419e0c-a16f-4e44-bed0-0b9700635fd6",
"status": "pending",
"note": "A family event.",
"reason": null,
"teamAway": null,
"revision": 1
} What the approver sees
The request of Radu Ionescu covers the week of 30 November. Two of his teammates are on approved leave on 2 December, so teamAway names that day and them. The hint informs the decision and does not make it.
curl
curl "$RDC_BASE_URL/hr/v1/leave-requests/bd9ccb68-cdef-4ec9-b852-dfa82203a948" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/hr/v1/leave-requests/bd9ccb68-cdef-4ec9-b852-dfa82203a948`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
},
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'GET',
f'{os.environ["RDC_BASE_URL"]}/hr/v1/leave-requests/bd9ccb68-cdef-4ec9-b852-dfa82203a948',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/hr/v1/leave-requests/bd9ccb68-cdef-4ec9-b852-dfa82203a948');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/hr/v1/leave-requests/bd9ccb68-cdef-4ec9-b852-dfa82203a948");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"id": "bd9ccb68-cdef-4ec9-b852-dfa82203a948",
"number": "LR-2026-1044",
"employeeId": "5f6223ec-cd16-4dcc-bf30-2409b9672912",
"kind": "annual",
"from": "2026-11-30",
"to": "2026-12-04",
"days": 3,
"balanceAfter": 10,
"approverId": "21bd8239-2794-4320-adba-9128b6a6219b",
"status": "pending",
"note": null,
"reason": null,
"teamAway": {
"date": "2026-12-02",
"employeeIds": [
"11729ba4-78ca-4dfb-9165-03367b42d67a",
"45b8db4f-180e-40cf-99d6-2864b28b2eab"
]
},
"revision": 1
} Decide
Approve a leave request takes the revision you read and the person who decides. Reject a leave request also takes a reason, which stays with the request. The person who made the request cannot decide it (own_request), and only the approver or the HR lead can (not_approver).
curl
curl -X POST "$RDC_BASE_URL/hr/v1/leave-requests/bd9ccb68-cdef-4ec9-b852-dfa82203a948/approve" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"expectedRevision": 1,
"actorId": "21bd8239-2794-4320-adba-9128b6a6219b",
"operationId": "b45282b0-0827-4191-ba70-a0d39dc182c6"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/hr/v1/leave-requests/bd9ccb68-cdef-4ec9-b852-dfa82203a948/approve`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"expectedRevision": 1,
"actorId": "21bd8239-2794-4320-adba-9128b6a6219b",
"operationId": "b45282b0-0827-4191-ba70-a0d39dc182c6"
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/hr/v1/leave-requests/bd9ccb68-cdef-4ec9-b852-dfa82203a948/approve',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'expectedRevision': 1,
'actorId': '21bd8239-2794-4320-adba-9128b6a6219b',
'operationId': 'b45282b0-0827-4191-ba70-a0d39dc182c6',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"expectedRevision": 1,
"actorId": "21bd8239-2794-4320-adba-9128b6a6219b",
"operationId": "b45282b0-0827-4191-ba70-a0d39dc182c6"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/hr/v1/leave-requests/bd9ccb68-cdef-4ec9-b852-dfa82203a948/approve');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/hr/v1/leave-requests/bd9ccb68-cdef-4ec9-b852-dfa82203a948/approve");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"expectedRevision": 1,
"actorId": "21bd8239-2794-4320-adba-9128b6a6219b",
"operationId": "b45282b0-0827-4191-ba70-a0d39dc182c6"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "b45282b0-0827-4191-ba70-a0d39dc182c6",
"status": "accepted",
"aggregateRevision": 2
} After the approval the request is approved with one more revision, and the days are taken:
curl
curl "$RDC_BASE_URL/hr/v1/leave-requests/bd9ccb68-cdef-4ec9-b852-dfa82203a948" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/hr/v1/leave-requests/bd9ccb68-cdef-4ec9-b852-dfa82203a948`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
},
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'GET',
f'{os.environ["RDC_BASE_URL"]}/hr/v1/leave-requests/bd9ccb68-cdef-4ec9-b852-dfa82203a948',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/hr/v1/leave-requests/bd9ccb68-cdef-4ec9-b852-dfa82203a948');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/hr/v1/leave-requests/bd9ccb68-cdef-4ec9-b852-dfa82203a948");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"id": "bd9ccb68-cdef-4ec9-b852-dfa82203a948",
"number": "LR-2026-1044",
"employeeId": "5f6223ec-cd16-4dcc-bf30-2409b9672912",
"kind": "annual",
"from": "2026-11-30",
"to": "2026-12-04",
"days": 3,
"balanceAfter": 10,
"approverId": "21bd8239-2794-4320-adba-9128b6a6219b",
"status": "approved",
"note": null,
"reason": null,
"teamAway": null,
"revision": 2
} Over the balance
An annual request that counts more days than the balance is refused when it is made, with 422 and over_balance. Mihai Stan has two days left, so a request for three is refused. A leave of another kind is not.
curl
curl -X POST "$RDC_BASE_URL/hr/v1/leave-requests" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "e91b4a07-3d52-4c68-b7f0-2a6c8d1e5f93",
"employeeId": "21bd8239-2794-4320-adba-9128b6a6219b",
"kind": "annual",
"from": "2026-12-14",
"to": "2026-12-16"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/hr/v1/leave-requests`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "e91b4a07-3d52-4c68-b7f0-2a6c8d1e5f93",
"employeeId": "21bd8239-2794-4320-adba-9128b6a6219b",
"kind": "annual",
"from": "2026-12-14",
"to": "2026-12-16"
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/hr/v1/leave-requests',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': 'e91b4a07-3d52-4c68-b7f0-2a6c8d1e5f93',
'employeeId': '21bd8239-2794-4320-adba-9128b6a6219b',
'kind': 'annual',
'from': '2026-12-14',
'to': '2026-12-16',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "e91b4a07-3d52-4c68-b7f0-2a6c8d1e5f93",
"employeeId": "21bd8239-2794-4320-adba-9128b6a6219b",
"kind": "annual",
"from": "2026-12-14",
"to": "2026-12-16"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/hr/v1/leave-requests');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/hr/v1/leave-requests");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "e91b4a07-3d52-4c68-b7f0-2a6c8d1e5f93",
"employeeId": "21bd8239-2794-4320-adba-9128b6a6219b",
"kind": "annual",
"from": "2026-12-14",
"to": "2026-12-16"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"code": "over_balance",
"message": "The annual leave left is less than the days requested.",
"requestId": "9b4e1c2a-6d3f-4a78-b5e0-2f8c7d1a3e69"
} Cancel
Cancel a leave request works on a pending request and on an approved one before its first day. The days return to the balance. Dan Ilie cancels his approved leave of 27 November to 2 December, and the 2 days he had taken are his again.
curl
curl -X POST "$RDC_BASE_URL/hr/v1/leave-requests/67e16d2f-dc93-4022-bda9-883f8c4a729b/cancel" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"expectedRevision": 2,
"actorId": "11729ba4-78ca-4dfb-9165-03367b42d67a",
"operationId": "be2a8c7a-3f1d-457e-b6e7-4a4b8f7d743f"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/hr/v1/leave-requests/67e16d2f-dc93-4022-bda9-883f8c4a729b/cancel`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"expectedRevision": 2,
"actorId": "11729ba4-78ca-4dfb-9165-03367b42d67a",
"operationId": "be2a8c7a-3f1d-457e-b6e7-4a4b8f7d743f"
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/hr/v1/leave-requests/67e16d2f-dc93-4022-bda9-883f8c4a729b/cancel',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'expectedRevision': 2,
'actorId': '11729ba4-78ca-4dfb-9165-03367b42d67a',
'operationId': 'be2a8c7a-3f1d-457e-b6e7-4a4b8f7d743f',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"expectedRevision": 2,
"actorId": "11729ba4-78ca-4dfb-9165-03367b42d67a",
"operationId": "be2a8c7a-3f1d-457e-b6e7-4a4b8f7d743f"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/hr/v1/leave-requests/67e16d2f-dc93-4022-bda9-883f8c4a729b/cancel');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/hr/v1/leave-requests/67e16d2f-dc93-4022-bda9-883f8c4a729b/cancel");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"expectedRevision": 2,
"actorId": "11729ba4-78ca-4dfb-9165-03367b42d67a",
"operationId": "be2a8c7a-3f1d-457e-b6e7-4a4b8f7d743f"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "be2a8c7a-3f1d-457e-b6e7-4a4b8f7d743f",
"status": "accepted",
"aggregateRevision": 3
} curl
curl "$RDC_BASE_URL/hr/v1/employees/11729ba4-78ca-4dfb-9165-03367b42d67a/leave-balance" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/hr/v1/employees/11729ba4-78ca-4dfb-9165-03367b42d67a/leave-balance`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
},
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'GET',
f'{os.environ["RDC_BASE_URL"]}/hr/v1/employees/11729ba4-78ca-4dfb-9165-03367b42d67a/leave-balance',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/hr/v1/employees/11729ba4-78ca-4dfb-9165-03367b42d67a/leave-balance');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/hr/v1/employees/11729ba4-78ca-4dfb-9165-03367b42d67a/leave-balance");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"employeeId": "11729ba4-78ca-4dfb-9165-03367b42d67a",
"year": 2026,
"entitlement": 21,
"taken": 11,
"pending": 0,
"balance": 10
}