Skip to main content

Prefix Object

The Prefix Object defines prefix-based routing rules used to route outbound calls within the network. When a dialed number matches a configured prefix, the associated routing configuration is applied, including destination trunk groups and transformations.

Prefixes can optionally be scoped to a specific source trunk group, limiting the rule to calls originating from that trunk group only. Prefix routing overrides normal DID routing.

tip

Refer to How It Works: Prefix Routing to learn more about what prefixes are, what they are used for, and how you can work with them.

Prefix Object Attributes​

The fields listed in the table below will be returned in a JSON object when a successful request has been made.

AttributeData TypeDescription
attributesobjectA key-value store for custom, user-defined data associated with the prefix. It is intended for customer convenience and organizational purposes only. It has no effect on routing or any other system behavior.
callback_urlstringThis field is present in the prefix object but callbacks are not currently supported for prefixes. Do not use this field. It is reserved for potential future use.
namestringThe prefix name. The default value is N/A.
partner_sid
read only
stringThe secure ID of the partner associated with this prefix rule.
prefixstring

A sequence of alphanumeric characters or * matched against the beginning of a dialed number.

When a call originates from any endpoint on your account, the system checks the dialed number against all configured prefixes. If a match is found, the call is routed to the trunk group associated with this prefix, overriding the default routing.

The * wildcard matches any dialed number and can be used as a catch-all rule.

There is no hard length restriction, but a prefix longer than the dialed number will never produce a match. When multiple prefixes overlap (for example, 209 and 2095), the longest matching prefix takes precedence.

prefix_sid
read only
stringThe prefix secure ID.
source_trunk_group_sidstring

The secure ID of the trunk group from which the call originates. When set, this prefix rule applies only to calls originating from the specified trunk group.

Source-specific prefix rules take priority over generic prefix rules where this field is null. If no source-specific match is found, the system falls back to generic prefixes. Longest-prefix matching and * catch-all rules apply within each tier.

This field is optional. When null, the prefix rule applies to all outbound calls on the account, regardless of their origin.

string_key_1stringOptional user-defined metadata field for custom identification or integration purposes.
string_key_2stringOptional user-defined metadata field for custom identification or integration purposes.
transformationsarrayThe list of transformations applied when the prefix rule matches.
trunk_group_sidstring

The secure ID of the destination trunk group that calls will be routed to when this prefix is matched.

warning

If this field is not specified or is null, the call will be dropped. Prefixes follow the same call routing behavior as regular DIDs.

Sample Prefix Object​

{
"attributes": {},
"callback_url": null,
"name": "N/A",
"partner_sid": "e00430c3-a7d0-4666-ab5c-f7202448382f",
"prefix": "51625",
"prefix_sid": "cc367acb-94c8-418f-b247-85dce5806ef4",
"source_trunk_group_sid": null,
"string_key_1": null,
"string_key_2": null,
"transformations": [],
"trunk_group_sid": "df9bd225-8966-4f04-a2e3-1a317683afd5"
}