Update routing rule
curl --request PATCH \
--url https://api.zeroruntime.ai/v2/sip/routing-rule/{ruleId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Support inbound (EU)",
"phoneNumbers": [
"+14155550100",
"+14155550101"
],
"agentId": "ag_5d81b0",
"agentMetadata": {
"queue": "renewals"
},
"room": {
"type": "dynamic",
"prefix": "participantNumber"
},
"includeHeaders": "ALL",
"recording": true,
"tags": [
"support",
"eu"
]
}
'import requests
url = "https://api.zeroruntime.ai/v2/sip/routing-rule/{ruleId}"
payload = {
"name": "Support inbound (EU)",
"phoneNumbers": ["+14155550100", "+14155550101"],
"agentId": "ag_5d81b0",
"agentMetadata": { "queue": "renewals" },
"room": {
"type": "dynamic",
"prefix": "participantNumber"
},
"includeHeaders": "ALL",
"recording": True,
"tags": ["support", "eu"]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Support inbound (EU)',
phoneNumbers: ['+14155550100', '+14155550101'],
agentId: 'ag_5d81b0',
agentMetadata: {queue: 'renewals'},
room: {type: 'dynamic', prefix: 'participantNumber'},
includeHeaders: 'ALL',
recording: true,
tags: ['support', 'eu']
})
};
fetch('https://api.zeroruntime.ai/v2/sip/routing-rule/{ruleId}', 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.zeroruntime.ai/v2/sip/routing-rule/{ruleId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Support inbound (EU)',
'phoneNumbers' => [
'+14155550100',
'+14155550101'
],
'agentId' => 'ag_5d81b0',
'agentMetadata' => [
'queue' => 'renewals'
],
'room' => [
'type' => 'dynamic',
'prefix' => 'participantNumber'
],
'includeHeaders' => 'ALL',
'recording' => true,
'tags' => [
'support',
'eu'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.zeroruntime.ai/v2/sip/routing-rule/{ruleId}"
payload := strings.NewReader("{\n \"name\": \"Support inbound (EU)\",\n \"phoneNumbers\": [\n \"+14155550100\",\n \"+14155550101\"\n ],\n \"agentId\": \"ag_5d81b0\",\n \"agentMetadata\": {\n \"queue\": \"renewals\"\n },\n \"room\": {\n \"type\": \"dynamic\",\n \"prefix\": \"participantNumber\"\n },\n \"includeHeaders\": \"ALL\",\n \"recording\": true,\n \"tags\": [\n \"support\",\n \"eu\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<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.patch("https://api.zeroruntime.ai/v2/sip/routing-rule/{ruleId}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Support inbound (EU)\",\n \"phoneNumbers\": [\n \"+14155550100\",\n \"+14155550101\"\n ],\n \"agentId\": \"ag_5d81b0\",\n \"agentMetadata\": {\n \"queue\": \"renewals\"\n },\n \"room\": {\n \"type\": \"dynamic\",\n \"prefix\": \"participantNumber\"\n },\n \"includeHeaders\": \"ALL\",\n \"recording\": true,\n \"tags\": [\n \"support\",\n \"eu\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zeroruntime.ai/v2/sip/routing-rule/{ruleId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Support inbound (EU)\",\n \"phoneNumbers\": [\n \"+14155550100\",\n \"+14155550101\"\n ],\n \"agentId\": \"ag_5d81b0\",\n \"agentMetadata\": {\n \"queue\": \"renewals\"\n },\n \"room\": {\n \"type\": \"dynamic\",\n \"prefix\": \"participantNumber\"\n },\n \"includeHeaders\": \"ALL\",\n \"recording\": true,\n \"tags\": [\n \"support\",\n \"eu\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "rr_8k2m1x",
"type": "inbound",
"numbers": [
"<string>"
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"name": "<string>",
"phoneNumbers": [
"<string>"
],
"apiKey": "<string>",
"agentId": "<string>",
"agentMetadata": {},
"room": {
"type": "dynamic",
"prefix": "blank"
},
"includeHeaders": "NONE",
"headers": {},
"headersToAttributes": {},
"allowedNumbers": [
"<string>"
],
"allowedIpAddresses": [
"<string>"
],
"tags": [
"<string>"
],
"recording": false,
"dtmf": false,
"noiseCancellation": false,
"hidePhoneNumber": false
}{
"message": "<string>"
}Routing rules
Update routing rule
Updates a routing rule. Send only the fields you want to change. Everything except type can be changed.
phoneNumbers and room replace what’s there. Send the full list of numbers ([] detaches them all), and a room without pin clears the pin.
PATCH
/
v2
/
sip
/
routing-rule
/
{ruleId}
Update routing rule
curl --request PATCH \
--url https://api.zeroruntime.ai/v2/sip/routing-rule/{ruleId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Support inbound (EU)",
"phoneNumbers": [
"+14155550100",
"+14155550101"
],
"agentId": "ag_5d81b0",
"agentMetadata": {
"queue": "renewals"
},
"room": {
"type": "dynamic",
"prefix": "participantNumber"
},
"includeHeaders": "ALL",
"recording": true,
"tags": [
"support",
"eu"
]
}
'import requests
url = "https://api.zeroruntime.ai/v2/sip/routing-rule/{ruleId}"
payload = {
"name": "Support inbound (EU)",
"phoneNumbers": ["+14155550100", "+14155550101"],
"agentId": "ag_5d81b0",
"agentMetadata": { "queue": "renewals" },
"room": {
"type": "dynamic",
"prefix": "participantNumber"
},
"includeHeaders": "ALL",
"recording": True,
"tags": ["support", "eu"]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Support inbound (EU)',
phoneNumbers: ['+14155550100', '+14155550101'],
agentId: 'ag_5d81b0',
agentMetadata: {queue: 'renewals'},
room: {type: 'dynamic', prefix: 'participantNumber'},
includeHeaders: 'ALL',
recording: true,
tags: ['support', 'eu']
})
};
fetch('https://api.zeroruntime.ai/v2/sip/routing-rule/{ruleId}', 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.zeroruntime.ai/v2/sip/routing-rule/{ruleId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Support inbound (EU)',
'phoneNumbers' => [
'+14155550100',
'+14155550101'
],
'agentId' => 'ag_5d81b0',
'agentMetadata' => [
'queue' => 'renewals'
],
'room' => [
'type' => 'dynamic',
'prefix' => 'participantNumber'
],
'includeHeaders' => 'ALL',
'recording' => true,
'tags' => [
'support',
'eu'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.zeroruntime.ai/v2/sip/routing-rule/{ruleId}"
payload := strings.NewReader("{\n \"name\": \"Support inbound (EU)\",\n \"phoneNumbers\": [\n \"+14155550100\",\n \"+14155550101\"\n ],\n \"agentId\": \"ag_5d81b0\",\n \"agentMetadata\": {\n \"queue\": \"renewals\"\n },\n \"room\": {\n \"type\": \"dynamic\",\n \"prefix\": \"participantNumber\"\n },\n \"includeHeaders\": \"ALL\",\n \"recording\": true,\n \"tags\": [\n \"support\",\n \"eu\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<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.patch("https://api.zeroruntime.ai/v2/sip/routing-rule/{ruleId}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Support inbound (EU)\",\n \"phoneNumbers\": [\n \"+14155550100\",\n \"+14155550101\"\n ],\n \"agentId\": \"ag_5d81b0\",\n \"agentMetadata\": {\n \"queue\": \"renewals\"\n },\n \"room\": {\n \"type\": \"dynamic\",\n \"prefix\": \"participantNumber\"\n },\n \"includeHeaders\": \"ALL\",\n \"recording\": true,\n \"tags\": [\n \"support\",\n \"eu\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zeroruntime.ai/v2/sip/routing-rule/{ruleId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Support inbound (EU)\",\n \"phoneNumbers\": [\n \"+14155550100\",\n \"+14155550101\"\n ],\n \"agentId\": \"ag_5d81b0\",\n \"agentMetadata\": {\n \"queue\": \"renewals\"\n },\n \"room\": {\n \"type\": \"dynamic\",\n \"prefix\": \"participantNumber\"\n },\n \"includeHeaders\": \"ALL\",\n \"recording\": true,\n \"tags\": [\n \"support\",\n \"eu\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "rr_8k2m1x",
"type": "inbound",
"numbers": [
"<string>"
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"name": "<string>",
"phoneNumbers": [
"<string>"
],
"apiKey": "<string>",
"agentId": "<string>",
"agentMetadata": {},
"room": {
"type": "dynamic",
"prefix": "blank"
},
"includeHeaders": "NONE",
"headers": {},
"headersToAttributes": {},
"allowedNumbers": [
"<string>"
],
"allowedIpAddresses": [
"<string>"
],
"tags": [
"<string>"
],
"recording": false,
"dtmf": false,
"noiseCancellation": false,
"hidePhoneNumber": false
}{
"message": "<string>"
}Authorizations
Body
application/json
Response
The updated rule.