Create an employee leave
curl --request POST \
--url https://api-{region}.sesametime.com/contract/v1/employee-leave/employees/{employeeId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"endDate": "2024-12-31",
"leaveReasonId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"employeeLeaveTypeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contractId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"comment": "<string>"
}
'import requests
url = "https://api-{region}.sesametime.com/contract/v1/employee-leave/employees/{employeeId}"
payload = {
"endDate": "2024-12-31",
"leaveReasonId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"employeeLeaveTypeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contractId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"comment": "<string>"
}
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({
endDate: '2024-12-31',
leaveReasonId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
employeeLeaveTypeId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
contractId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
comment: '<string>'
})
};
fetch('https://api-{region}.sesametime.com/contract/v1/employee-leave/employees/{employeeId}', 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-{region}.sesametime.com/contract/v1/employee-leave/employees/{employeeId}",
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([
'endDate' => '2024-12-31',
'leaveReasonId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'employeeLeaveTypeId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'contractId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'comment' => '<string>'
]),
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://api-{region}.sesametime.com/contract/v1/employee-leave/employees/{employeeId}"
payload := strings.NewReader("{\n \"endDate\": \"2024-12-31\",\n \"leaveReasonId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"employeeLeaveTypeId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"contractId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"comment\": \"<string>\"\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://api-{region}.sesametime.com/contract/v1/employee-leave/employees/{employeeId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"endDate\": \"2024-12-31\",\n \"leaveReasonId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"employeeLeaveTypeId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"contractId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"comment\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-{region}.sesametime.com/contract/v1/employee-leave/employees/{employeeId}")
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 \"endDate\": \"2024-12-31\",\n \"leaveReasonId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"employeeLeaveTypeId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"contractId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"comment\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"employeeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"endDate": "2024-12-31",
"employeeLeaveType": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Dismissal",
"editable": true,
"createdAt": "2020-01-01T10:00:00+01:00",
"updatedAt": "2020-01-01T10:00:00+01:00"
},
"leaveReason": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Voluntary resignation",
"editable": true,
"createdAt": "2020-01-01T10:00:00+01:00",
"updatedAt": "2020-01-01T10:00:00+01:00"
},
"comment": "<string>",
"contractId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdAt": "2020-01-01T10:00:00+01:00",
"updatedAt": "2020-01-01T10:00:00+01:00"
},
"meta": {
"currentPage": 1,
"lastPage": 1,
"total": 1,
"perPage": 1
}
}{
"message": "Validation failed",
"errors": [
{
"field": "questionId",
"message": "This value is not a valid UUID."
},
{
"field": "answer",
"message": "This field is required for text-based questions."
}
]
}{
"message": "Invalid or missing API Key",
"code": "UNAUTHORIZED"
}{
"message": "Evaluation with ID 123e4567-e89b-12d3-a456-426614174000 was not found",
"code": "EVALUATION_NOT_FOUND"
}Contracts
Create an employee leave
Creates a new employee leave (baja) for the specified employee. The associated contract will be terminated.
Required fields:
endDate: The leave effective dateleaveReasonId: The reason for the leaveemployeeLeaveTypeId: The type of leave (voluntary/involuntary classification)contractId: The contract to terminate
Optional fields:
comment: Additional notes
POST
/
contract
/
v1
/
employee-leave
/
employees
/
{employeeId}
Create an employee leave
curl --request POST \
--url https://api-{region}.sesametime.com/contract/v1/employee-leave/employees/{employeeId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"endDate": "2024-12-31",
"leaveReasonId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"employeeLeaveTypeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contractId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"comment": "<string>"
}
'import requests
url = "https://api-{region}.sesametime.com/contract/v1/employee-leave/employees/{employeeId}"
payload = {
"endDate": "2024-12-31",
"leaveReasonId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"employeeLeaveTypeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contractId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"comment": "<string>"
}
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({
endDate: '2024-12-31',
leaveReasonId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
employeeLeaveTypeId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
contractId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
comment: '<string>'
})
};
fetch('https://api-{region}.sesametime.com/contract/v1/employee-leave/employees/{employeeId}', 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-{region}.sesametime.com/contract/v1/employee-leave/employees/{employeeId}",
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([
'endDate' => '2024-12-31',
'leaveReasonId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'employeeLeaveTypeId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'contractId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'comment' => '<string>'
]),
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://api-{region}.sesametime.com/contract/v1/employee-leave/employees/{employeeId}"
payload := strings.NewReader("{\n \"endDate\": \"2024-12-31\",\n \"leaveReasonId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"employeeLeaveTypeId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"contractId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"comment\": \"<string>\"\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://api-{region}.sesametime.com/contract/v1/employee-leave/employees/{employeeId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"endDate\": \"2024-12-31\",\n \"leaveReasonId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"employeeLeaveTypeId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"contractId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"comment\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-{region}.sesametime.com/contract/v1/employee-leave/employees/{employeeId}")
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 \"endDate\": \"2024-12-31\",\n \"leaveReasonId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"employeeLeaveTypeId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"contractId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"comment\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"employeeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"endDate": "2024-12-31",
"employeeLeaveType": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Dismissal",
"editable": true,
"createdAt": "2020-01-01T10:00:00+01:00",
"updatedAt": "2020-01-01T10:00:00+01:00"
},
"leaveReason": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Voluntary resignation",
"editable": true,
"createdAt": "2020-01-01T10:00:00+01:00",
"updatedAt": "2020-01-01T10:00:00+01:00"
},
"comment": "<string>",
"contractId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdAt": "2020-01-01T10:00:00+01:00",
"updatedAt": "2020-01-01T10:00:00+01:00"
},
"meta": {
"currentPage": 1,
"lastPage": 1,
"total": 1,
"perPage": 1
}
}{
"message": "Validation failed",
"errors": [
{
"field": "questionId",
"message": "This value is not a valid UUID."
},
{
"field": "answer",
"message": "This field is required for text-based questions."
}
]
}{
"message": "Invalid or missing API Key",
"code": "UNAUTHORIZED"
}{
"message": "Evaluation with ID 123e4567-e89b-12d3-a456-426614174000 was not found",
"code": "EVALUATION_NOT_FOUND"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The employee ID
Body
application/json
Leave effective date (Y-m-d)
Example:
"2024-12-31"
Leave reason ID (required)
Employee leave type ID (voluntary/involuntary classification)
Contract ID to terminate along with the leave
Optional comment
Was this page helpful?
⌘I