Update Routing Rule - API
Partial update of a routing rule. All fields are optional, but at least one editable field must be present in the body (otherwise returns 400 No editable fields provided).
Updating phoneNumbers detaches removed numbers and attaches added numbers; inbound conflicts are checked the same way as create.
Non-editable: type (creation-time only).
Header field gating — the existing rule's type controls which header field is allowed:
headers→ outbound rules only.headersToAttributes→ inbound rules only.
Responses:
200success — returns the updated routing rule.400validation failure (missing editable fields, invalidincludeHeaders, phone numbers not found, inbound conflict, wrong header field for rule type).404routing rule not found.500internal server error.
HTTP method and endpoint
|
values: YOUR_TOKEN_WITHOUT_ANY_PREFIX
This will be a JWT token generate using VideoSDK ApiKey and Secret.
Note that the token will not include any prefix such as "Basic " or "Bearer ". Just pass a token as value.
You can generate a new token by refering this Guide: Generate Auth token
values: application/json
This is usefull for json body parameters, so that VideoSDK servers can understand that the incoming body parameter will be a JSON string.
{ type, prefix, id, pin }. ALL, SIP_X_HEADERS, NONE. 400 on outbound rules. 400 on inbound rules. true, the caller's number is hidden when dispatching. inbound or outbound (unchanged; creation-time only). { type, prefix, id, pin }. null. ALL, SIP_X_HEADERS, NONE. import fetch from 'node-fetch';
const options = {
method: "PATCH",
headers: {
"Authorization": "$YOUR_TOKEN",
"Content-Type": "application/json",
},
body: JSON.stringify({
"name": "Renamed rule",
"phoneNumbers": [
"+14155551234",
"+14155555678"
],
"agentId": "$YOUR_AGENT_ID",
"agentMetadata": {
"team": "support",
"tier": "gold"
},
"room": {
"type": "dynamic",
"prefix": "blank"
},
"includeHeaders": "ALL",
"headersToAttributes": {},
"headers": {
"X-Customer-Id": "cust_42"
},
"allowedNumbers": [],
"allowedIpAddresses": [],
"tags": [
"support"
],
"recording": true,
"dtmf": false,
"noiseCancellation": true,
"hidePhoneNumber": true
}),
};
const url= `https://api.videosdk.live/v2/sip/routing-rule/:ruleId`;
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
{
"id": "rr_abc123",
"name": "Renamed rule",
"type": "inbound",
"numbers": [
"+14155551234",
"+14155555678"
],
"room": {
"type": "dynamic",
"prefix": "blank",
"id": null,
"pin": null
},
"agentId": "agent_xyz",
"agentMetadata": {
"team": "support",
"tier": "gold"
},
"hidePhoneNumber": true,
"tags": [
"support"
],
"apiKey": "ak_resolved",
"recording": true,
"dtmf": false,
"noiseCancellation": true,
"allowedNumbers": [],
"allowedIpAddresses": [],
"includeHeaders": "ALL",
"headersToAttributes": {},
"createdAt": "2026-05-11T10:00:00.000Z",
"updatedAt": "2026-05-11T10:05:00.000Z"
}
Got a Question? Ask us on discord