Enable Disable Toggle UiPath License Using API Call

With a single Unattended license, how to use different set of user and machine using this same Unattended license?

At times, there might be a requirement to run the different Robot processes (as part of different projects) using different service account users as the user will not want to run all the Bot processes using same account (using the single unattended license).

This may be due to their process requirements or to logically keep each of the projects separate within the same Tenant. The purpose of this KB is to explain the steps needed to accomplish this using the Orchestrator APIs. At the time of writing this, the current documentation does not give the updated instructions, hence this details the steps to be followed to accomplish the same using the Orchestrator’s APIs.

  1. Get the access token for the API’s.
  • The first step is to get the access token in order to call the Cloud Orchestrator APIs. The steps for it are already documented at Consuming Cloud API

![](upload://ozacUKu6twecPjAaYipeeKLl8Ao.png)

  1. Define the machine template (e.g. “Prod Machine Template” as given below) in the Cloud Orchestrator and copy the generated machine key for it as given below.

![](upload://ckAJDZWN8k0c49PUwp88CbPsdVC.png)

![](upload://oNaNH1gkGPH519J9IGyeZy94kA4.png)

  1. Go to the cloud Orchestrator. Admin -> Users and Groups. Create two UiPath users (that will be used to configure the service account users for logging into the VM.)

![](upload://ad3E0KTJaSyNJdwBDzZlHiFuXTr.png)

  1. Assign the Automation user role to the newly created user.

![](upload://gmokSlAAB5B4UtT1JVeoqQwCb7i.png)

  1. Assign the Unattended license ( by clicking on Edit User-> Robot setup) and enter the Windows user credentials for this user. As we need to use two different users, do this for both the users that have been created. i.e., enter the different domain / username.

![](upload://QEEGjmXdO78oN3LTBzTJLSKRow.png)

  1. Open the individual VM’s can connect the UiPath orchestrator using the machine key that you noted in step 2. Please note that both the VM’s will get connected but one of the VM will show as unlicensed (as we have just one Unattended license)

VM 1:

![](upload://h7U3e9nQDFY4F3cWAwsdltO79OK.png)

VM 2:

![](upload://yT9JGTKb8f21YlgITRW8ENqrXbj.png)

  1. Open the Cloud Orchestrator Tenant page, and click on See More for the Unattended license

![](upload://3s44nT3DZtlwAuAHkCNPgFTGOPu.png)

  1. There will be two entries for the two VM’s that have been connected. Press F12 (on Chrome) to open the developer console.

![](upload://4OjEDNlrcfu8cLcJvf1UWTKZeQ7.png)

  1. Now, hit the Active connection (to toggle the license) and observe the logs. Look for the following entry.

![](upload://rQ6NAN8LdAqvFpFu5qT8o8PmOtg.png)

The cloud.uipath.com URL should be visible as part of the logs. Please note this URL. There should also be an entry as follows in the same line.

In the Header Section :
Just add Authorization: Bearer + "Token get from first Request"
X-UIPATH-TenantName "Your tenant name"

In the Body section :
{
"key": "UseraA()", ----------------------- UserA = XX("username")@YY("Machine Template name")@ZZ(Hostname)
"robotType": "Unattended",
"enabled": False
}

  1. Now, hit the URL that you got in Step 9 in Postman along with the following payload

https://cloud.uipath.com/XX/XYTenant/orchestrator_/odata/LicensesRuntime('Prod Machine Template')/UiPath.Server.Configuration.OData.ToggleEnabled

  • Replace the URL with your cloud Orchestrator URL

"key": "<Key obtained from Step 9",

"robotType": "Unattended",

"enabled": true

}{

The enabled value will be true or false depending on whether you want to enable or disable the license on that VM.

Check the license status on the Cloud Orchestrator. It should get toggled depending on the API hit.

![](upload://uWaVgtxTazUC9H07Hwn6HUXIMN3.png)

Read more on the Unattended Non Production Licensing .