Request coverage
curl --request POST \
--url https://api.shiftkeeper.io/user/coverage_requests/ \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z",
"reason": "<string>",
"schedule_ids": [
"<string>"
]
}
'import requests
url = "https://api.shiftkeeper.io/user/coverage_requests/"
payload = {
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z",
"reason": "<string>",
"schedule_ids": ["<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({
start: '2023-11-07T05:31:56Z',
end: '2023-11-07T05:31:56Z',
reason: '<string>',
schedule_ids: ['<string>']
})
};
fetch('https://api.shiftkeeper.io/user/coverage_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://api.shiftkeeper.io/user/coverage_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' => '2023-11-07T05:31:56Z',
'end' => '2023-11-07T05:31:56Z',
'reason' => '<string>',
'schedule_ids' => [
'<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.shiftkeeper.io/user/coverage_requests/"
payload := strings.NewReader("{\n \"start\": \"2023-11-07T05:31:56Z\",\n \"end\": \"2023-11-07T05:31:56Z\",\n \"reason\": \"<string>\",\n \"schedule_ids\": [\n \"<string>\"\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.shiftkeeper.io/user/coverage_requests/")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"start\": \"2023-11-07T05:31:56Z\",\n \"end\": \"2023-11-07T05:31:56Z\",\n \"reason\": \"<string>\",\n \"schedule_ids\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.shiftkeeper.io/user/coverage_requests/")
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 \"start\": \"2023-11-07T05:31:56Z\",\n \"end\": \"2023-11-07T05:31:56Z\",\n \"reason\": \"<string>\",\n \"schedule_ids\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"coverage_request": {
"id": "<string>",
"reason": "<string>",
"user": {
"id": "<string>",
"name": "<string>",
"email": "jsmith@example.com",
"time_zone": "<string>",
"slack_id": "<string>"
},
"shifts": [
{
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z",
"schedule_reference": {
"id": "<string>",
"name": "<string>"
}
}
],
"accepted_by": {
"id": "<string>",
"name": "<string>",
"email": "jsmith@example.com",
"time_zone": "<string>",
"slack_id": "<string>"
},
"accepted_shifts": [
{
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z",
"schedule_reference": {
"id": "<string>",
"name": "<string>"
}
}
]
}
}{
"error": {
"code": "too_many_shifts_in_coverage_request",
"message": "A coverage request can have a maximum of 500 shifts. Please select a shorter period for your coverage request.",
"status": 422,
"docs_url": "https://docs.shiftkeeper.io/api-reference/errors#too-many-shifts-in-coverage-request"
}
}Coverage
Request coverage
Create a new coverage request for the authenticated user.
POST
/
user
/
coverage_requests
/
Request coverage
curl --request POST \
--url https://api.shiftkeeper.io/user/coverage_requests/ \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z",
"reason": "<string>",
"schedule_ids": [
"<string>"
]
}
'import requests
url = "https://api.shiftkeeper.io/user/coverage_requests/"
payload = {
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z",
"reason": "<string>",
"schedule_ids": ["<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({
start: '2023-11-07T05:31:56Z',
end: '2023-11-07T05:31:56Z',
reason: '<string>',
schedule_ids: ['<string>']
})
};
fetch('https://api.shiftkeeper.io/user/coverage_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://api.shiftkeeper.io/user/coverage_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' => '2023-11-07T05:31:56Z',
'end' => '2023-11-07T05:31:56Z',
'reason' => '<string>',
'schedule_ids' => [
'<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.shiftkeeper.io/user/coverage_requests/"
payload := strings.NewReader("{\n \"start\": \"2023-11-07T05:31:56Z\",\n \"end\": \"2023-11-07T05:31:56Z\",\n \"reason\": \"<string>\",\n \"schedule_ids\": [\n \"<string>\"\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.shiftkeeper.io/user/coverage_requests/")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"start\": \"2023-11-07T05:31:56Z\",\n \"end\": \"2023-11-07T05:31:56Z\",\n \"reason\": \"<string>\",\n \"schedule_ids\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.shiftkeeper.io/user/coverage_requests/")
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 \"start\": \"2023-11-07T05:31:56Z\",\n \"end\": \"2023-11-07T05:31:56Z\",\n \"reason\": \"<string>\",\n \"schedule_ids\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"coverage_request": {
"id": "<string>",
"reason": "<string>",
"user": {
"id": "<string>",
"name": "<string>",
"email": "jsmith@example.com",
"time_zone": "<string>",
"slack_id": "<string>"
},
"shifts": [
{
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z",
"schedule_reference": {
"id": "<string>",
"name": "<string>"
}
}
],
"accepted_by": {
"id": "<string>",
"name": "<string>",
"email": "jsmith@example.com",
"time_zone": "<string>",
"slack_id": "<string>"
},
"accepted_shifts": [
{
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z",
"schedule_reference": {
"id": "<string>",
"name": "<string>"
}
}
]
}
}{
"error": {
"code": "too_many_shifts_in_coverage_request",
"message": "A coverage request can have a maximum of 500 shifts. Please select a shorter period for your coverage request.",
"status": 422,
"docs_url": "https://docs.shiftkeeper.io/api-reference/errors#too-many-shifts-in-coverage-request"
}
}Authorizations
Enter your API key which starts with 'keeper_'
Body
application/json
The start date and time of the interval you need coverage for.
The end date and time of the interval you need coverage for.
The reason you need coverage.
Required string length:
1 - 300You can optionally limit the coverage request to specific schedules. If not provided, the coverage request will include all schedules you are a member of.
Response
Default Response
Show child attributes
Show child attributes
Example:
{
"id": "cov_RxQottluZ1oeM47nz4bVl",
"user": {
"id": "usr_bq7CmsOKLmkMeZkUUu1hy",
"name": "Rick",
"email": "rick@example.org",
"time_zone": "Europe/Paris",
"role": "owner",
"seat": "member",
"slack_id": "U082KENSEQ3"
},
"reason": "I will be out of office during this week. Could someone jump in to cover these shifts?",
"status": "pending",
"shifts": [
{
"start": "2024-12-02T09:00:00Z",
"end": "2024-12-02T17:00:00Z",
"schedule_reference": {
"id": "sch_KR5uoK0xD0rWQoKTDqwgu",
"name": "Portal support"
}
},
{
"start": "2024-12-03T09:00:00Z",
"end": "2024-12-03T17:00:00Z",
"schedule_reference": {
"id": "sch_KR5uoK0xD0rWQoKTDqwgu",
"name": "Portal support"
}
},
{
"start": "2024-12-04T09:00:00Z",
"end": "2024-12-04T17:00:00Z",
"schedule_reference": {
"id": "sch_KR5uoK0xD0rWQoKTDqwgu",
"name": "Portal support"
}
},
{
"start": "2024-12-05T09:00:00Z",
"end": "2024-12-05T17:00:00Z",
"schedule_reference": {
"id": "sch_KR5uoK0xD0rWQoKTDqwgu",
"name": "Portal support"
}
},
{
"start": "2024-12-06T09:00:00Z",
"end": "2024-12-06T17:00:00Z",
"schedule_reference": {
"id": "sch_KR5uoK0xD0rWQoKTDqwgu",
"name": "Portal support"
}
},
{
"start": "2024-12-01T00:00:00Z",
"end": "2024-12-08T00:00:00Z",
"schedule_reference": {
"id": "sch_ldYmnBVr5o2ikebwmRRZv",
"name": "Citadel"
}
}
]
}
⌘I