Create team routing form
curl --request POST \
--url https://api.cal.com/v2/organizations/{orgId}/teams/{teamId}/routing-forms \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Inbound sales",
"description": "Routes inbound leads to the right sales rep"
}
'import requests
url = "https://api.cal.com/v2/organizations/{orgId}/teams/{teamId}/routing-forms"
payload = {
"name": "Inbound sales",
"description": "Routes inbound leads to the right sales rep"
}
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({
name: 'Inbound sales',
description: 'Routes inbound leads to the right sales rep'
})
};
fetch('https://api.cal.com/v2/organizations/{orgId}/teams/{teamId}/routing-forms', 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/organizations/{orgId}/teams/{teamId}/routing-forms",
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' => 'Inbound sales',
'description' => 'Routes inbound leads to the right sales rep'
]),
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/organizations/{orgId}/teams/{teamId}/routing-forms"
payload := strings.NewReader("{\n \"name\": \"Inbound sales\",\n \"description\": \"Routes inbound leads to the right sales rep\"\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/organizations/{orgId}/teams/{teamId}/routing-forms")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Inbound sales\",\n \"description\": \"Routes inbound leads to the right sales rep\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cal.com/v2/organizations/{orgId}/teams/{teamId}/routing-forms")
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 \"name\": \"Inbound sales\",\n \"description\": \"Routes inbound leads to the right sales rep\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"id": "a1b2c3d4-...",
"name": "My Form",
"description": "This is the description.",
"disabled": false,
"teamId": 4214321,
"updatedAt": "2024-03-28T10:00:00.000Z",
"questions": [
{
"id": "a1b2c3d4-...",
"label": "Company size",
"identifier": "companySize",
"type": "select",
"required": true,
"options": [
{
"id": "a1b2c3d4-...",
"label": "51-200"
}
]
}
],
"routes": [
{
"id": "a1b2c3d4-...",
"name": "Enterprise leads",
"kind": "route",
"action": {
"type": "customPageMessage",
"value": "acme/discovery-call",
"eventTypeId": 123
},
"conditions": "\"Company size\" equals \"51-200\""
}
],
"summary": [
"<string>"
]
}
}Routing Forms
Create team routing form
Required membership role: team admin. PBAC permission: routingForm.create. Learn more about API access control at https://cal.com/docs/api-reference/v2/access-control. If accessed using an OAuth access token, the TEAM_ROUTING_FORM_WRITE scope is required. The form is created with no questions and a fallback route.
POST
/
v2
/
organizations
/
{orgId}
/
teams
/
{teamId}
/
routing-forms
Create team routing form
curl --request POST \
--url https://api.cal.com/v2/organizations/{orgId}/teams/{teamId}/routing-forms \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Inbound sales",
"description": "Routes inbound leads to the right sales rep"
}
'import requests
url = "https://api.cal.com/v2/organizations/{orgId}/teams/{teamId}/routing-forms"
payload = {
"name": "Inbound sales",
"description": "Routes inbound leads to the right sales rep"
}
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({
name: 'Inbound sales',
description: 'Routes inbound leads to the right sales rep'
})
};
fetch('https://api.cal.com/v2/organizations/{orgId}/teams/{teamId}/routing-forms', 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/organizations/{orgId}/teams/{teamId}/routing-forms",
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' => 'Inbound sales',
'description' => 'Routes inbound leads to the right sales rep'
]),
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/organizations/{orgId}/teams/{teamId}/routing-forms"
payload := strings.NewReader("{\n \"name\": \"Inbound sales\",\n \"description\": \"Routes inbound leads to the right sales rep\"\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/organizations/{orgId}/teams/{teamId}/routing-forms")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Inbound sales\",\n \"description\": \"Routes inbound leads to the right sales rep\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cal.com/v2/organizations/{orgId}/teams/{teamId}/routing-forms")
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 \"name\": \"Inbound sales\",\n \"description\": \"Routes inbound leads to the right sales rep\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"id": "a1b2c3d4-...",
"name": "My Form",
"description": "This is the description.",
"disabled": false,
"teamId": 4214321,
"updatedAt": "2024-03-28T10:00:00.000Z",
"questions": [
{
"id": "a1b2c3d4-...",
"label": "Company size",
"identifier": "companySize",
"type": "select",
"required": true,
"options": [
{
"id": "a1b2c3d4-...",
"label": "51-200"
}
]
}
],
"routes": [
{
"id": "a1b2c3d4-...",
"name": "Enterprise leads",
"kind": "route",
"action": {
"type": "customPageMessage",
"value": "acme/discovery-call",
"eventTypeId": 123
},
"conditions": "\"Company size\" equals \"51-200\""
}
],
"summary": [
"<string>"
]
}
}Headers
value must be Bearer <token> where <token> is api key prefixed with cal_
Body
application/json
Was this page helpful?