List a carrier account's numbers
const url = 'https://api.siprtc.io/v1/Accounts/example/Integrations/Carriers/Numbers';const options = { method: 'POST', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"credentials":{"account_id":"AC00000000000000000000000000000000","key_id":"","secret":"fake-carrier-secret"},"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/Numbers \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/json' \ --data '{ "credentials": { "account_id": "AC00000000000000000000000000000000", "key_id": "", "secret": "fake-carrier-secret" }, "provider": "twilio" }'Bring your own carrier, step 1: checks a Twilio, Plivo or Telnyx account’s credentials and lists its phone numbers (up to 5000), with what each currently points at (in_use_by), so you can choose which to move with POST …/Integrations/Carriers. Changes nothing on either side. Credentials: twilio needs account_id (Account SID, AC…) and secret (auth token, or an API key secret with key_id set to the key SID); plivo needs account_id (Auth ID) and secret (auth token); telnyx needs only secret (API key). A carrier that refuses the credentials, or any other carrier error, is a 400 whose message gives the reason (a carrier’s 401 is reported as 400, so it is not mistaken for this API’s own authentication). 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.
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 and its credentials
object
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-secretProvider is the carrier: twilio, plivo or telnyx. Required.
Example
twilioResponses
Section titled “ Responses ”OK
object
Numbers in the carrier account (up to 5000; an empty array when there are none).
object
ID is the carrier’s id of the number (Twilio number SID, Plivo number, Telnyx number id).
InUseBy says what the number currently points at on the carrier (e.g. “a SIP trunk”, “a voice application or URL”, “a Zentrunk trunk”, or the Telnyx connection name); empty when nothing. Onboarding the number repoints it.
Number is the phone number in E.164.
Type is the carrier’s number type when it reports one (Plivo, Telnyx), e.g. local or tollfree.
Voice is true when the carrier reports the number as voice-capable.
Status is “success”.
Example
{ "numbers": [ { "id": "PN00000000000000000000000000000000", "in_use_by": "a voice application or URL", "number": "+15555550123", "type": "local", "voice": true } ], "status": "success"}Body failed validation (errors lists each field), an unreadable body (message only), or the carrier refused the credentials or failed (message gives the reason)
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"}