Help Center
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.

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.

POST/buyers/rg/list
curl --digest -u "$TCXC_USERNAME:$TCXC_API_KEY" -X POST \
  "https://apiv2.telecomsxchange.com/buyers/rg/list"
Response
{
  "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.

Always send one of lcr, order or weight as policy; the value is stored as sent.

Parameters

  • namestringform fieldRequired

    Group name, unique among your routing groups, up to 128 characters.

    ExampleUK mobile blend
  • policystringform fieldRequired

    How a route is chosen: lcr cheapest first, order a fixed failover order, weight weighted load balancing.

    One oflcrorderweight
  • smppintegerform fieldOptional

    0 for a voice group, 1 for an SMS group.

    One of01
    Default0

Errors

MessageWhen
"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
POST/buyers/rg/add
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=0
Response
{
  "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.

Send 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

  • idintegerpathRequired

    Routing group ID (i_routing_group).

    Example311
  • namestringform fieldRequired

    Group name, unique among your routing groups. Send the current name to keep it.

    ExampleUK mobile blend
  • policystringform fieldOptional

    New policy. A missing or unknown value keeps the current policy.

    One oflcrorderweight
  • hunt_stop_codesstringform fieldOptional

    Comma-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.

    Example404,486,603

Errors

MessageWhen
"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
POST/buyers/rg/edit/{id}
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'
Response
{
  "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.

The returned 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

  • idintegerpathRequired

    ID of the parent voice routing group.

    Example311
  • subrule_cld_prefixstringform fieldOptional

    Destination prefix to match, digits only, up to 15. Send at least one of the two prefixes.

    Example447
  • subrule_cli_prefixstringform fieldOptional

    Caller ID prefix to match, digits only, up to 15, or EMPTY to match calls that have no caller ID.

Errors

MessageWhen
"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
POST/buyers/rg/{id}/add_rule
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=''
Response
{
  "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.

Send both prefixes and 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

  • idintegerpathRequired

    Routing rule ID.

    Example318
  • subrule_cld_prefixstringform fieldOptional

    Destination prefix, digits only, up to 15. Send at least one of the two prefixes.

    Example4477
  • subrule_cli_prefixstringform fieldOptional

    Caller ID prefix, digits only or EMPTY, up to 15.

  • policystringform fieldOptional

    New policy. A missing or unknown value keeps the current policy.

    One oflcrorderweight
  • hunt_stop_codesstringform fieldOptional

    Comma-separated SIP response codes from 400 to 699 that stop failover.

Errors

MessageWhen
"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
POST/buyers/rg/rule/{id}/edit
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=order
Response
{
  "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

  • idintegerpathRequired

    Parent routing group ID.

    Example311
  • rule_idintegerpathRequired

    ID of the rule to delete.

    Example318

Errors

MessageWhen
"Rule not found"rule_id is not one of your rules in group id
POST/buyers/rg/{id}/rule/{rule_id}/delete
curl --digest -u "$TCXC_USERNAME:$TCXC_API_KEY" -X POST \
  "https://apiv2.telecomsxchange.com/buyers/rg/311/rule/318/delete"
Response
{
  "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

  • idintegerpathRequired

    Parent routing group ID.

    Example311
  • rule_idintegerpathRequired

    ID of the rule to move.

    Example319

Errors

MessageWhen
"This rule is on top"the rule is already first
"Rule not found"rule_id is not one of your rules in group id
POST/buyers/rg/{id}/rule/{rule_id}/up
curl --digest -u "$TCXC_USERNAME:$TCXC_API_KEY" -X POST \
  "https://apiv2.telecomsxchange.com/buyers/rg/311/rule/319/up"
Response
{
  "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

  • idintegerpathRequired

    Parent routing group ID.

    Example311
  • rule_idintegerpathRequired

    ID of the rule to move.

    Example318

Errors

MessageWhen
"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
POST/buyers/rg/{id}/rule/{rule_id}/down
curl --digest -u "$TCXC_USERNAME:$TCXC_API_KEY" -X POST \
  "https://apiv2.telecomsxchange.com/buyers/rg/311/rule/318/down"
Response
{
  "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.

Add voice routes to voice groups and SMS routes to SMS groups; the route type is not checked. If id is not one of your groups or rules, the response is empty.

Parameters

  • idintegerpathRequired

    Routing group or routing rule ID.

    Example311
  • i_connectionintegerpathRequired

    ID of a route purchased on any of your accounts, from List interconnects.

    Example5531

Errors

MessageWhen
"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
POST/buyers/rg/{id}/entry/add/{i_connection}
curl --digest -u "$TCXC_USERNAME:$TCXC_API_KEY" -X POST \
  "https://apiv2.telecomsxchange.com/buyers/rg/311/entry/add/5531"
Response
{
  "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.

Pass the group or rule that contains the entry as 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

  • idintegerpathRequired

    Routing group or routing rule ID that contains the entry.

    Example311
  • entry_idintegerpathRequired

    Entry ID (i_routing_group_entry), from List routing groups.

    Example9022

Errors

MessageWhen
"Entry not found"entry_id is not an entry in any of your routing groups
POST/buyers/rg/{id}/entry/{entry_id}/remove
curl --digest -u "$TCXC_USERNAME:$TCXC_API_KEY" -X POST \
  "https://apiv2.telecomsxchange.com/buyers/rg/311/entry/9022/remove"
Response
{
  "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.

If id is not one of your groups or rules, the response is empty.

Parameters

  • idintegerpathRequired

    Routing group or routing rule ID.

    Example311
  • entry_idintegerpathRequired

    Entry ID to move.

    Example9022

Errors

MessageWhen
"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
POST/buyers/rg/{id}/entry/{entry_id}/up
curl --digest -u "$TCXC_USERNAME:$TCXC_API_KEY" -X POST \
  "https://apiv2.telecomsxchange.com/buyers/rg/311/entry/9022/up"
Response
{
  "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.

If id is not one of your groups or rules, the response is empty.

Parameters

  • idintegerpathRequired

    Routing group or routing rule ID.

    Example311
  • entry_idintegerpathRequired

    Entry ID to move.

    Example9021

Errors

MessageWhen
"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
POST/buyers/rg/{id}/entry/{entry_id}/down
curl --digest -u "$TCXC_USERNAME:$TCXC_API_KEY" -X POST \
  "https://apiv2.telecomsxchange.com/buyers/rg/311/entry/9021/down"
Response
{
  "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.

If id is not one of your groups or rules, the response is empty.

Parameters

  • idintegerpathRequired

    Routing group or routing rule ID.

    Example311
  • entry_idintegerpathRequired

    Entry ID (i_routing_group_entry).

    Example9021
  • weightintegerpathRequired

    Whole number from 1 to 100.

    Example70

Errors

MessageWhen
"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
POST/buyers/rg/{id}/entry/{entry_id}/set_weight/{weight}
curl --digest -u "$TCXC_USERNAME:$TCXC_API_KEY" -X POST \
  "https://apiv2.telecomsxchange.com/buyers/rg/311/entry/9021/set_weight/70"
Response
{
  "status": "success",
  "message": "Weight updated successfully"
}