Skip to content

Create a termination trunk

POST
/v1/Accounts/{auth_id}/Trunks/Termination
curl --request POST \
--url https://api.siprtc.io/v1/Accounts/example/Trunks/Termination \
--header 'Authorization: Basic <credentials>' \
--header 'Content-Type: application/json' \
--data '{ "codecs": "PCMU,PCMA", "except_cc": [ "CU" ], "from_remove_prefix": "+", "name": "Acme Carrier EU", "password": "s3cret-Example-Pass", "primary_ip": "203.0.113.10:5060", "priority": 10, "remove_prefix": "00", "secondary_ip": "203.0.113.11", "supported_cc": [ "GB", "IE" ], "trunk_prefix": "9", "username": "acme-trunk-01" }'

Adds a termination (outbound) trunk: outbound calls to the countries in supported_cc (minus except_cc) are sent to primary_ip, with secondary_ip as fallback, before the platform’s own routes. The call is still rated and billed with your account’s outbound rates. With a username and password the platform registers with the carrier and answers its digest challenges; without them the carrier must accept you by IP address. trunk_prefix, remove_prefix and from_remove_prefix rewrite the dialled number and caller ID; codecs restricts the offered codecs. The trunk is saved only if the SIP proxy accepts its credentials; otherwise nothing is kept and 400 is returned.

auth_id
required
string

Your account Auth ID (20 characters). The request always acts on the authenticated account.

The trunk

Media type application/json
object
codecs

Comma-separated codec names in order of preference (letters, digits, . _ / -), up to 100 characters. Empty means the platform default.

string
<= 100 characters

Example

PCMU,PCMA
except_cc

ISO 3166-1 alpha-2 country codes this trunk must never carry (two letters each).

Array<string>

Example

[
"CU"
]
from_remove_prefix

FromRemovePrefix is stripped from the caller ID (after its +) on calls sent to this trunk, e.g. “+” so the carrier sees the account’s user. Left out, the saved one is kept: clients that predate the field (older portals) would otherwise clear it on every save; “” clears it.

string
<= 20 characters

Example

+
name
required

Display name, up to 100 characters.

string
<= 100 characters

Example

Acme Carrier EU
password

Digest password, up to 128 characters. Required with a new username; on an update, empty keeps the saved password while the username is unchanged. Never returned.

string
<= 128 characters

Example

s3cret-Example-Pass
primary_ip
required

Carrier SIP host calls are sent to: IP address or hostname, optionally with :port.

string

Example

203.0.113.10:5060
priority

0 to 100 (default 0). Among the account’s trunks that carry a destination, the highest priority is tried first.

integer
<= 100

Example

10
remove_prefix

Leading digits stripped from the dialled number before trunk_prefix is added (digits, +, *, #; up to 20).

string
<= 20 characters

Example

00
secondary_ip

Optional fallback carrier SIP host, same format as primary_ip.

string

Example

203.0.113.11
supported_cc
required

ISO 3166-1 alpha-2 country codes of destinations this trunk carries, or [“ALL”]. At least one.

Array<string>
>= 1 items

Example

[
"GB",
"IE"
]
trunk_prefix

Digits prepended to the dialled number before it is sent (digits, +, *, #; up to 20).

string
<= 20 characters

Example

9
username

Digest username for the carrier, up to 64 characters, no spaces or @ : ; < > quotes. Leave empty for a carrier that authenticates you by IP address.

string
<= 64 characters

Example

acme-trunk-01

Created

Media type application/json
object
codecs

Comma-separated codec names offered to the carrier, in order of preference. Empty means the platform default.

string
created

When the trunk was created, RFC 3339.

string
except_cc

ISO 3166-1 alpha-2 country codes this trunk never carries, even when supported_cc is ALL.

Array<string>
from_remove_prefix

Leading characters stripped from the caller ID (after its +) on calls sent to this trunk; “+” sends the bare number.

string
has_password

Whether a password is saved. The password itself is never returned.

boolean
id

Trunk ID, unique across the platform.

integer
name

Display name.

string
primary_ip

Carrier SIP host calls are sent to: IP address or hostname, optionally with :port.

string
priority

0 to 100. When several of the account’s trunks carry a destination, the highest priority is tried first.

integer
reachability

Whether the carrier’s hosts answer SIP OPTIONS.

object
detail

Explanation, when there is one.

string
hosts

Each pinged host.

Array<object>
object
host

The pinged host, as saved on the trunk.

string
latency_ms

Round-trip time of the last OPTIONS answer, in milliseconds.

number
state

Reachable, unreachable or checking (added, no answer or time-out yet).

string
Allowed values: reachable unreachable checking
state

Overall state: reachable, unreachable, checking, not_checked (nothing to ping: an address range, a login-only or an inactive trunk) or unknown (the status could not be read).

string
Allowed values: reachable unreachable checking not_checked unknown
registration

Live state of the trunk’s registration with its carrier.

object
contacts

Origination trunks: number of registered contacts for the login.

integer
detail

Explanation, when there is one.

string
expires_in

Termination trunks: seconds until the registration with the carrier expires.

integer
state

Registered, registering, unregistered, disabled, not_required (the trunk authenticates by IP address, nothing registers) or unknown (the SIP proxy could not be asked; the trunk itself is fine).

string
Allowed values: registered registering unregistered disabled not_required unknown
remove_prefix

Leading digits stripped from the dialled number before trunk_prefix is added.

string
secondary_ip

Fallback carrier SIP host, used when the primary does not answer. Empty when not set.

string
supported_cc

ISO 3166-1 alpha-2 country codes of destinations this trunk carries, or [“ALL”].

Array<string>
trunk_prefix

Digits prepended to the dialled number before it is sent to the carrier (digits, +, *, #).

string
updated

When the trunk was last changed, RFC 3339.

string
username

Digest username for the carrier. Empty for a trunk the carrier authenticates by IP address.

string

Example

{
"codecs": "PCMU,PCMA",
"created": "2026-11-20T09:30:00Z",
"except_cc": [
"CU"
],
"from_remove_prefix": "+",
"has_password": true,
"id": 42,
"name": "Acme Carrier EU",
"primary_ip": "203.0.113.10:5060",
"priority": 10,
"reachability": {
"detail": "address ranges cannot be pinged",
"hosts": [
{
"host": "203.0.113.10:5060",
"latency_ms": 23.4,
"state": "reachable"
}
],
"state": "reachable"
},
"registration": {
"contacts": 1,
"detail": "the carrier has not accepted the registration; check the username and password. It is retried every few minutes",
"expires_in": 3540,
"state": "registered"
},
"remove_prefix": "00",
"secondary_ip": "203.0.113.11",
"supported_cc": [
"GB",
"IE"
],
"trunk_prefix": "9",
"updated": "2026-11-21T14:05:00Z",
"username": "acme-trunk-01"
}

Invalid body, a field failing validation, a username without password (or the reverse), bad prefix or codec characters, or the SIP proxy refusing the trunk (body is ErrorResponse except for field validation)

Media type application/json
object
errors

One line per refused field: the field, the rule it broke and the value sent.

Array<string>
message

Always “invalid request”.

string
status

Always “failed”.

string

Example

{
"errors": [
"validation failed on field 'primary_ip'",
" condition: required"
],
"message": "invalid request",
"status": "failed"
}

Missing or wrong Auth ID / Auth Secret (answered by the API gateway)

Media type application/json
string

Example generated

example

Signed in as a sub-user (portal login) rather than the account owner: only the owner can change trunks

Media type application/json
object
message

What went wrong, in plain words.

string
status

Always “failed”.

string

Example

{
"message": "trunk not found",
"status": "failed"
}