StartJobs API method fails with error - access_denied

I am trying to start a job in Orchestrator (UiPath Cloud Platform) via StartJobs API request. I get {“error”:“access_denied”,“error_description”:“Unauthorized”}.

I follow the About OData and References guide.

The sequence of actions are:

  • Generate Challenge and Verifier codes
  • Get Authorization Code
  • Get Refresh Token
  • Get Accounts For User
  • Get Service Instance Logical Name
  • Get Robot By Name
  • Get Process By Name
  • Start Jobs - fails with {“error”:“access_denied”,“error_description”:“Unauthorized”}

All steps except Start Jobs succeed. As per documentation methods after getting the refresh token include the following headers:

  • “Content-Type”: “application/json”,
  • “Authorization”: "Bearer " + accessToken,
  • “X-UIPATH-TenantName”: srvInstanceLogicalName

What else is missing? Tried all sorts of combinations without success. When authenticated the same method works via the swagger interface.

Can you post the body and the screenshot of request you are sending @vassil.levtchev

Body is:
“startInfo”: {
“ReleaseKey”: “f37d5b24-ba10-42ea-8d24-856e7e5c039c”,
“RobotIds”: [
“JobsCount”: 0,
“Strategy”: “Specific”

I am using python script to send the request:

payload = {"startInfo": {
	"ReleaseKey": releaseKey,
	"RobotIds": [robotID],
	"JobsCount": 0,
	"Strategy": "Specific"

hdrs = {"Content-Type": "application/json",
        "Authorization": "Bearer " + accessToken,
        "X-UIPATH-TenantName": srvInstanceLogicalName

url = "" + accLogicalName + "/" + srvInstanceLogicalName + "/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs"
    response ="", data=json.dumps(payload),headers=hdrs)

print("RESPONSE CODE: " + str(response.status_code))
if response.status_code == 200:
    print("RPA_startJob:" + response.text)
    print('Request failed')
    print("RPA_startJob:" + response.text)

I have made a stupid mistake. The URL in the post request is incorrect. All works fine now

Can you please tell me which URL need to be used to post API Http request…to run a job from Postman