Start a job using javascript/nodejs

Hello guys,

i want to start a robot via api call.

I managed to implement the neccessary code to get the token (Thanks for the guys who helped me out with this).


After getting the token(oauth v2) how could i start a robot using javascript/nodejs ?

So many documentation are outdated and not valid.

Please help

You can look at below example and modify to match your details:

var axios = require('axios');
var data = JSON.stringify({
  "startInfo": {
    "ReleaseKey": "d9fa4ce6-0d50-42cb-8af7-109b419aa39a",
    "JobsCount": 1,
    "JobPriority": "Normal",
    "Strategy": "ModernJobsCount",
    "ResumeOnSameContext": false,
    "RuntimeType": "Unattended",
    "InputArguments": "{}",
    "MachineRobots": [
        "RobotId": ROBOT_ID,
        "MachineId": MACHINE_ID

var config = {
  method: 'post',
  url: '',
  headers: { 
    'X-UIPATH-OrganizationUnitId': 'FOLDER_ID', 
    'Accept': 'application/json, text/plain, */*', 
    'Content-Type': 'application/json', 
    'Authorization': 'Bearer ey...'
  data : data

.then(function (response) {
.catch(function (error) {

Let us know if this helped.

1 Like

Hi @alirida.alhalass,

I would suggest Thunder Client (extension in VS code), the extension allows you to create API calls to your Orchestrator. To look at different rest endpoints you can navigate to your orchestrator instance and add /swagger in the end.

For example https://YOURORCHINSTANCE/swagger

Thunder Client - Visual Studio Marketplace

Why use Thunder Client? Simply because it generates the API calls for you in many langauges and you could use this suggestion as a starting point in your preferred language and module.

1 Like

Where do i get the machine id and robot id ?
it is weird because now i get as an output “invalid_client”

For /odata/Jobs/UiPath.Server.Configuration.OData.StartJobs you need this permission OR.Jobs or OR.Jobs.Write in the External application and Auth Token.

In order to get the ReleaseKey use this endpoint /odata/Releases (OR.Execution or OR.Execution.Read)

In order to get the ROBOT_ID use this endpoint /odata/Robots (OR.Robots or OR.Robots.Read)

If you cannot get your Robots details, use this endpoint:$top=1000&$expand=User&$orderby=User/FullName%20asc

In order to get the MACHINE_ID use this endpoint /odata/Machines (OR.Machines or OR.Machines.Read)

Please open your Swagger documentation and check your Orchestrator endpoints and resources:

For Cloud:

For On-Premise:

1 Like

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