Skip to content

Jobs

Service for managing UiPath Orchestrator Jobs.

Jobs represent the execution of a process (automation) on a UiPath Robot. Each job tracks the lifecycle of a single process run, including its state, timing, input/output arguments, and associated resources. UiPath Jobs Guide

Usage

Prerequisites: Initialize the SDK first - see Getting Started

import { Jobs } from '@uipath/uipath-typescript/jobs';

const jobs = new Jobs(sdk);
const allJobs = await jobs.getAll();

Methods

getAll()

getAll<T>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<JobGetResponse> : NonPaginatedResponse<JobGetResponse>>

Gets all jobs across folders with optional filtering and pagination.

Returns jobs with full details including state, timing, and input/output arguments. Pass folderId to scope the query to a specific folder.

Input and output fields are not included in getAll responses

The inputArguments, inputFile, outputArguments, and outputFile fields will always be null in the getAll response. To retrieve a job's output, use the getOutput method with the job's key and folderId.

Type Parameters

Type Parameter Default type
T extends JobGetAllOptions JobGetAllOptions

Parameters

Parameter Type Description
options? T Query options including optional folderId, filtering, and pagination options

Returns

Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<JobGetResponse> : NonPaginatedResponse<JobGetResponse>>

Promise resolving to either an array of jobs NonPaginatedResponse<JobGetResponse> or a PaginatedResponse<JobGetResponse> when pagination options are used. JobGetResponse

Example

// Get all jobs
const allJobs = await jobs.getAll();

// Get all jobs in a specific folder
const folderJobs = await jobs.getAll({ folderId: <folderId> });

// With filtering
const runningJobs = await jobs.getAll({
  filter: "state eq 'Running'"
});

// First page with pagination
const page1 = await jobs.getAll({ pageSize: 10 });

// Navigate using cursor
if (page1.hasNextPage) {
  const page2 = await jobs.getAll({ cursor: page1.nextCursor });
}

// Jump to specific page
const page5 = await jobs.getAll({
  jumpToPage: 5,
  pageSize: 10
});

getById()

getById(id: string, folderId: number, options?: JobGetByIdOptions): Promise<JobGetResponse>

Gets a job by its unique key (GUID).

Returns the full job details including state, timing, input/output arguments, and error information. Use expand to include related entities like robot, or machine.

Parameters

Parameter Type Description
id string The unique key (GUID) of the job to retrieve
folderId number The folder ID where the job resides
options? JobGetByIdOptions Optional query options for expanding or selecting fields

Returns

Promise<JobGetResponse>

Promise resolving to a JobGetResponse with full job details and bound methods

Examples

// Get a job by key
const job = await jobs.getById(<id>, <folderId>);
console.log(job.state, job.processName);
// With expanded related entities
const job = await jobs.getById(<id>, <folderId>, {
  expand: 'robot,machine'
});
console.log(job.robot?.name, job.machine?.name);

getOutput()

getOutput(jobKey: string, folderId: number): Promise<null | Record<string, unknown>>

Gets the output of a completed job.

Retrieves the job's output arguments, handling both inline output (stored directly on the job as a JSON string in outputArguments) and file-based output (stored as a blob attachment for large outputs). Returns the parsed JSON output or null if the job has no output.

Parameters

Parameter Type Description
jobKey string The unique key (GUID) of the job to retrieve output from
folderId number The folder ID where the job resides

Returns

Promise<null | Record<string, unknown>>

Promise resolving to the parsed output as Record<string, unknown>, or null if no output exists

Examples

// Get output from a completed job
const output = await jobs.getOutput(<jobKey>, <folderId>);

if (output) {
  console.log('Job output:', output);
}
// Get output using bound method (jobKey and folderId are taken from the job object)
const allJobs = await jobs.getAll();
const completedJob = allJobs.items.find(j => j.state === JobState.Successful);

if (completedJob) {
  const output = await completedJob.getOutput();
}

restart()

restart(jobKey: string, folderId: number): Promise<JobGetResponse>

Restarts a job in a final state (Successful, Faulted, or Stopped).

Creates a new job execution from a previously successful, faulted, or stopped job. The new job has its own unique key, starts in Pending state, and uses the same process and input arguments as the original job.

To monitor the new job's progress, poll with getById using the returned job's key until the state reaches a final value.

Parameters

Parameter Type Description
jobKey string The unique key (GUID) of the job to restart
folderId number The folder ID where the job resides

Returns

Promise<JobGetResponse>

Promise resolving to the new JobGetResponse with full job details

Example

// Restart a faulted job
const newJob = await jobs.restart(<jobKey>, <folderId>);
console.log(newJob.state); // 'Pending'
console.log(newJob.key);   // new job key (different from original)

resume()

resume(jobKey: string, folderId: number, options?: JobResumeOptions): Promise<void>

Resumes a suspended job.

Sends a resume request to a job that is currently in the Suspended state. The job transitions to Resumed and then to Running as it continues execution. Optionally pass input arguments to provide data for the resumed workflow.

Parameters

Parameter Type Description
jobKey string The unique key (GUID) of the suspended job to resume
folderId number The folder ID where the job resides
options? JobResumeOptions Optional parameters including input arguments

Returns

Promise<void>

Promise that resolves when the job is resumed successfully, or rejects on failure

Examples

// Resume a suspended job
await jobs.resume(<jobKey>, <folderId>);
// Resume with input arguments
await jobs.resume(<jobKey>, <folderId>, {
  inputArguments: { approved: true }
});

stop()

stop(jobKeys: string[], folderId: number, options?: JobStopOptions): Promise<void>

Stops one or more jobs by their UUID keys.

Sends a stop request for the specified jobs to the Orchestrator. Throws if any keys cannot be resolved.

Parameters

Parameter Type Description
jobKeys string[] Array of job UUID keys to stop (e.g., from JobGetResponse.key)
folderId number The folder ID where the jobs reside (required)
options? JobStopOptions Optional JobStopOptions including stop strategy

Returns

Promise<void>

Promise that resolves when the jobs are stopped successfully, or rejects on failure

Examples

// Stop a single job with default soft stop
await jobs.stop([<jobKey>], <folderId>);
import { StopStrategy } from '@uipath/uipath-typescript/jobs';

// Force-kill multiple jobs
await jobs.stop(
  [<jobKey1>, <jobKey2>],
  <folderId>,
  { strategy: StopStrategy.Kill }
);