API Call to Start Job Fails with 401 Unauthorized (access_denied) on Community Cloud Tenant

Hello UiPath Community,

I am having a persistent issue trying to start an unattended job via the Orchestrator API. Every attempt to get an authentication token from https://account.uipath.com/oauth/token fails with a 401 Unauthorized ("access_denied") error.

I have spent many hours troubleshooting this and have confirmed it is not a configuration error on my side.

My Setup:

  • Orchestrator: Community Cloud (https://cloud.uipath.com/omlet/DefaultTenant)
  • Goal: Start a process named [Snooze] in my “Shared” folder using a Python script.
  • Robot: The unattended robot is set up correctly, installed in Service Mode, and can run the job successfully when started manually from the Orchestrator website.

Troubleshooting Steps Taken:

I have tried two different methods to get API credentials, and both have failed with the same 401 error:

  1. External Application Credentials:
  • Created a new application in Admin > External Applications.
  • Gave it Confidential Application type.
  • Assigned scopes: OR.Jobs, OR.Execution, and OR.Robots.
  • Used the generated Application ID and Application Secret for the client_id and client_secret.
  • Result: 401 Unauthorized error.
  1. Machine Template Credentials:
  • Navigated to Tenant > Machines and edited my Machine Template.
  • Used the Client ID / Machine key and a newly generated Client Secret from the machine’s Authentication details.
  • Result: 401 Unauthorized error.

Final Proof:

I have confirmed this failure is not related to my script by testing both sets of credentials directly in Postman. In all cases, the request to the OAuth token endpoint returns a 401 Unauthorized error.

It appears there is an issue with the authentication service for my specific tenant that is preventing any API credentials from being validated. Could someone from the UiPath team please investigate my cloud tenant’s backend configuration?

Thank you for your help.
system

Hello @Emma2,

The issue is not on your side. It looks like the tenant’s authentication backend may be misconfigured or broken, preventing any API credentials from being validated.

1 Like

@Emma2,

Check you External App scope. If you have provided the right access.

Hello,

Thank you for the suggestion. I have double-checked the application scopes and can confirm they are set correctly. I have assigned OR.Jobs, OR.Execution, and OR.Robots.

Please see the attached screenshot.

The 401 Unauthorized error still persists even with these scopes, and the issue is present even when testing directly in Postman.

Hi @Emma2

URL in your screenshot you are using to get token is incorrect.

Retrieve Get Access Token using endpoint(GET):
https://cloud.uipath.com/{{your org name}}/identity_/connect/token

Try and let me know if you are able to get the token.

Hello @sonaliaggarwal47,

Thank you so much! You were absolutely right. The URL was the key to solving my 401 Unauthorized error. My authentication was failing because I was using the generic account.uipath.com endpoint.

After I changed the URL to https://cloud.uipath.com/{your_org_name}/identity_/connect/token as you suggested, I was able to connect.

For anyone else facing this, I also had to make two other changes in Postman to fix the 400 Bad Request errors that followed:

  1. The request method must be POST.
  2. The Body type must be x-www-form-urlencoded, not raw JSON.
  3. I had to remove the scope parameter from the request body.

After those changes, I finally received a successful 200 OK and an access token.

1 Like

Hi @Emma2

Glad to know I could help :slight_smile:

Kindly consider marking the post as solution so this topic can be closed and help others with similar issue.

Regards
Sonali

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.