Skip to content

List a carrier account's numbers

POST
/v1/Accounts/{auth_id}/Integrations/Carriers/Numbers
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.

auth_id
required
string

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

Carrier and its credentials

Media type application/json
object
credentials

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
provider
required

Provider is the carrier: twilio, plivo or telnyx. Required.

string
Allowed values: twilio plivo telnyx

Example

twilio

OK

Media type application/json
object
numbers

Numbers in the carrier account (up to 5000; an empty array when there are none).

Array<object>
object
id

ID is the carrier’s id of the number (Twilio number SID, Plivo number, Telnyx number id).

string
in_use_by

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.

string
number

Number is the phone number in E.164.

string
type

Type is the carrier’s number type when it reports one (Plivo, Telnyx), e.g. local or tollfree.

string
voice

Voice is true when the carrier reports the number as voice-capable.

boolean
status

Status is “success”.

string

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)

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"
}