How to Query Purecloud for Phone Numbers Assigned to Inactive Users

Purecloud does not have an in app feature that allows you to list inactive users who still have a DID assigned.  This will allow you to perform a search.   Most usable before purchasing a new phone number.

NOTE:  All DID should be assigned to the users as there Primary Work number and only have Voice chosen.   Never SMS.

Go to the API Exporer here.  You may need to login with Okta.

https://developer.mypurecloud.com/developer-tools/#/api-explorer

1.	On the left go to Users
2.	Select GET below Directreports

3.	Put page size to 1000
4.	Put page number to 1
5.	For state enter Inactive
6.	Click Send Request Button

7.	In the Body below you will see a large xml output file.   
8.	Copy all the text and past in a text file editor
9.	Search for the phrase  (   "type": "WORK",  )
10.	Every instance where that shows up you will see the person that the number is assigned to.
11.	In the below example Alejandro Flores is a deactivated user who has a DID assigned.

12.	Open the Purecloud app.
13.	Goto Admin
14.	Goto DID Numbers
15.	Make sure it’s set to View: All and type in the phone number
16.	Select DID Number
17.	If we own the number it will show.  If it is assigned to anything it will show.  
18.	If it shows as assigned to a user.  Click on that user and remove the phone number
19.	Make sure the phone number is unassigned in our Salesforce Phone number app.