Calculate slots based on routing form response
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": {}
}
}Routing Forms
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.
POST
/
v2
/
routing-forms
/
{routingFormId}
/
calculate-slots
Calculate slots based on routing form response
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
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
Example:
"2033-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
Example:
"2033-09-06"
Body
application/json
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?