Hybrid - Delete And Disconnect A Phone Number

Follow

Daniel Tolbert

Updated

Table of Contents

Steps

App.Bandwidth.com Phone Number Removal (Un-Import)

Dashboard.Bandwidth.com (Delete Completely)

 

This guide will take you through the process of deleting and disconnecting a phone number from both your Voice & Messaging account AND your Phone Number (dashboard) account.

It's worth noting that the phone numbers managed in the voice & messaging dashboard  (API: api.catapult.inetwork.com) for your account are to only enable them for use with the programmatic API. You are billed for the phone numbers managed in the phone number dashboard (API: https://dashboard.bandwidth.com/api/)

 

STEPS

(Assumes phone number has been ordered and imported successfully)

  1. Find {number-id} from standard phone number +18283334444 -> (app.bandwidth.com)
  2. DELETE (un-import) the phone number using the {number-id} -> (app.bandwidth.com)
  3. Create a disconnect order -> (dashboard.bandwidth.com)
  4. Check disconnect status (or) receive callback -> (dashboard.bandwidth.com)

 

APP.BANDWIDTH.COM PHONE NUMBER REMOVAL (UN-IMPORT)

This will remove the phone number from your Voice & Messaging account, so it'll no longer be able to be used for programmatic control. But you'll still be billed for the phone number unless also removed from your Dashboard account.

The phone numbers are managed at the /phoneNumbers resource. Link to documentation.

To Delete the number, you need to know it's {number-id}. This is different from the actual phone number +18283334444. This was sent as part of the Location header when importing the number.

 

Find Number-id

GET https://api.catapult.inetwork.com/v1/users/{{UserId}}/phoneNumbers/+18283334444 HTTP/1.1
Authorization: {apiToken:apiSecret}

 

Responds

Status: 200 OK
Content-Type: application/json; charset=utf-8

{

  "application"    : "https://api.catapult.inetwork.com/v1/users/{{UserId}}/applications/a-asdf",
  "id"             : "n-alghk4678lkghsdf",
  "applicationId"  : "a-asdf",
  "number"         : "+19192302749",
  "nationalNumber" : "(919) 230-2749",
  "name"           : "+19197258959",
  "createdTime"    : "2018-04-23T18:22:38Z",
  "city"           : "CARY",
  "state"          : "NC",
  "price"          : "0.35",
  "numberState"    : "enabled"
}

Note that the {number-id} is the id value of the returned payload. In this case: n-alghk4678lkghsdf

 

Delete number with {number-id}

Following the docs to delete the phone number, will un-import the number from your account.

DELETE https://api.catapult.inetwork.com/v1/users/{{UserId}}/phoneNumbers/n-alghk4678lkghsdf HTTP/1.1
Authorization: {apiToken:apiSecret}

 

Responds

Status: 200 OK

 

DASHBOARD.BANDWIDTH.COM (DELETE COMPLETELY)

To remove the number from your dashboard account, you'll have to create a disconnect request for the desired phone number. This is a bit more involved as the request is asynchronous versus synchronous for the voice & messaging dashboard. Link to doc.

You can verify disconnect/delete status two different ways (this guide only covers the first):

  1. Create the request and poll until status: complete
  2. Setup a callback request to be notified in real-time to an API when orders/disconnects complete.

⚠️ Note that the API is different https://dashboard.bandwidth.com/api and your Authorization is now your username and password that you use to sign in to dashboard.bandwidth.com and not your api-token and api-secret from app.bandwidth.com and instead of user-id you need to know your accountId. You can learn more about security.

 

Create disconnect request

To create the request, you now need the phone number again 8283334444 (not the number-id, and without the +1). The phone number is contained in the <TelephoneNumber> as part of the <TelephoneNumberList> within the <DisconnectTelephoneNumberOrderType>

POST https://dashboard.bandwidth.com/api/accounts/{{accountId}}/disconnects HTTP/1.1
Content-Type: application/xml; charset=utf-8
Authorization: {user:password}

<?xml version="1.0"?>
<DisconnectTelephoneNumberOrder>
    <name>Delete Number</name>
    <DisconnectTelephoneNumberOrderType>
        <TelephoneNumberList>
            <TelephoneNumber>8283334444</TelephoneNumber>
        </TelephoneNumberList>
    </DisconnectTelephoneNumberOrderType>
</DisconnectTelephoneNumberOrder>

 

Responds

HTTP/1.1 201 Created
Content-Type: application/xml; charset=utf-8
Location: https://dashboard.bandwidth.com/api/accounts/{{accountId}}/disconnects/df2gc2e2-653d-466c-945d-8f292f09ce55

<?
xml version="1.0" encoding="UTF-8" standalone="yes"?>
<DisconnectTelephoneNumberOrderResponse>
    <orderRequest>
        <OrderCreateDate>2018-05-29T16:01:13.014Z</OrderCreateDate>
        <id>62ba44f0-f2fb-4509-9132-bd0507d8671a</id>
        <DisconnectTelephoneNumberOrderType>
            <TelephoneNumberList>
                <TelephoneNumber>8283334444</TelephoneNumber>
            </TelephoneNumberList>
            <DisconnectMode>normal</DisconnectMode>
        </DisconnectTelephoneNumberOrderType>
    </orderRequest>
    <OrderStatus>RECEIVED</OrderStatus>
</DisconnectTelephoneNumberOrderResponse>

 

Check the disconnect to verify status

A GET Request to an existing disconnect will return it's status as well as any information originally used to create the disconnect.

GET https://dashboard.bandwidth.com/api/accounts/{{accountId}}/disconnects/df2gc2e2-653d-466c-945d-8f292f09ce55 HTTP/1.1
Content-Type: application/xml; charset=utf-8
Authorization: {user:password}

 

Responds

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<DisconnectTelephoneNumberOrderResponse>
    <DisconnectedTelephoneNumberList>
        <TelephoneNumber>8283334444</TelephoneNumber>
    </DisconnectedTelephoneNumberList>
    <orderRequest>
        <OrderCreateDate>2018-05-29T16:01:13.014Z</OrderCreateDate>
        <id>df2gc2e2-653d-466c-945d-8f292f09ce55</id>
        <DisconnectTelephoneNumberOrderType>
            <TelephoneNumberList>
                <TelephoneNumber>8283334444</TelephoneNumber>
            </TelephoneNumberList>
            <DisconnectMode>normal</DisconnectMode>
        </DisconnectTelephoneNumberOrderType>
    </orderRequest>
    <OrderStatus>COMPLETE</OrderStatus>
</DisconnectTelephoneNumberOrderResponse>

Article is closed for comments.