Control Room API in PowerShell

  • 10 May 2022
  • 4 replies

Badge +6

I am curious if anyone has connected to the Control Room APIs through PowerShell for A360. I am attempting to assist someone that wants to kick off a taskbot through powershell via the API, but am running into a wall. I can connect easily enough and obtain the token, something like so:


$sUrl = "https://CR_URL/v1/authentication"


$body = @{

  'username' = "Username"

  'password' = "Password"



$bodyJson = $body | ConvertTo-Json


$Response1 = Invoke-RestMethod -Method Post -Uri $sURL -Body $bodyJson



However, to launch a bot I need to connect to the workspaces and find the bot file ID. To do so I need to add the token from the above step and connect to "https://CR_URL/v2/repository/workspaces/{workspaceType}/files/list". I cannot seem to get the syntax correct for adding the token to the header. I have tried a couple of variations of this:


$newURL = "https://CR_URL/v2/repository/workspaces/private/files/list"

$authVal = $Response1.token

$newBody = @{

#Body for file filter


$newBodyJson = $newBody | ConvertTo-Json

$Response2 = Invoke-RestMethod -Method Post -Uri $newURL -Body $newBodyJson -Headers @{"AUTHORIZATION"=$authVal}


I know this is just a syntax error as I can get it to work outside of PS. Was just curious if anyone has an example of making the connection and listing the CR files in PowerShell that I can look at.

4 replies

Userlevel 6
Badge +9

Hello @Jeremiah Logan​ 


Thanks for reaching out to Automation Anywhere.


You could try passing the token with Headers on the next call with the X-Authorization parameter



x-authorization="token received form older call"}


For further assistance please reach us with a Support case and our Engineers shall assist

Badge +6

Thanks, I was able to get the list to work by including the X-Authorization param. I'm now trying to get the bot deployment to work. I can connect, and get both the user ID and the Bot ID, but the deployment fails with a 400 Unauthorized. I think it has something to do with the RunAsUserIDs arraylist:


$sUrl = "<url>/v1/authentication"


$body = @{

  'username' = "username"

  'password' = "password"



$bodyJson = $body | ConvertTo-Json

$Response = Invoke-RestMethod -Method Post -Uri $sURL -Body $bodyJson


$newURL = "<url>/v2/repository/workspaces/private/files/list"

$sessionHeader = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"



$type = "application/json"


$newBody = @{

 'filter' = @{

  'operator' = "substring"

  'field' = "name"

  'value' = "AA_API_"




$newBodyJson = $newBody | ConvertTo-Json

$Response2 = Invoke-RestMethod -Method Post -Uri $newURL -Body $newBodyJson -Headers $sessionHeader -ContentType $type


$token = $Response.token

$ID = $

$botID = $Response2.list.Id


$botURL = "<url>/v3/automations/deploy"

$botBody = @{

  'fileId' = "8200"

  'runAsUserIds' = "[168]"

  'poolIds' = ""

  'overrideDefaultDevice' = "false"

  'callbackInfo' = @{

    'url' = ";

    'headers' = @{

      'X-Authorization' = "{{$($token)}}"



  'botInput' = @{

    'sInput1' = @{

      'type' = "STRING"

      'string' = "These values come "


    'sInput2' = @{

      'type' = "STRING"

      'string' = "from the API call"




$botBodyJson = $botBody | ConvertTo-Json


$Response3 = Invoke-RestMethod -Method Post -Uri $botURL -Body $botBodyJson


Badge +4

Hi @Jeremiah Logan​,


Trust you are well.

I'm trying to, build a bot to reset its own AD password and at the same time update the password in the CR.

This must be done in powershell, how where you able to connect to the Control room API using powershell?

Userlevel 3
Badge +12

I was able to connect to the CR, and manage some items, but have not had time to revisit in a while. Here are some of the things I was able to accomplish:


Authentication to the CR:>


From here I can capture the auth token with $Response.token, or the UUID with $Response.tenantUUID, so I know I am connected successfully. I can also poll the user hive with things like $ and $response.user.sysAssignedRoles. I can even list all bots in the CR, or search for one in particular:


<Start with the authentication code above>...>


Again, this is about as far as I got before getting pulled into other projects. Hope it helps you.