Update inbound routing policy
Updates one or more fields for an existing policy. If scope or target IDs change, PHONE_NUMBER requires phone_number_id, AGENT requires agent_id, and PARTNER clears both target IDs.
curl --request PATCH \
--url https://api.vocobase.com/api/v2/inbound-route-policies/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone_number_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"enabled": true,
"webhook_url": "<string>",
"webhook_secret": "<string>",
"timeout_ms": 2625,
"allowed_actions": []
}
'import requests
url = "https://api.vocobase.com/api/v2/inbound-route-policies/{id}"
payload = {
"phone_number_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"enabled": True,
"webhook_url": "<string>",
"webhook_secret": "<string>",
"timeout_ms": 2625,
"allowed_actions": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
phone_number_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: '<string>',
enabled: true,
webhook_url: '<string>',
webhook_secret: '<string>',
timeout_ms: 2625,
allowed_actions: []
})
};
fetch('https://api.vocobase.com/api/v2/inbound-route-policies/{id}', 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.vocobase.com/api/v2/inbound-route-policies/{id}",
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([
'phone_number_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'agent_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => '<string>',
'enabled' => true,
'webhook_url' => '<string>',
'webhook_secret' => '<string>',
'timeout_ms' => 2625,
'allowed_actions' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.vocobase.com/api/v2/inbound-route-policies/{id}"
payload := strings.NewReader("{\n \"phone_number_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"enabled\": true,\n \"webhook_url\": \"<string>\",\n \"webhook_secret\": \"<string>\",\n \"timeout_ms\": 2625,\n \"allowed_actions\": []\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.vocobase.com/api/v2/inbound-route-policies/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone_number_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"enabled\": true,\n \"webhook_url\": \"<string>\",\n \"webhook_secret\": \"<string>\",\n \"timeout_ms\": 2625,\n \"allowed_actions\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vocobase.com/api/v2/inbound-route-policies/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone_number_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"enabled\": true,\n \"webhook_url\": \"<string>\",\n \"webhook_secret\": \"<string>\",\n \"timeout_ms\": 2625,\n \"allowed_actions\": []\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"policy": {
"id": "<string>",
"scope": "PHONE_NUMBER",
"phone_number_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"enabled": true,
"webhook_url": "<string>",
"has_webhook_secret": true,
"timeout_ms": 2625,
"failure_action": "ANSWER_WITH_AI",
"allowed_actions": [
"ANSWER_WITH_AI"
],
"phone_number": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"number": "<string>"
},
"agent": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "agent_name is required and must be max 50 characters"
}
}{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}
}{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Resource not found"
}
}{
"success": false,
"error": {
"code": "POLICY_ALREADY_EXISTS",
"message": "A policy already exists for this scope target"
}
}{
"success": false,
"error": {
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred"
}
}Authorizations
API key in format: rg_live_xxxx. Pass as a Bearer token in the Authorization header.
Path Parameters
Opaque policy ID.
Body
Patch a webhook-backed inbound routing policy. If scope or target IDs change, PHONE_NUMBER requires phone_number_id, AGENT requires agent_id, and PARTNER clears both target IDs.
Policy scope. Runtime resolution priority is PHONE_NUMBER, then AGENT, then PARTNER.
PHONE_NUMBER, AGENT, PARTNER PHONE_NUMBER target DID. Use only with scope PHONE_NUMBER.
AGENT target. Use only with scope AGENT.
Policy label used in admin tooling.
1 - 200When false, the policy is stored but not evaluated.
HTTPS endpoint that receives the inbound.route event.
Optional webhook signing secret. Write-only; null clears it.
Policy decision webhook timeout in milliseconds.
250 <= x <= 5000Fallback action when webhook fails.
ANSWER_WITH_AI, REJECT Optional allowlist for webhook response actions. Use null to clear and allow all.
Action values supported by inbound route policy responses.
ANSWER_WITH_AI, SELECT_AGENT, TRANSFER, REJECT curl --request PATCH \
--url https://api.vocobase.com/api/v2/inbound-route-policies/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone_number_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"enabled": true,
"webhook_url": "<string>",
"webhook_secret": "<string>",
"timeout_ms": 2625,
"allowed_actions": []
}
'import requests
url = "https://api.vocobase.com/api/v2/inbound-route-policies/{id}"
payload = {
"phone_number_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"enabled": True,
"webhook_url": "<string>",
"webhook_secret": "<string>",
"timeout_ms": 2625,
"allowed_actions": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
phone_number_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: '<string>',
enabled: true,
webhook_url: '<string>',
webhook_secret: '<string>',
timeout_ms: 2625,
allowed_actions: []
})
};
fetch('https://api.vocobase.com/api/v2/inbound-route-policies/{id}', 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.vocobase.com/api/v2/inbound-route-policies/{id}",
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([
'phone_number_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'agent_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => '<string>',
'enabled' => true,
'webhook_url' => '<string>',
'webhook_secret' => '<string>',
'timeout_ms' => 2625,
'allowed_actions' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.vocobase.com/api/v2/inbound-route-policies/{id}"
payload := strings.NewReader("{\n \"phone_number_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"enabled\": true,\n \"webhook_url\": \"<string>\",\n \"webhook_secret\": \"<string>\",\n \"timeout_ms\": 2625,\n \"allowed_actions\": []\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.vocobase.com/api/v2/inbound-route-policies/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone_number_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"enabled\": true,\n \"webhook_url\": \"<string>\",\n \"webhook_secret\": \"<string>\",\n \"timeout_ms\": 2625,\n \"allowed_actions\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vocobase.com/api/v2/inbound-route-policies/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone_number_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"enabled\": true,\n \"webhook_url\": \"<string>\",\n \"webhook_secret\": \"<string>\",\n \"timeout_ms\": 2625,\n \"allowed_actions\": []\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"policy": {
"id": "<string>",
"scope": "PHONE_NUMBER",
"phone_number_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"enabled": true,
"webhook_url": "<string>",
"has_webhook_secret": true,
"timeout_ms": 2625,
"failure_action": "ANSWER_WITH_AI",
"allowed_actions": [
"ANSWER_WITH_AI"
],
"phone_number": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"number": "<string>"
},
"agent": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "agent_name is required and must be max 50 characters"
}
}{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}
}{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Resource not found"
}
}{
"success": false,
"error": {
"code": "POLICY_ALREADY_EXISTS",
"message": "A policy already exists for this scope target"
}
}{
"success": false,
"error": {
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred"
}
}