Skip to content

Onboard a carrier account

POST
/v1/Accounts/{auth_id}/Integrations/Carriers
curl --request POST \
--url https://api.siprtc.io/v1/Accounts/example/Integrations/Carriers \
--header 'Authorization: Basic <credentials>' \
--header 'Content-Type: application/json' \
--data '{ "countries": [ "US" ], "credentials": { "account_id": "AC00000000000000000000000000000000", "key_id": "", "secret": "fake-carrier-secret" }, "numbers": [ "+15555550123" ], "provider": "twilio" }'

Bring your own carrier, step 2: connects a Twilio, Plivo or Telnyx account and routes the chosen numbers through SIPRTC. In order it creates or updates the SIP trunk on the carrier’s side (Twilio Elastic SIP Trunking, Plivo Zentrunk or a Telnyx connection) pointed at the platform’s SBC (for Telnyx with an outbound voice profile for the given countries; Twilio and Plivo geo permissions stay yours to set); saves an outbound (termination) trunk for the given countries and an inbound (origination) trunk, both named “ (auto)”, on this account (updated in place on a repeat); then, per number, repoints it to the trunk on the carrier and adds it to the account’s numbers (voice, inbound and outbound) through a queued bulk import. This changes how calls to those numbers are handled on the carrier. It is safe to repeat: a repeat picks up where a failed run stopped. Before anything changes, the credentials are checked and every selected number must be in the carrier account; a failure there is a 400 and nothing was changed. After that the answer is 200 with status done, partial (some numbers failed) or failed (a trunk step failed and later steps were skipped); steps and numbers say what happened, and warnings list follow-ups (add outbound rates; link each number to an application; carrier geo permissions). The request may take up to 5 minutes. Authentication: HTTP Basic with the account’s Auth ID and Auth Secret. {auth_id} must be the authenticated account itself (403 “account mismatch” otherwise), and a sub-login of the account is refused (403 “only the account owner can connect a carrier”). The response carries Cache-Control: no-store; the carrier credentials are used for this request only and are never stored or logged.

auth_id
required
string

Auth ID of the account (must be the authenticated account)

Carrier, credentials, numbers (at most 100) and destination countries

Media type application/json
object
countries
required

Countries are the two-letter ISO 3166-1 codes outbound calls will go to (at least one); they become the outbound trunk’s supported countries.

Array<string>
>= 1 items

Example

[
"US"
]
credentials
required

Credentials of the carrier account, used for this request only.

object
account_id

AccountID is the Twilio Account SID (“AC…”) or the Plivo Auth ID. Required for twilio and plivo; not used for telnyx.

string

Example

AC00000000000000000000000000000000
key_id

KeyID is a Twilio API key SID (“SK…”) when secret is that key’s secret rather than the auth token. Twilio only; optional.

string

Example

secret
required

Secret is the Twilio auth token or API key secret, the Plivo auth token, or the Telnyx API key. Required; used for this request only, never stored or logged.

string

Example

fake-carrier-secret
numbers

Numbers to move onto the trunk, in E.164 exactly as listed by POST …/Carriers/Numbers (at most 100; omit or leave empty to set up the trunks only).

Array<string>
<= 100 items

Example

[
"+15555550123"
]
provider
required

Provider is the carrier: twilio, plivo or telnyx.

string
Allowed values: twilio plivo telnyx

Example

twilio

Outcome step by step; check status

Media type application/json
object
numbers

Numbers is the outcome per selected number (empty when a trunk step failed or none were selected).

Array<object>
object
detail

Detail is why the number failed.

string
number

Number in E.164.

string
status

Status: connected (moved on the carrier and added to the account’s numbers) or failed.

string
Allowed values: connected failed
origination_trunk_id

OriginationTrunkId is the id of the inbound (origination) trunk in the Trunks API.

integer
status

Status: done (every step and number succeeded), partial (trunks set up, some numbers failed) or failed (a trunk step failed; later steps were not run).

string
Allowed values: done partial failed
steps

Steps run, in order, with their outcome.

Array<object>
object
detail

Detail is why the step failed.

string
name

Name of the step: “Trunk on the carrier”, “Outbound trunk” or “Inbound trunk”.

string
status

Status of the step: done or failed.

string
Allowed values: done failed
termination_trunk_id

TerminationTrunkId is the id of the outbound (termination) trunk in the Trunks API.

integer
warnings

Warnings are follow-up actions for the account (rates, number routing, carrier geo permissions).

Array<string>

Example

{
"numbers": [
{
"detail": "",
"number": "+15555550123",
"status": "connected"
}
],
"origination_trunk_id": 42,
"status": "done",
"steps": [
{
"detail": "",
"name": "Trunk on the carrier",
"status": "done"
}
],
"termination_trunk_id": 41,
"warnings": [
"Outbound calls need rates for the countries you call. Add them under Rates."
]
}

Body failed validation (errors lists each field), an unreadable body (message only), the carrier refused the credentials, or a selected number is not in the carrier account (message gives the reason); nothing was changed

Media type application/json
object
errors

Errors names each field that failed and the rule it broke.

Array<string>
message

Message is “invalid request”.

string
status

Status is “failed”.

string

Example

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

Missing or invalid SIPRTC credentials; the body is the JSON string Authentication failed

Media type application/json
string

Example generated

example

Account mismatch, or a sub-login instead of the account owner

Media type application/json
object
message

Message says what went wrong.

string
status

Status is always “failed” on an error (some validation errors omit it).

string

Example

{
"message": "error message",
"status": "failed"
}

Carrier onboarding is not set up on this platform

Media type application/json
object
message

Message says what went wrong.

string
status

Status is always “failed” on an error (some validation errors omit it).

string

Example

{
"message": "error message",
"status": "failed"
}