An organization unit is required for this action errorCode:1101

Hello everyone, I am trying to start a UiPath process from JS in Google Appscripts, but it is not working. Can someone help me? Please find below the code, but I have excluded sensitive information (IDs).

function createAndSendDocument() {
  // Make a POST request with a JSON payload.
var data = {  
  'client_id':'my client id',
  'refresh_token':my user key '
var options = {
  'method' : 'post',
  'contentType': 'application/json',
  'headers' : {'X-UIPATH-TenantName':'my tenant name'},  
  'payload' : JSON.stringify(data)
  var response = UrlFetchApp.fetch('', options);
  var jsonObject = JSON.parse(response.getContentText());
  var data2 = {    
   /* 'startInfo': {
    'ReleaseKey':'my process key',
        'startInfo': {
         'ReleaseKey':'my process key'',
          'InputArguments':'{\"param1\":\"Test Youtube Google\",\"param2\":\"Video Live 21:21\"}'
  var bear = 'Bearer '+jsonObject.access_token;
var options2 = {
  'method' : 'post',
  'contentType': 'application/json',
    'headers' : {'X-UIPATH-TenantName':'my tenant name', 'Authorization':bear,'X-UIPATH-OrganizationUnitId':'my org id'},  
  'payload' : JSON.stringify(data2)
  var response2 = UrlFetchApp.fetch(' id/tenant name/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs', options2); 

Exception: Request failed for returned code 400. Truncated server response: {“message”:“An organization unit is required for this action.”,“errorCode”:1101,“traceId”:“00-266fcedb261e5045b3fe9646fc32602c-7de4c5b3f51f8b27-01”} (use muteHttpExceptions option to examine full response)

What was the value you put for the X-UIPATH-OrganizationUnitId header? When you say ‘my org id’ did you mean the name of your automation cloud org?

Based on documentation the X-UIPATH-OrganizationUnitId header is meant to contain an integer value which is the ID number of the folder containing the process you would like to run. Example of a folder ID in my org is 152024.

Hi @Pedro_Reis_Prado

Welcome to the Community.

Would you please modify your code as per below-

var options2 = {
  'method': 'post',
  'contentType': 'application/json',
  'headers': {
    'X-UiPath-TenantName': 'my tenant name',
    'Authorization': bear,
    'X-UiPath-OrganizationUnitId': 'my org id'
  'payload': JSON.stringify(data2)

Ensure that you replace 'my org id' with the actual organization unit ID for your UiPath Orchestrator instance. You can find the organization unit ID in your Orchestrator settings.

Make sure to update the necessary values such as 'my tenant name', 'my org id', 'my process key', and other parameters with the correct values corresponding to your UiPath Orchestrator and process configuration.


Note: We recommend using instead of 'X-UIPATH-OrganizationUnitId' the 'FolderKey' header.

For accessing resources in a folder, each request must contain either the FolderId, FolderPath, or FolderKey in an HTTP header. This header may be encoded (using Base64 UTF-16LE encoding) or plain text.

For example:

  • X-UIPATH-OrganizationUnitId "FolderId",
  • X-UIPATH-FolderPath-Encoded "{Encoded FolderPath value}",
  • X-UIPATH-FolderPath "PlainText FolderPath value", or
  • X-UIPATH-FolderKey "FolderKey".

The FolderId can be obtained by performing a GET request to the /odata/Folders endpoint and copying the “Id” value, or from the Orchestrator URL - fid=2032 &tid=8. FolderId is of type Int 64.

The FolderKey can be obtained by performing a GET request to the /odata/Folders endpoint and copying the “Key” value. FolderKey is of type Unique Id/String.

If you change the licensing plan for your Orchestrator account (for example, from Enterprise Trial to Enterprise), the FolderId value also changes, whereas the FolderKey value remains the same.

If you upgraded and had Organization Units enabled in your previous Orchestrator instance, each OU is migrated as a new Classic folder.

Relative folder paths are supported in an X-UIPATH-FolderPath-Encoded header, as follows:

  • Path starting with / - starts from the root folder of the tree the ambient folder is part of.
  • Path starting with . - starts from the ambient folder.
  • Path starting with .. - starts one level up in the hierarchy of the ambient folder for each .. in the path (e.g. ../ for one level up, ../../ for two levels up in the hierarchy).

Note that trailing slashes are not accepted.