One-Time Window API
Create One-Time Window
Create a single team-scoped HOLIDAY, BLACKOUT, or informational window.
POST
/
v2
/
teams
/
{team_id}
/
one-time-windows
Create One-Time Window
curl --request POST \
--url https://public.api.serval.com/v2/teams/{team_id}/one-time-windows \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"startsAt": "2025-01-15T01:30:15.000Z",
"endsAt": "2025-01-15T01:30:15.000Z",
"allDay": true,
"description": "<string>",
"scopedId": "<string>"
}
'import requests
url = "https://public.api.serval.com/v2/teams/{team_id}/one-time-windows"
payload = {
"name": "<string>",
"startsAt": "2025-01-15T01:30:15.000Z",
"endsAt": "2025-01-15T01:30:15.000Z",
"allDay": True,
"description": "<string>",
"scopedId": "<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({
name: '<string>',
startsAt: '2025-01-15T01:30:15.000Z',
endsAt: '2025-01-15T01:30:15.000Z',
allDay: true,
description: '<string>',
scopedId: '<string>'
})
};
fetch('https://public.api.serval.com/v2/teams/{team_id}/one-time-windows', 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://public.api.serval.com/v2/teams/{team_id}/one-time-windows",
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>',
'startsAt' => '2025-01-15T01:30:15.000Z',
'endsAt' => '2025-01-15T01:30:15.000Z',
'allDay' => true,
'description' => '<string>',
'scopedId' => '<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://public.api.serval.com/v2/teams/{team_id}/one-time-windows"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"startsAt\": \"2025-01-15T01:30:15.000Z\",\n \"endsAt\": \"2025-01-15T01:30:15.000Z\",\n \"allDay\": true,\n \"description\": \"<string>\",\n \"scopedId\": \"<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://public.api.serval.com/v2/teams/{team_id}/one-time-windows")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"startsAt\": \"2025-01-15T01:30:15.000Z\",\n \"endsAt\": \"2025-01-15T01:30:15.000Z\",\n \"allDay\": true,\n \"description\": \"<string>\",\n \"scopedId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://public.api.serval.com/v2/teams/{team_id}/one-time-windows")
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 \"name\": \"<string>\",\n \"startsAt\": \"2025-01-15T01:30:15.000Z\",\n \"endsAt\": \"2025-01-15T01:30:15.000Z\",\n \"allDay\": true,\n \"description\": \"<string>\",\n \"scopedId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"teamId": "<string>",
"name": "<string>",
"kind": "TIME_WINDOW_KIND_UNSPECIFIED",
"startsAt": "2025-01-15T01:30:15.000Z",
"endsAt": "2025-01-15T01:30:15.000Z",
"allDay": true,
"description": "<string>",
"createdAt": "2025-01-15T01:30:15.000Z",
"updatedAt": "2025-01-15T01:30:15.000Z",
"scopedId": "<string>"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
application/json
TimeWindowKind is the role of a one-time window (see OneTimeWindow).
Available options:
TIME_WINDOW_KIND_UNSPECIFIED, TIME_WINDOW_KIND_HOLIDAY, TIME_WINDOW_KIND_BLACKOUT, TIME_WINDOW_KIND_OTHER A timestamp in RFC 3339 format (e.g., "2025-01-15T01:30:15Z").
Examples:
"2025-01-15T01:30:15.000Z"
"2025-06-01T00:00:00.000Z"
A timestamp in RFC 3339 format (e.g., "2025-01-15T01:30:15Z").
Examples:
"2025-01-15T01:30:15.000Z"
"2025-06-01T00:00:00.000Z"
When true, starts_at and ends_at must be midnight UTC boundaries; ends_at is exclusive.
Copy-invariant identity. Omit to have the server mint one.
Response
200 - application/json
Success
Show child attributes
Show child attributes
Was this page helpful?
⌘I
Create One-Time Window
curl --request POST \
--url https://public.api.serval.com/v2/teams/{team_id}/one-time-windows \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"startsAt": "2025-01-15T01:30:15.000Z",
"endsAt": "2025-01-15T01:30:15.000Z",
"allDay": true,
"description": "<string>",
"scopedId": "<string>"
}
'import requests
url = "https://public.api.serval.com/v2/teams/{team_id}/one-time-windows"
payload = {
"name": "<string>",
"startsAt": "2025-01-15T01:30:15.000Z",
"endsAt": "2025-01-15T01:30:15.000Z",
"allDay": True,
"description": "<string>",
"scopedId": "<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({
name: '<string>',
startsAt: '2025-01-15T01:30:15.000Z',
endsAt: '2025-01-15T01:30:15.000Z',
allDay: true,
description: '<string>',
scopedId: '<string>'
})
};
fetch('https://public.api.serval.com/v2/teams/{team_id}/one-time-windows', 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://public.api.serval.com/v2/teams/{team_id}/one-time-windows",
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>',
'startsAt' => '2025-01-15T01:30:15.000Z',
'endsAt' => '2025-01-15T01:30:15.000Z',
'allDay' => true,
'description' => '<string>',
'scopedId' => '<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://public.api.serval.com/v2/teams/{team_id}/one-time-windows"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"startsAt\": \"2025-01-15T01:30:15.000Z\",\n \"endsAt\": \"2025-01-15T01:30:15.000Z\",\n \"allDay\": true,\n \"description\": \"<string>\",\n \"scopedId\": \"<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://public.api.serval.com/v2/teams/{team_id}/one-time-windows")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"startsAt\": \"2025-01-15T01:30:15.000Z\",\n \"endsAt\": \"2025-01-15T01:30:15.000Z\",\n \"allDay\": true,\n \"description\": \"<string>\",\n \"scopedId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://public.api.serval.com/v2/teams/{team_id}/one-time-windows")
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 \"name\": \"<string>\",\n \"startsAt\": \"2025-01-15T01:30:15.000Z\",\n \"endsAt\": \"2025-01-15T01:30:15.000Z\",\n \"allDay\": true,\n \"description\": \"<string>\",\n \"scopedId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"teamId": "<string>",
"name": "<string>",
"kind": "TIME_WINDOW_KIND_UNSPECIFIED",
"startsAt": "2025-01-15T01:30:15.000Z",
"endsAt": "2025-01-15T01:30:15.000Z",
"allDay": true,
"description": "<string>",
"createdAt": "2025-01-15T01:30:15.000Z",
"updatedAt": "2025-01-15T01:30:15.000Z",
"scopedId": "<string>"
}
}
