Deleting Host Tenant license using API Key

How to delete the host tenant license using API key.

In order to delete the host tenant license we will have to use the below API key
 

DELETE /odata/HostLicenses({Id})


Steps to follow in order to achieve the same. 

1) On the UiPath Orchestrator database , run the below query [Recommended to take help of DBA team]. It would give you the ID which needs to be passed to the API to perform the deletion. 
Note:- Replace the Database_name with the actual database in use. 

SELECT ID  FROM [Database_name].[dbo].[HostLicenses] where IsDeleted = 0

2) Open Orchestrator website and logon with host tenant. 
Note :- Use local user instead of windows authentication. 

3) Open another tab in the browser and open swagger using the link shared below
Note:- hostname needs to be replaced with the hostname used in the Orchestrator url. 
https://hostname/swagger/ui/index#!

4) Once Swagger opens up, go to Delete License API under "Host License " Section. 

5) Provide the value of ID ( information received in step 1) and hit "Try  it Out"


Note: This feature is applicable starting from 2018.3.X version of UiPath Orchestrator.