curl --request POST \
--url https://api.cal.com/v2/routing-forms/{routingFormId}/calculate-slots \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "jane@example.com",
"department": "sales"
}
'import requests
url = "https://api.cal.com/v2/routing-forms/{routingFormId}/calculate-slots"
payload = {
"email": "jane@example.com",
"department": "sales"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({email: 'jane@example.com', department: 'sales'})
};
fetch('https://api.cal.com/v2/routing-forms/{routingFormId}/calculate-slots', 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.cal.com/v2/routing-forms/{routingFormId}/calculate-slots",
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([
'email' => 'jane@example.com',
'department' => 'sales'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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.cal.com/v2/routing-forms/{routingFormId}/calculate-slots"
payload := strings.NewReader("{\n \"email\": \"jane@example.com\",\n \"department\": \"sales\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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.cal.com/v2/routing-forms/{routingFormId}/calculate-slots")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"jane@example.com\",\n \"department\": \"sales\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cal.com/v2/routing-forms/{routingFormId}/calculate-slots")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"jane@example.com\",\n \"department\": \"sales\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"eventTypeId": 123,
"slots": {}
}
}Calculate slots based on routing form response
It will not actually save the response just return the routed event type and slots when it can be booked.
curl --request POST \
--url https://api.cal.com/v2/routing-forms/{routingFormId}/calculate-slots \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "jane@example.com",
"department": "sales"
}
'import requests
url = "https://api.cal.com/v2/routing-forms/{routingFormId}/calculate-slots"
payload = {
"email": "jane@example.com",
"department": "sales"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({email: 'jane@example.com', department: 'sales'})
};
fetch('https://api.cal.com/v2/routing-forms/{routingFormId}/calculate-slots', 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.cal.com/v2/routing-forms/{routingFormId}/calculate-slots",
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([
'email' => 'jane@example.com',
'department' => 'sales'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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.cal.com/v2/routing-forms/{routingFormId}/calculate-slots"
payload := strings.NewReader("{\n \"email\": \"jane@example.com\",\n \"department\": \"sales\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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.cal.com/v2/routing-forms/{routingFormId}/calculate-slots")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"jane@example.com\",\n \"department\": \"sales\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cal.com/v2/routing-forms/{routingFormId}/calculate-slots")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"jane@example.com\",\n \"department\": \"sales\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"eventTypeId": 123,
"slots": {}
}
}Headers
value must be Bearer <token> where <token> is api key prefixed with cal_, managed user access token, or OAuth access token
Path Parameters
Query Parameters
Time starting from which available slots should be checked.
Must be in UTC timezone as ISO 8601 datestring.
You can pass date without hours which defaults to start of day or specify hours:
2024-08-13 (will have hours 00:00:00 aka at very beginning of the date) or you can specify hours manually like 2024-08-13T09:00:00Z
"2050-09-05"
Time until which available slots should be checked.
Must be in UTC timezone as ISO 8601 datestring.
You can pass date without hours which defaults to end of day or specify hours:
2024-08-20 (will have hours 23:59:59 aka at the very end of the date) or you can specify hours manually like 2024-08-20T18:00:00Z
"2050-09-06"
Time zone in which the available slots should be returned. Defaults to UTC.
"Europe/Rome"
If event type has multiple possible durations then you can specify the desired duration here. Also, if you are fetching slots for a dynamic event then you can specify the duration her which defaults to 30, meaning that returned slots will be each 30 minutes long.
"60"
Format of slot times in response. Use 'range' to get start and end times.
range, time "range"
The unique identifier of the booking being rescheduled. When provided will ensure that the original booking time appears within the returned available slots when rescheduling.
"abc123def456"
Only for round robin event types that allow the person rescheduling to choose the host. True returns slots of the original host, false returns slots of any available host. Ignored for other event types.
true
Body
The routing form response, as a map of field identifier to answer. Answers use the option label, not the option id. Must not be empty - without answers no route can match.
Was this page helpful?