Onboard a carrier account
const url = 'https://api.siprtc.io/v1/Accounts/example/Integrations/Carriers';const options = { method: 'POST', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"countries":["US"],"credentials":{"account_id":"AC00000000000000000000000000000000","key_id":"","secret":"fake-carrier-secret"},"numbers":["+15555550123"],"provider":"twilio"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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 “
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”Auth ID of the account (must be the authenticated account)
Request Bodyrequired
Section titled “ Request Bodyrequired ”Carrier, credentials, numbers (at most 100) and destination countries
object
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.
Example
[ "US"]Credentials of the carrier account, used for this request only.
object
AccountID is the Twilio Account SID (“AC…”) or the Plivo Auth ID. Required for twilio and plivo; not used for telnyx.
Example
AC00000000000000000000000000000000KeyID is a Twilio API key SID (“SK…”) when secret is that key’s secret rather than the auth token. Twilio only; optional.
Example
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.
Example
fake-carrier-secretNumbers 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).
Example
[ "+15555550123"]Provider is the carrier: twilio, plivo or telnyx.
Example
twilioResponses
Section titled “ Responses ”Outcome step by step; check status
object
Numbers is the outcome per selected number (empty when a trunk step failed or none were selected).
object
Detail is why the number failed.
Number in E.164.
Status: connected (moved on the carrier and added to the account’s numbers) or failed.
OriginationTrunkId is the id of the inbound (origination) trunk in the Trunks API.
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).
Steps run, in order, with their outcome.
object
Detail is why the step failed.
Name of the step: “Trunk on the carrier”, “Outbound trunk” or “Inbound trunk”.
Status of the step: done or failed.
TerminationTrunkId is the id of the outbound (termination) trunk in the Trunks API.
Warnings are follow-up actions for the account (rates, number routing, carrier geo permissions).
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
object
Errors names each field that failed and the rule it broke.
Message is “invalid request”.
Status is “failed”.
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
Example generated
exampleAccount mismatch, or a sub-login instead of the account owner
object
Message says what went wrong.
Status is always “failed” on an error (some validation errors omit it).
Example
{ "message": "error message", "status": "failed"}Carrier onboarding is not set up on this platform
object
Message says what went wrong.
Status is always “failed” on an error (some validation errors omit it).
Example
{ "message": "error message", "status": "failed"}