Skip to main content

Setup an Existing Account

This walks through how to set up and configure an existing Bandwidth account for use with our Number Management, HTTP Voice, and HTTP Messaging APIs — either through the Bandwidth App or programmatically via the Number Management API.

Don't have an account yet? Start a free trial instead.

Now that we've covered the hierarchical structure of your Bandwidth account, let's talk about how to complete your set-up.

Assumptions

  • You have been contracted and given access to your Bandwidth Account
  • Your account is enabled for HTTP Voice and/or Messaging
  • You have administrator access on the account to create users and change roles

Choose your setup path

Bandwidth recommends that all new users complete their account set-up using the Bandwidth App user interface to best get acquainted with our unique account structure. After you've familiarized yourself with these concepts, you may want to automate your set-up and programmatically configure your Sub-Accounts, Locations, and Applications instead.

  • New to Bandwidth's account structure? Use the Bandwidth App below.
  • Already comfortable with our Number Management API and account structure? Use the API below.

Setting up via the Bandwidth App

App Setup Steps

  1. Create a Sub-Account
  2. Create an Application
  3. Create a Location
  4. Order a Phone Number
  5. Next steps

Create a Sub-Account (Site)

Account Setup 1


Once you log into the Bandwidth App, the first thing you need to do is set up your initial Sub-account. Metaphorically speaking, if you were to look at the Account as a filing cabinet, the Sub-accounts can be best visualized as the drawers.

tip

Many users choose to just keep a single Sub-Account. Whereas others create two to represent Development & Production environments.

  1. In the top navigation bar, click Account, select Sub-accounts, and then click Add Sub-account.
  2. Enter the required information and click Create Sub-account.
tip

Your Sub-account contains a unique Site ID, you will need to reference this for our Number Management API requests.

Sub-Account Fields

Sub-Account Fields


Field NameMandatoryDescription
NameYesSub-Account Name
Address TypeYesBilling or Service. For record purposes only, does not affect billing.
Street NumberYesStreet number of address
Street NameYesStreet name of address
Address Line 2NoOptional second address line (ex Unit 123)
CityYesCity
StateYesState
Zip/Postal CodeYesPostal Code
ZIP Plus 4NoOptional +4 Postal Code
Customer IDNoOptional ID for your reference
Customer NameNoOptional Name for your reference
DescriptionNoOptional Description for your reference
note

For a self-guided training tutorial, click on Learning Lab & Support in the Bandwidth App and take a look at the Onboarding Guides!

Create an Application

Account Setup 2

info

For more information about our applications API, check out our Applications Guide.

Create a Voice Application

To begin using your Bandwidth phone numbers for Voice APIs, create a Voice Application and then associate it with your phone number's Location:

  1. In the top navigation bar, click Applications, and then click Add Application.
  2. Provide an Application name (we recommend you use something that identifies what the application will do).
  3. Under Application type, select Voice. Note: Once your application is created, you won't be able to change the application type.
  4. Enter your Callback URL(s)
  5. Click Create Application
Voice Application Fields

Voice Application Fields


Field NameMandatoryDescription
Application NameYesCustom application name
Application IDYesUnique application ID needed for API calls - Bandwidth creates this for you
Application TypeYesVOICE or MESSAGING
Call Initiated Callback MethodYesREST method for callbacks. POST gives a JSON object in the request body (recommended). GET passes the callback in query parameters
Call Initiated Callback URLYesURL to send call initiated (inbound calls) events to
Call Status Callback MethodNoREST method for callbacks. POST gives a JSON object in the request body (recommended). GET passes the callback in query parameters
Call Status Callback URLNoURL to send call status events to
Callback User IDNoOptional user id bandwidth sends in the Authorization header of the callback
Callback PasswordNoOptional password bandwidth sends in the Authorization header of the callback
Call Initiated Fallback MethodNoREST method for callbacks. POST gives a JSON object in the request body (recommended). GET passes the callback in query parameters
Call Initiated Fallback URLNoFallback URL to send call initiated (inbound calls) events to
Call Status Fallback MethodNoREST method for callbacks. POST gives a JSON object in the request body (recommended). GET passes the callback in query parameters
Call Status Fallback URLNoFallback URL to send call status events to
Fallback User IDNoOptional user id bandwidth sends in the Authorization header of the callback
Fallback PasswordNoOptional password bandwidth sends in the Authorization header of the callback

Create a Messaging Application

To begin using your Bandwidth phone numbers for Messaging APIs, create a Messaging Application and then associate it with your phone number's Location:

  1. In the top navigation bar, click Applications, and then click Add Application.
  2. Provide the Application name (we recommend you use something that identifies what the application will do).
  3. Under Application type, select Messaging. Note: Once your application is created, you won't be able to change the application type.
  4. Enter your callback URL(s)
  5. Select the types of callbacks you want to receive
  6. Click Create Application
Messaging Application Fields

Messaging Application Fields


Field NameMandatoryDescription
Application NameYesCustom application name
Application IDYesUnique application ID needed for API calls - Bandwidth creates this for you
Application TypeYesVOICE or MESSAGING
Use Multiple Callback URLsNoOptional toggle to allow you to split callbacks to different URLs for inbound and outbound messages
(Inbound) Callback URLYesURL to send inbound (or all) message callbacks to
Inbound Callback User IDNoOptional user id bandwidth sends in the Authorization header of the callback
Inbound Callback PasswordNoOptional password bandwidth sends in the Authorization header of the callback
Status Callback URLNoURL to send status (outbound) message callbacks to
Status Callback User IDNoOptional user id bandwidth sends in the Authorization header of the callback
Status Callback PasswordNoOptional password bandwidth sends in the Authorization header of the callback
Send message-delivered CallbacksNoOptional toggle to turn on/off message-delivered callbacks events
Send message-failed CallbacksNoOptional toggle to turn on/off message-failed callbacks events
Send message-sending CallbacksNoOptional toggle to turn on/off message-sending callbacks events

Create a Location (SIP Peer)

Account Setup 3

A Location is where you'll link your Application and provision other routing settings. When a phone number is added to a Location, it will inherit the settings and properties of that Location.

Link your Application with a Location:

  1. After you've created your Application, navigate to the Associated Locations section of the newly created application
  2. Click Create a Location.
  3. On the Locations Settings page, select a Sub-Account.
  4. Type in a Location Name and optional description. You'll order and port phone numbers to a Location. Give it a name that's easily identifiable.
  5. If there is no default location linked to your chosen sub-account already, enable Default Location
  6. Select Voice Protocol (HTTP or SIP, if applicable).
    • Note: You need to set voice protocol as HTTP to link it to a voice application
  7. Click SMS Enabled (if applicable)
    1. Enable Toll Free or Short Code SMS (if applicable)
    2. Select zones for international messaging (if applicable)
    3. Ensure SMS protocol is HTTP
    4. Ensure V2 Messaging is toggled ON
    5. Associate the proper Messaging Application

Location Fields

Location Fields


Field NameMandatoryDescription
Sub-AccountYesThe parent sub account of the new location
Location NameYesCustom location name
DescriptionNoOptional location description
Default LocationNoSub-accounts require one default location. This must be toggled on if it is the first/only location created under a sub-account
Voice ProtocolYesSIP or HTTP - determines what protocol is used for calls to/from the telephone numbers in the location
Associated Voice LocationYes (if HTTP voice)If using HTTP voice, the application you wish to associate. When calls are made to the numbers on this location, Bandwidth sends a webhook to the callback URL of the associated application
SMS EnabledNoToggle to enable/disable messaging capabilities for all telephone numbers in the location
Toll Free SMSNoToggle to enable/disable messaging capabilities for toll-free numbers in the location
Short Code SMSNoToggle to enable/disable messaging capabilities for short codes in the location
Geographic ReachYes (if SMS enabled)Toggle capabilities to certain geographical areas. Check our Messaging Reach Matrix to see which zones correspond to different countries
SMS ProtocolYes (if SMS enabled)SMPP or HTTP - determines what protocol is used for messages to/from the telephone numbers in the location
V2 MessagingYes (if HTTP SMS)Required if using the current V2 messaging API
Applications (Messaging)Yes (if HTTP SMS)If using HTTP messaging, the application you wish to associate. When messages are sent to/from the numbers on this location, Bandwidth sends a webhook to the callback URL(s) of the associated application
MMS EnabledNoToggle on/off MMS capabilities for all telephone numbers in the location
MMS ProtocolYes (if MMS enabled)SMPP or HTTP - determines what protocol is used for messages to/from the telephone numbers in the location

Setting up via the API

Unless you are already comfortable with our Number Management API and Bandwidth account structures, it is recommended that you follow the App setup path above instead of using this programmatic path.

API Setup Steps

  1. Create Sub-Account
  2. Create a Location
  3. Enable Services for Location
  4. Order a Phone Number
  5. Create an Application

Create a Sub-Account (Site) via the API

To create a Sub-Account, also referred to as a site, follow the instructions below.

Request URL

POSThttps://api.bandwidth.com/api/accounts/{accountId}/sites

Request Body Fields

The fields below should be formatted as XML elements and put in the request body as shown in the example below.

FieldRequiredDescription
NameYesThe name of the site. Max length of 10 characters
DescriptionNoThe description of the site
CustomerProvidedIDNoOptional custom ID to assign to your application. Max length of 10 characters
CustomerNameNoOptional custom name to assign to your application. Max length of 50 characters
AddressYesThe address of the site
Address.HouseNumberYesThe number of the house
Address.HousePrefixNoThe prefix of the house
Address.HouseSuffixNoThe suffix of the house
Address.StreetNameYesThe name of the street
Address.StreetSuffixNoThe suffix of the street
Address.AddressLine2NoThe optional second line of the address (apartment, extension, etc)
Address.CityYesThe city of the address
Address.StateCodeYesThe 2 character state code
Address.ZipYesThe 6 digit zip code
Address.PlusFourNoThe 4 digit zip code extension
Address.CountyNoThe county of the address
Address.CountryNoThe country of the address
Address.AddressTypeYesThe type of the address. Must be Billing or Service

Example

POST https://api.bandwidth.com/api/accounts/{accountId}/sites HTTP/1.1
Content-Type: application/xml; charset=utf-8
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

<Site>
<Name>SetupTest</Name>
<Description>Programmatic Setup Test</Description>
<CustomerName>BW</CustomerName>
<Address>
<HouseNumber>900</HouseNumber>
<StreetName>Main Campus Dr</StreetName>
<City>RALEIGH</City>
<StateCode>NC</StateCode>
<Zip>27606</Zip>
<AddressType>Billing</AddressType>
</Address>
</Site>

Create a Location (SIP Peer) via the API

To create a Location, also referred to as a SIP Peer, follow the instructions below.

Request URL

The siteId in this URL refers to the site you would like to become the parent sub account of the new location. It can be retrieved from the response of the site's creation request, via the App, or by performing a GET request on the /sites endpoint and looking at the <Id> tag for your site.

POSThttps://api.bandwidth.com/api/accounts/{accountId}/sites/{siteId}/sippeers

Request Body Fields

The fields below should be formatted as XML elements and put in the request body as shown in the example below.

FieldRequiredDescription
PeerNameYesPlain text name of the Location (sippeer)
IsDefaultPeerNoBoolean: true or false. The Default SIP Peer is the default "destination" for any Telephone Numbers that are ordered for the Site in which the SIP Peer resides. Each sub-account (site) can have only 1 default SIP Peer. You can configure multiple SIP Peers on a Site

Example

POST https://api.bandwidth.com/api/accounts/{accountId}/sites/{siteId}/sippeers HTTP/1.1
Content-Type: application/xml; charset=utf-8
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

<SipPeer>
<PeerName>Setup Test SIP Peer</PeerName>
<IsDefaultPeer>true</IsDefaultPeer>
</SipPeer>

Enable SMS for Location

In order to use HTTP messaging on your account, you need to enable SMS and MMS for each location.

Request URL

The sippeerId in this URL refers to the location you would like to enable SMS on. It can be retrieved from the Location header of the location creation response, via the Dashbaord UI, or by performing a GET request on the /sites/{siteId}/sippeers endpoint and looking at the <PeerId> tag for your Location.

POSThttps://api.bandwidth.com/api/accounts/{accountId}/sites/{siteId}/sippeers/{sippeerId}/products/messaging/features/sms

Request Body Fields

The fields below should be formatted as XML elements and put in the request body as shown in the example below.

FieldRequiredDescription
TollFreeYesBoolean: true or false. Will enable texting to and from toll-free phone numbers
ShortCodeYesBoolean: true or false. Will enable texting to and from short codes
ProtocolYesMUST BE SET TO HTTP
Zone1YesMUST BE SET TO: true
Zone2YesBoolean: true or false.
Zone3YesBoolean: true or false.
Zone4YesBoolean: true or false.
Zone5YesBoolean: true or false.

Example

POST https://api.bandwidth.com/api/accounts/{accountId}/sites/{siteId}/sippeers/{sippeerId}/products/messaging/features/sms HTTP/1.1
Content-Type: application/xml; charset=utf-8
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

<SipPeerSmsFeature>
<SipPeerSmsFeatureSettings>
<TollFree>true</TollFree>
<ShortCode>true</ShortCode>
<Protocol>HTTP</Protocol>
<Zone1>true</Zone1>
<Zone2>true</Zone2>
<Zone3>true</Zone3>
<Zone4>true</Zone4>
<Zone5>true</Zone5>
</SipPeerSmsFeatureSettings>
<HttpSettings />
</SipPeerSmsFeature>

Enable MMS for Location

In order to use HTTP messaging on your account, you need to enable SMS and MMS for each location.

Warning

MMS can only be enabled once SMS has been enabled. Attempting to enable MMS before SMS will result in a 400 Bad Request.

Request URL

The sippeerId in this URL refers to the location you would like to enable MMS on. It can be retrieved from the Location header of the location creation response, via the Dashbaord UI, or by performing a GET request on the /sites/{siteId}/sippeers endpoint and looking at the <PeerId> tag for your Location.

POSThttps://api.bandwidth.com/api/accounts/{accountId}/sites/{siteId}/sippeers/{sippeerId}/products/messaging/features/mms

Request Body Fields

The fields below should be formatted as XML elements and put in the request body as shown in the example below.

FieldRequiredDescription
ProtocolYesMUST BE SET TO HTTP

Example

POST https://api.bandwidth.com/api/accounts/{accountId}/sites/{siteId}/sippeers/{sippeerId}/products/messaging/features/mms HTTP/1.1
Content-Type: application/xml; charset=utf-8
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

<MmsFeature>
<MmsSettings>
<Protocol>HTTP</Protocol>
</MmsSettings>
<Protocols>
<HTTP>
<HttpSettings />
</HTTP>
</Protocols>
</MmsFeature>

Create an Application via the API

After assigning the phone number you've ordered to a location, you must create a messaging or voice application and assign it to the location that has the phone number you would like to use.

info

For more information about our applications API, check out our Applications Guide.

Create a Messaging Application via the API

This section walks though creating a messaging application.

Request URL
POSThttps://api.bandwidth.com/api/accounts/{accountId}/applications
Request Body Fields

The fields below should be formatted as XML elements and put in the request body as shown in the example below.

FieldRequiredDescription
ServiceTypeYesSet to Messaging-V2
AppNameYesPlain text name of the application
MsgCallbackUrlYesUrl to receive all message events
CallbackCredsNoBasic auth credentials to apply to your message events
CallbackCreds.UserIdNoBasic auth UserId
CallbackCreds.PasswordNoBasic auth Password
Example
POST https://api.bandwidth.com/api/accounts/{accountId}/applications HTTP/1.1
Content-Type: application/xml; charset=utf-8
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

<Application>
<ServiceType>Messaging-V2</ServiceType>
<AppName>Production Server</AppName>
<MsgCallbackUrl>https://yourSecureSite.com/callbacks</MsgCallbackUrl>
<CallbackCreds>
<UserId>Your-User-id</UserId>
<Password>Your-Password</Password>
</CallbackCreds>
</Application>

Assign a Messaging Application to Location

This walks through assigning a messaging application to a location and enabling V2 messaging on that location. An application must be assigned to a location, the application assigned to the location will run on voice and messaging events for the numbers on the location.

Request URL
PUThttps://api.bandwidth.com/api/accounts/{accountId}/sites/{siteId}/sippeers/{sippeerId}/products/messaging/applicationSettings
Request Body Fields

The fields below should be formatted as XML elements and put in the request body as shown in the example below.

FieldRequiredDescription
HttpMessagingV2AppIdYesThe application ID from the application created above
Example
PUT https://api.bandwidth.com/api/accounts/{accountId}/applications HTTP/1.1
Content-Type: application/xml; charset=utf-8
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

<ApplicationsSettings>
<HttpMessagingV2AppId>590cde45-c05d-44e3-a77a-59fd10f17c26</HttpMessagingV2AppId>
</ApplicationsSettings>

Create a Voice Application via the API

This section walks though creating a voice application.

Request URL
POSThttps://api.bandwidth.com/api/accounts/{accountId}/applications
Request Body Fields

The fields below should be formatted as XML elements and put in the request body as shown in the example below.

FieldRequiredDescription
ServiceTypeYesSet to Voice-V2
AppNameYesPlain text name of the application
CallInitiatedCallbackUrlYesUrl to receive actionable voice events
CallStatusCallbackUrlNoUrl to receive voice events NOT related to Initiated. Such as: rejected or hung up
CallbackCredsNoBasic auth credentials to apply to your voice events
CallbackCreds.UserIdNoBasic auth UserId
CallbackCreds.PasswordNoBasic auth Password
Example
POST https://api.bandwidth.com/api/accounts/{accountId}/applications HTTP/1.1
Content-Type: application/xml; charset=utf-8
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

<Application>
<ServiceType>Voice-V2</ServiceType>
<AppName>Setup Test Voice</AppName>
<CallInitiatedCallbackUrl>https://yourSecureSite.com/callbacks/init</CallInitiatedCallbackUrl>
<CallStatusCallbackUrl>https://yourSecureSite.com/callbacks/status</CallStatusCallbackUrl>
<CallbackCreds>
<UserId>Your-User-id</UserId>
<Password>Your-Password</Password>
</CallbackCreds>
</Application>

Assign a Voice Application to Location

This walks through assigning a voice application to a location and enabling HTTP Voice on that location. An application must be assigned to a location, the application assigned to the location will run on voice and messaging events for the numbers on the location.

Request URL
POSThttps://api.bandwidth.com/api/accounts/{accountId}/sites/{siteId}/sippeers/{sippeerId}/products/origination/settings
Request Body Fields

The fields below should be formatted as XML elements and put in the request body as shown in the example below.

FieldRequiredDescription
VoiceProtocolYesMUST BE SET TO HTTP
HttpSettingsYesParent element for HTTP settings
HttpVoiceV2AppIdYesThe applicationId of the Voice application created above
Example
POST https://api.bandwidth.com/api/accounts/{accountId}/sites/{siteId}/sippeers/{sippeerId}/products/origination/settings HTTP/1.1
Content-Type: application/xml; charset=utf-8
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

<SipPeerOriginationSettings>
<VoiceProtocol>HTTP</VoiceProtocol>
<HttpSettings>
<HttpVoiceV2AppId>{voice-applicationId}</HttpVoiceV2AppId>
</HttpSettings>
</SipPeerOriginationSettings>

Order a Phone Number

Account Setup 4

Now that your Account is set up, you're ready to order a phone number and begin communicating with Bandwidth! This step is the same whether you set up your account through the Bandwidth App or the API above.

For a guide on ordering phone numbers in the Bandwidth App, click here!

For a guide on ordering phone numbers via the Bandwidth API, click here!

Next steps

Set up your API Credentials

Create your API Credentials to validate your API calls.

Start Developing to Our Voice and Messaging APIs

After you've completed your account set-up tasks, you are ready to send your first text message or create your first phone call. For help, check out our SDK's and Postman Collection.