All API resources
Routing groups
A routing group combines several purchased routes behind one tech prefix (444 and three digits) and chooses a route for each call or message by least cost, failover order or weighted load balancing, with optional rules per destination or caller prefix.
- POSTList routing groups
- POSTCreate a routing group
- POSTUpdate a routing group
- POSTAdd a routing rule
- POSTUpdate a routing rule
- POSTDelete a routing rule
- POSTMove a routing rule up
- POSTMove a routing rule down
- POSTAdd a route to a group
- POSTRemove a route from a group
- POSTMove a route up
- POSTMove a route down
- POSTSet a route's weight
List routing groups
POST/buyers/rg/list
Returns all your routing groups with their tech prefix, policy, hunt-stop codes and routes (routing_group_entries). Voice groups also include their routing rules (routing_rules), each with its own routes. Every other routing-group call uses the IDs returned here. Free.
rg_data is a route's position in an order group (1 is tried first) or its weight in a weight group; lcr groups ignore it. Routes are sorted by position for order, by weight (highest first) for weight, otherwise by seller and route name. smpp is 1 for SMS groups, which have no routing_rules. entries and rules are counts; other values are strings.Parameters
No parameters.
curl --digest -u "$TCXC_USERNAME:$TCXC_API_KEY" -X POST \
"https://apiv2.telecomsxchange.com/buyers/rg/list"import os
import requests
from requests.auth import HTTPDigestAuth
resp = requests.post(
"https://apiv2.telecomsxchange.com/buyers/rg/list",
auth=HTTPDigestAuth(os.environ["TCXC_USERNAME"], os.environ["TCXC_API_KEY"]),
)
print(resp.json())$ch = curl_init("https://apiv2.telecomsxchange.com/buyers/rg/list");
curl_setopt_array($ch, [
CURLOPT_HTTPAUTH => CURLAUTH_DIGEST,
CURLOPT_USERPWD => getenv('TCXC_USERNAME') . ':' . getenv('TCXC_API_KEY'),
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);{
"status": "success",
"routing_groups": [
{
"i_routing_group": "311",
"name": "UK mobile blend",
"policy": "order",
"hunt_stop_codes": "486,404,604",
"tech_prefix": "444517#",
"i_customer": "1042",
"smpp": "0",
"created": "2026-03-04 10:12:55",
"entries": 2,
"seller_names": "NorthwindVoice, Anonymous",
"rules": 1,
"routing_group_entries": [
{
"name": "UK Mobile CLI",
"rg_data": "1",
"i_routing_group_entry": "9021",
"connection_name": "NorthwindVoice / UK Mobile CLI",
"i_connection": "5531",
"created": "2026-03-04 10:14:02",
"i_vendor": "87",
"anonymous": "0"
},
{
"name": "Premium UK",
"rg_data": "2",
"i_routing_group_entry": "9022",
"connection_name": "Anonymous / Premium UK",
"i_connection": "5610",
"created": "2026-03-04 10:14:40",
"anonymous": "1"
}
],
"routing_rules": [
{
"i_routing_group": "318",
"name": "",
"policy": "lcr",
"hunt_stop_codes": "",
"tech_prefix": "",
"i_customer": "1042",
"smpp": "0",
"created": "2026-03-05 08:01:13",
"subrule_order": "1",
"subrule_cld_prefix": "447",
"subrule_cli_prefix": "",
"entries": 1,
"seller_names": "NorthwindVoice",
"rules": 0,
"routing_group_entries": [
{
"name": "UK Mobile CLI",
"rg_data": "1",
"i_routing_group_entry": "9030",
"connection_name": "NorthwindVoice / UK Mobile CLI",
"i_connection": "5531",
"created": "2026-03-05 08:02:40",
"i_vendor": "87",
"anonymous": "0"
}
]
}
]
}
]
}Create a routing group
POST/buyers/rg/add
Creates a voice or SMS routing group and gives it a unique tech prefix: 444, three random digits and #. Send traffic with that prefix to route it through the group. Voice groups start with hunt-stop codes 486,404,604. The response returns the new group's ID; call List routing groups to read its tech prefix. Free.
lcr, order or weight as policy; the value is stored as sent.Parameters
namestringform fieldRequiredGroup name, unique among your routing groups, up to 128 characters.
policystringform fieldRequiredHow a route is chosen:
lcrcheapest first,ordera fixed failover order,weightweighted load balancing.smppintegerform fieldOptional0 for a voice group, 1 for an SMS group.
Errors
| Message | When |
|---|---|
"Please enter a name for the routing group." | name is missing or blank |
"A routing group with this name already exists - choose a different name." | you already have a group with this name |
curl --digest -u "$TCXC_USERNAME:$TCXC_API_KEY" -X POST \
"https://apiv2.telecomsxchange.com/buyers/rg/add" \
-d name='UK mobile blend' \
-d policy=order \
-d smpp=0import os
import requests
from requests.auth import HTTPDigestAuth
resp = requests.post(
"https://apiv2.telecomsxchange.com/buyers/rg/add",
auth=HTTPDigestAuth(os.environ["TCXC_USERNAME"], os.environ["TCXC_API_KEY"]),
data={"name": "UK mobile blend", "policy": "order", "smpp": 0},
)
print(resp.json())$ch = curl_init("https://apiv2.telecomsxchange.com/buyers/rg/add");
curl_setopt_array($ch, [
CURLOPT_HTTPAUTH => CURLAUTH_DIGEST,
CURLOPT_USERPWD => getenv('TCXC_USERNAME') . ':' . getenv('TCXC_API_KEY'),
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => http_build_query(['name' => "UK mobile blend", 'policy' => "order", 'smpp' => 0]),
CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);{
"status": "success",
"message": "Routing Group has been added",
"i_routing_group": 311
}Update a routing group
POST/buyers/rg/edit/{id}
Renames a routing group and changes its policy and hunt-stop codes. Switching to order numbers the group's routes 1, 2, 3, ...; switching to weight sets every route's weight to 1. Free.
hunt_stop_codes on every edit: omitting it clears the list. If id is a routing rule, this call behaves like Update a routing rule.Parameters
idintegerpathRequiredRouting group ID (
i_routing_group).namestringform fieldRequiredGroup name, unique among your routing groups. Send the current name to keep it.
policystringform fieldOptionalNew policy. A missing or unknown value keeps the current policy.
hunt_stop_codesstringform fieldOptionalComma-separated SIP response codes from 400 to 699 that stop failover to the next route. Other values are dropped, and the list is de-duplicated and sorted.
Errors
| Message | When |
|---|---|
"Routing Group not found" | id is not one of your routing groups or rules |
"Please enter a name for the routing group." | name is missing or blank |
"A routing group with this name already exists — choose a different name." | another of your groups has this name |
curl --digest -u "$TCXC_USERNAME:$TCXC_API_KEY" -X POST \
"https://apiv2.telecomsxchange.com/buyers/rg/edit/311" \
-d name='UK mobile blend' \
-d policy=weight \
-d hunt_stop_codes='404,486,603'import os
import requests
from requests.auth import HTTPDigestAuth
resp = requests.post(
"https://apiv2.telecomsxchange.com/buyers/rg/edit/311",
auth=HTTPDigestAuth(os.environ["TCXC_USERNAME"], os.environ["TCXC_API_KEY"]),
data={"name": "UK mobile blend", "policy": "weight", "hunt_stop_codes": "404,486,603"},
)
print(resp.json())$ch = curl_init("https://apiv2.telecomsxchange.com/buyers/rg/edit/311");
curl_setopt_array($ch, [
CURLOPT_HTTPAUTH => CURLAUTH_DIGEST,
CURLOPT_USERPWD => getenv('TCXC_USERNAME') . ':' . getenv('TCXC_API_KEY'),
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => http_build_query(['name' => "UK mobile blend", 'policy' => "weight", 'hunt_stop_codes' => "404,486,603"]),
CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);{
"status": "success",
"message": "Routing group updated successfully"
}Add a routing rule
POST/buyers/rg/{id}/add_rule
Adds a routing rule to a voice routing group. A rule matches calls by destination (CLD) prefix, caller (CLI) prefix or both, and routes them through its own routes and policy. Rules are checked in order and a new rule goes to the bottom. It starts with policy lcr and no routes; add routes with Add a route to a group, using the rule's ID. Free.
i_routing_group is the new rule's ID. Use it as {id} when adding routes to the rule and in Update a routing rule.Parameters
idintegerpathRequiredID of the parent voice routing group.
subrule_cld_prefixstringform fieldOptionalDestination prefix to match, digits only, up to 15. Send at least one of the two prefixes.
subrule_cli_prefixstringform fieldOptionalCaller ID prefix to match, digits only, up to 15, or
EMPTYto match calls that have no caller ID.
Errors
| Message | When |
|---|---|
"Routing Group not found" | id is not one of your voice routing groups (SMS groups and rules can't have rules) |
"Enter at least one prefix: CLD (destination) or CLI (caller)." | both prefixes are missing or empty |
"CLD prefix may contain digits only." | subrule_cld_prefix contains a non-digit |
"CLI prefix may contain digits only, or the special value EMPTY." | subrule_cli_prefix is neither digits nor EMPTY |
"A prefix can be at most 15 digits." | either prefix is longer than 15 characters |
"A rule with this CLD/CLI prefix already exists in this group." | the group already has a rule with the same CLD and CLI pair |
curl --digest -u "$TCXC_USERNAME:$TCXC_API_KEY" -X POST \
"https://apiv2.telecomsxchange.com/buyers/rg/311/add_rule" \
-d subrule_cld_prefix=447 \
-d subrule_cli_prefix=''import os
import requests
from requests.auth import HTTPDigestAuth
resp = requests.post(
"https://apiv2.telecomsxchange.com/buyers/rg/311/add_rule",
auth=HTTPDigestAuth(os.environ["TCXC_USERNAME"], os.environ["TCXC_API_KEY"]),
data={"subrule_cld_prefix": "447", "subrule_cli_prefix": ""},
)
print(resp.json())$ch = curl_init("https://apiv2.telecomsxchange.com/buyers/rg/311/add_rule");
curl_setopt_array($ch, [
CURLOPT_HTTPAUTH => CURLAUTH_DIGEST,
CURLOPT_USERPWD => getenv('TCXC_USERNAME') . ':' . getenv('TCXC_API_KEY'),
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => http_build_query(['subrule_cld_prefix' => "447", 'subrule_cli_prefix' => ""]),
CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);{
"status": "success",
"message": "Routing Rule has been added",
"i_routing_group": 318
}Update a routing rule
POST/buyers/rg/rule/{id}/edit
Changes a routing rule's CLD and CLI prefixes, policy and hunt-stop codes. Switching to order numbers the rule's routes 1, 2, 3, ...; switching to weight sets their weights to 1. Free.
hunt_stop_codes on every edit: any of them you omit is cleared. If id is a top-level group, this call behaves like Update a routing group and requires name.Parameters
idintegerpathRequiredRouting rule ID.
subrule_cld_prefixstringform fieldOptionalDestination prefix, digits only, up to 15. Send at least one of the two prefixes.
subrule_cli_prefixstringform fieldOptionalCaller ID prefix, digits only or
EMPTY, up to 15.policystringform fieldOptionalNew policy. A missing or unknown value keeps the current policy.
hunt_stop_codesstringform fieldOptionalComma-separated SIP response codes from 400 to 699 that stop failover.
Errors
| Message | When |
|---|---|
"Routing Group not found" | id is not one of your rules or groups |
"Enter at least one prefix: CLD (destination) or CLI (caller)." | both prefixes are missing or empty |
"CLD prefix may contain digits only." | subrule_cld_prefix contains a non-digit |
"CLI prefix may contain digits only, or the special value EMPTY." | subrule_cli_prefix is neither digits nor EMPTY |
"A prefix can be at most 15 digits." | either prefix is longer than 15 characters |
"A rule with this CLD/CLI prefix already exists in this group." | another rule in the same group has this CLD and CLI pair |
curl --digest -u "$TCXC_USERNAME:$TCXC_API_KEY" -X POST \
"https://apiv2.telecomsxchange.com/buyers/rg/rule/318/edit" \
-d subrule_cld_prefix=4477 \
-d subrule_cli_prefix='' \
-d policy=orderimport os
import requests
from requests.auth import HTTPDigestAuth
resp = requests.post(
"https://apiv2.telecomsxchange.com/buyers/rg/rule/318/edit",
auth=HTTPDigestAuth(os.environ["TCXC_USERNAME"], os.environ["TCXC_API_KEY"]),
data={"subrule_cld_prefix": "4477", "subrule_cli_prefix": "", "policy": "order"},
)
print(resp.json())$ch = curl_init("https://apiv2.telecomsxchange.com/buyers/rg/rule/318/edit");
curl_setopt_array($ch, [
CURLOPT_HTTPAUTH => CURLAUTH_DIGEST,
CURLOPT_USERPWD => getenv('TCXC_USERNAME') . ':' . getenv('TCXC_API_KEY'),
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => http_build_query(['subrule_cld_prefix' => "4477", 'subrule_cli_prefix' => "", 'policy' => "order"]),
CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);{
"status": "success",
"message": "Routing Rule updated successfully"
}Delete a routing rule
POST/buyers/rg/{id}/rule/{rule_id}/delete
Deletes a routing rule and its route list, and moves the rules below it up one place. Your purchased routes are not affected. Free.
Parameters
idintegerpathRequiredParent routing group ID.
rule_idintegerpathRequiredID of the rule to delete.
Errors
| Message | When |
|---|---|
"Rule not found" | rule_id is not one of your rules in group id |
curl --digest -u "$TCXC_USERNAME:$TCXC_API_KEY" -X POST \
"https://apiv2.telecomsxchange.com/buyers/rg/311/rule/318/delete"import os
import requests
from requests.auth import HTTPDigestAuth
resp = requests.post(
"https://apiv2.telecomsxchange.com/buyers/rg/311/rule/318/delete",
auth=HTTPDigestAuth(os.environ["TCXC_USERNAME"], os.environ["TCXC_API_KEY"]),
)
print(resp.json())$ch = curl_init("https://apiv2.telecomsxchange.com/buyers/rg/311/rule/318/delete");
curl_setopt_array($ch, [
CURLOPT_HTTPAUTH => CURLAUTH_DIGEST,
CURLOPT_USERPWD => getenv('TCXC_USERNAME') . ':' . getenv('TCXC_API_KEY'),
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);{
"status": "success",
"message": "Rule has been deleted"
}Move a routing rule up
POST/buyers/rg/{id}/rule/{rule_id}/up
Moves a routing rule one place up in its group's evaluation order, swapping it with the rule above. Free.
Parameters
idintegerpathRequiredParent routing group ID.
rule_idintegerpathRequiredID of the rule to move.
Errors
| Message | When |
|---|---|
"This rule is on top" | the rule is already first |
"Rule not found" | rule_id is not one of your rules in group id |
curl --digest -u "$TCXC_USERNAME:$TCXC_API_KEY" -X POST \
"https://apiv2.telecomsxchange.com/buyers/rg/311/rule/319/up"import os
import requests
from requests.auth import HTTPDigestAuth
resp = requests.post(
"https://apiv2.telecomsxchange.com/buyers/rg/311/rule/319/up",
auth=HTTPDigestAuth(os.environ["TCXC_USERNAME"], os.environ["TCXC_API_KEY"]),
)
print(resp.json())$ch = curl_init("https://apiv2.telecomsxchange.com/buyers/rg/311/rule/319/up");
curl_setopt_array($ch, [
CURLOPT_HTTPAUTH => CURLAUTH_DIGEST,
CURLOPT_USERPWD => getenv('TCXC_USERNAME') . ':' . getenv('TCXC_API_KEY'),
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);{
"status": "success",
"message": "Routing Rule moved up"
}Move a routing rule down
POST/buyers/rg/{id}/rule/{rule_id}/down
Moves a routing rule one place down in its group's evaluation order, swapping it with the rule below. Free.
Parameters
idintegerpathRequiredParent routing group ID.
rule_idintegerpathRequiredID of the rule to move.
Errors
| Message | When |
|---|---|
"This rule is on the bottom" | the rule is already last |
"Rule not found" | rule_id is not one of your rules in group id |
curl --digest -u "$TCXC_USERNAME:$TCXC_API_KEY" -X POST \
"https://apiv2.telecomsxchange.com/buyers/rg/311/rule/318/down"import os
import requests
from requests.auth import HTTPDigestAuth
resp = requests.post(
"https://apiv2.telecomsxchange.com/buyers/rg/311/rule/318/down",
auth=HTTPDigestAuth(os.environ["TCXC_USERNAME"], os.environ["TCXC_API_KEY"]),
)
print(resp.json())$ch = curl_init("https://apiv2.telecomsxchange.com/buyers/rg/311/rule/318/down");
curl_setopt_array($ch, [
CURLOPT_HTTPAUTH => CURLAUTH_DIGEST,
CURLOPT_USERPWD => getenv('TCXC_USERNAME') . ':' . getenv('TCXC_API_KEY'),
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);{
"status": "success",
"message": "Routing Rule moved down"
}Add a route to a group
POST/buyers/rg/{id}/entry/add/{i_connection}
Adds one of your purchased routes to a routing group or rule. In an order group the route goes to the end of the failover list; in a weight group it starts with weight 1. Returns the new entry ID, used by the remove, move and set-weight calls. Adding a route to a group costs nothing.
id is not one of your groups or rules, the response is empty.Parameters
idintegerpathRequiredRouting group or routing rule ID.
i_connectionintegerpathRequiredID of a route purchased on any of your accounts, from List interconnects.
Errors
| Message | When |
|---|---|
"i_connection expects integer" | the route ID is not a number |
"You can only add routes you have purchased in the Market." | the route is not purchased on any of your accounts |
"This route is already in this group." | the route is already in this group or rule |
curl --digest -u "$TCXC_USERNAME:$TCXC_API_KEY" -X POST \
"https://apiv2.telecomsxchange.com/buyers/rg/311/entry/add/5531"import os
import requests
from requests.auth import HTTPDigestAuth
resp = requests.post(
"https://apiv2.telecomsxchange.com/buyers/rg/311/entry/add/5531",
auth=HTTPDigestAuth(os.environ["TCXC_USERNAME"], os.environ["TCXC_API_KEY"]),
)
print(resp.json())$ch = curl_init("https://apiv2.telecomsxchange.com/buyers/rg/311/entry/add/5531");
curl_setopt_array($ch, [
CURLOPT_HTTPAUTH => CURLAUTH_DIGEST,
CURLOPT_USERPWD => getenv('TCXC_USERNAME') . ':' . getenv('TCXC_API_KEY'),
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);{
"status": "success",
"message": "Route added to this group",
"i_routing_group_entry": 9021
}Remove a route from a group
POST/buyers/rg/{id}/entry/{entry_id}/remove
Removes a route from a routing group or rule. In an order group, the routes below it move up one place. Your purchased route is not affected. Free.
id; the entry is removed even if it belongs to another of your groups. If id is not one of your groups or rules, the response is empty.Parameters
idintegerpathRequiredRouting group or routing rule ID that contains the entry.
entry_idintegerpathRequiredEntry ID (
i_routing_group_entry), from List routing groups.
Errors
| Message | When |
|---|---|
"Entry not found" | entry_id is not an entry in any of your routing groups |
curl --digest -u "$TCXC_USERNAME:$TCXC_API_KEY" -X POST \
"https://apiv2.telecomsxchange.com/buyers/rg/311/entry/9022/remove"import os
import requests
from requests.auth import HTTPDigestAuth
resp = requests.post(
"https://apiv2.telecomsxchange.com/buyers/rg/311/entry/9022/remove",
auth=HTTPDigestAuth(os.environ["TCXC_USERNAME"], os.environ["TCXC_API_KEY"]),
)
print(resp.json())$ch = curl_init("https://apiv2.telecomsxchange.com/buyers/rg/311/entry/9022/remove");
curl_setopt_array($ch, [
CURLOPT_HTTPAUTH => CURLAUTH_DIGEST,
CURLOPT_USERPWD => getenv('TCXC_USERNAME') . ':' . getenv('TCXC_API_KEY'),
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);{
"status": "success",
"message": "Route removed from this group"
}Move a route up
POST/buyers/rg/{id}/entry/{entry_id}/up
Moves a route one place up in the failover order of an order group or rule, swapping it with the route above. Free.
id is not one of your groups or rules, the response is empty.Parameters
idintegerpathRequiredRouting group or routing rule ID.
entry_idintegerpathRequiredEntry ID to move.
Errors
| Message | When |
|---|---|
"up action only supported for ordered policy" | the group's policy is not order |
"This rule is on top" | the route is already first |
"entry not found" | entry_id is not an entry in your routing groups |
curl --digest -u "$TCXC_USERNAME:$TCXC_API_KEY" -X POST \
"https://apiv2.telecomsxchange.com/buyers/rg/311/entry/9022/up"import os
import requests
from requests.auth import HTTPDigestAuth
resp = requests.post(
"https://apiv2.telecomsxchange.com/buyers/rg/311/entry/9022/up",
auth=HTTPDigestAuth(os.environ["TCXC_USERNAME"], os.environ["TCXC_API_KEY"]),
)
print(resp.json())$ch = curl_init("https://apiv2.telecomsxchange.com/buyers/rg/311/entry/9022/up");
curl_setopt_array($ch, [
CURLOPT_HTTPAUTH => CURLAUTH_DIGEST,
CURLOPT_USERPWD => getenv('TCXC_USERNAME') . ':' . getenv('TCXC_API_KEY'),
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);{
"status": "success",
"message": "Route moved up"
}Move a route down
POST/buyers/rg/{id}/entry/{entry_id}/down
Moves a route one place down in the failover order of an order group or rule, swapping it with the route below. Free.
id is not one of your groups or rules, the response is empty.Parameters
idintegerpathRequiredRouting group or routing rule ID.
entry_idintegerpathRequiredEntry ID to move.
Errors
| Message | When |
|---|---|
"down action only supported for ordered policy" | the group's policy is not order |
"This entry is on the bottom" | the route is already last |
"entry not found" | entry_id is not an entry in your routing groups |
curl --digest -u "$TCXC_USERNAME:$TCXC_API_KEY" -X POST \
"https://apiv2.telecomsxchange.com/buyers/rg/311/entry/9021/down"import os
import requests
from requests.auth import HTTPDigestAuth
resp = requests.post(
"https://apiv2.telecomsxchange.com/buyers/rg/311/entry/9021/down",
auth=HTTPDigestAuth(os.environ["TCXC_USERNAME"], os.environ["TCXC_API_KEY"]),
)
print(resp.json())$ch = curl_init("https://apiv2.telecomsxchange.com/buyers/rg/311/entry/9021/down");
curl_setopt_array($ch, [
CURLOPT_HTTPAUTH => CURLAUTH_DIGEST,
CURLOPT_USERPWD => getenv('TCXC_USERNAME') . ':' . getenv('TCXC_API_KEY'),
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);{
"status": "success",
"message": "Route moved down"
}Set a route's weight
POST/buyers/rg/{id}/entry/{entry_id}/set_weight/{weight}
Sets the load-balancing weight of a route in a weight group or rule. Each route receives a share of traffic equal to its weight divided by the sum of all weights in the group. Free.
id is not one of your groups or rules, the response is empty.Parameters
idintegerpathRequiredRouting group or routing rule ID.
entry_idintegerpathRequiredEntry ID (
i_routing_group_entry).weightintegerpathRequiredWhole number from 1 to 100.
Errors
| Message | When |
|---|---|
"Weight must be a whole number between 1 and 100." | weight is not a whole number from 1 to 100 |
"set_weight action only supported for weighted policy" | the group's policy is not weight |
"entry not found" | entry_id is not an entry of group id |
curl --digest -u "$TCXC_USERNAME:$TCXC_API_KEY" -X POST \
"https://apiv2.telecomsxchange.com/buyers/rg/311/entry/9021/set_weight/70"import os
import requests
from requests.auth import HTTPDigestAuth
resp = requests.post(
"https://apiv2.telecomsxchange.com/buyers/rg/311/entry/9021/set_weight/70",
auth=HTTPDigestAuth(os.environ["TCXC_USERNAME"], os.environ["TCXC_API_KEY"]),
)
print(resp.json())$ch = curl_init("https://apiv2.telecomsxchange.com/buyers/rg/311/entry/9021/set_weight/70");
curl_setopt_array($ch, [
CURLOPT_HTTPAUTH => CURLAUTH_DIGEST,
CURLOPT_USERPWD => getenv('TCXC_USERNAME') . ':' . getenv('TCXC_API_KEY'),
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);{
"status": "success",
"message": "Weight updated successfully"
}