Table of Contents
Overview
The UiPath TypeScript SDK is a comprehensive, type-safe library for interacting with UiPath Platform services. Built with modern TypeScript, it provides seamless integration for both browser and Node.js applications, enabling developers to build sophisticated automation solutions with enterprise-grade reliability.
Getting Started
Prerequisites
- Node.js 18.x or higher
- npm 8.x or higher (or yarn/pnpm)
- TypeScript 4.5+ (for TypeScript projects)
Installation
npm install @uipath/uipath-typescript
yarn add @uipath/uipath-typescript
pnpm add @uipath/uipath-typescript
Quick Start
import { UiPath } from '@uipath/uipath-typescript/core';
import { MaestroProcesses } from '@uipath/uipath-typescript/maestro-processes';
import { Tasks } from '@uipath/uipath-typescript/tasks';
const sdk = new UiPath({
baseUrl: 'https://cloud.uipath.com',
orgName: 'your-organization',
tenantName: 'your-tenant',
clientId: 'your-client-id',
redirectUri: 'your-redirect-uri',
scope: 'your-scopes'
});
await sdk.initialize();
const maestroProcesses = new MaestroProcesses(sdk);
const tasks = new Tasks(sdk);
const processes = await maestroProcesses.getAll();
const allTasks = await tasks.getAll();
Authentication
Authentication Methods
The SDK supports two authentication methods:
For OAuth, first create a non confidential External App with the required scopes and provide the clientId, redirectUri, and scope here.
1. OAuth Authentication (Recommended)
import { UiPath } from '@uipath/uipath-typescript/core';
const sdk = new UiPath({
baseUrl: 'https://cloud.uipath.com',
orgName: 'your-organization',
tenantName: 'your-tenant',
clientId: 'your-client-id',
redirectUri: 'your-redirect-uri',
scope: 'your-scopes'
});
await sdk.initialize();
2. Secret-based Authentication
import { UiPath } from '@uipath/uipath-typescript/core';
const sdk = new UiPath({
baseUrl: 'https://cloud.uipath.com',
orgName: 'your-organization',
tenantName: 'your-tenant',
secret: 'your-secret'
});
SDK Initialization
When to Use initialize()
The initialize() method completes the authentication process for the SDK:
- Secret Authentication: Auto-initializes when creating the SDK instance - no need to call initialize()
- OAuth Authentication: MUST call
await sdk.initialize() before using any SDK services
Example: Secret Authentication (Auto-initialized)
import { UiPath } from '@uipath/uipath-typescript/core';
import { Tasks } from '@uipath/uipath-typescript/tasks';
const sdk = new UiPath({
baseUrl: 'https://cloud.uipath.com',
orgName: 'your-organization',
tenantName: 'your-tenant',
secret: 'your-secret'
});
const tasks = new Tasks(sdk);
const allTasks = await tasks.getAll();
Example: OAuth Authentication (Requires initialize)
import { UiPath } from '@uipath/uipath-typescript/core';
import { Tasks } from '@uipath/uipath-typescript/tasks';
const sdk = new UiPath({
baseUrl: 'https://cloud.uipath.com',
orgName: 'your-organization',
tenantName: 'your-tenant',
clientId: 'your-client-id',
redirectUri: 'http://localhost:3000',
scope: 'your-scopes'
});
try {
await sdk.initialize();
console.log('SDK initialized successfully');
const tasks = new Tasks(sdk);
const allTasks = await tasks.getAll();
} catch (error) {
console.error('Failed to initialize SDK:', error);
}
OAuth Integration Patterns
View Integration Patterns
Auto-login on App Load
import { UiPath } from '@uipath/uipath-typescript/core';
useEffect(() => {
const initSDK = async () => {
const sdk = new UiPath({...oauthConfig});
await sdk.initialize();
};
initSDK();
}, []);
User-Triggered Login
const onLogin = async () => {
await sdk.initialize();
};
const oauthCompleted = useRef(false);
useEffect(() => {
if (sdk.isInitialized() && !oauthCompleted.current) {
oauthCompleted.current = true;
sdk.completeOAuth();
}
}, []);
Available OAuth Methods
sdk.initialize() - Start OAuth flow (auto completes also based on callback state)
sdk.isInitialized() - Check if SDK initialization completed
sdk.isAuthenticated() - Check if user has valid token
sdk.isInOAuthCallback() - Check if processing OAuth redirect
sdk.completeOAuth() - Manually complete OAuth (advanced use)
Usage
The SDK provides access to the following services through modular imports:
MaestroProcesses from @uipath/uipath-typescript/maestro-processes - Manage agentic maestro processes
ProcessInstances from @uipath/uipath-typescript/maestro-processes - Manage maestro process executions
Cases from @uipath/uipath-typescript/cases - Manage maestro case management processes
CaseInstances from @uipath/uipath-typescript/cases - Manage maestro case executions
Tasks from @uipath/uipath-typescript/tasks - Create and manage tasks
Entities from @uipath/uipath-typescript/entities - Data Fabric entity operations
ChoiceSets from @uipath/uipath-typescript/entities - Data Fabric choice set operations
Processes from @uipath/uipath-typescript/processes - Manage Orchestrator processes
Buckets from @uipath/uipath-typescript/buckets - Manage storage buckets in Orchestrator
Queues from @uipath/uipath-typescript/queues - Manage Orchestrator queues
Assets from @uipath/uipath-typescript/assets - Manage Orchestrator assets
ConversationalAgent from @uipath/uipath-typescript/conversational-agent - Interact with Conversational Agents (real-time streaming, conversations, sessions)
View Example Usage
import { UiPath } from '@uipath/uipath-typescript/core';
import { MaestroProcesses, ProcessInstances } from '@uipath/uipath-typescript/maestro-processes';
import { Cases, CaseInstances } from '@uipath/uipath-typescript/cases';
import { Tasks, TaskType } from '@uipath/uipath-typescript/tasks';
import { Processes } from '@uipath/uipath-typescript/processes';
import { Buckets } from '@uipath/uipath-typescript/buckets';
import { ChoiceSets, Entities } from '@uipath/uipath-typescript/entities';
const sdk = new UiPath({ });
const maestroProcesses = new MaestroProcesses(sdk);
const processInstances = new ProcessInstances(sdk);
const cases = new Cases(sdk);
const caseInstances = new CaseInstances(sdk);
const tasks = new Tasks(sdk);
const processes = new Processes(sdk);
const buckets = new Buckets(sdk);
const entities = new Entities(sdk);
const choiceSets = new ChoiceSets(sdk);
const allProcesses = await maestroProcesses.getAll();
const instances = await processInstances.getAll({
processKey: 'my-process',
pageSize: 10
});
await processInstances.pause(instanceId, 'folder-key');
await processInstances.resume(instanceId, 'folder-key');
await processInstances.cancel(instanceId, 'folder-key', {
comment: 'Cancelled due to error'
});
await processInstances.retry(instanceId, 'folder-key', {
comment: 'Retrying flaky failure'
});
const caseInstance = await caseInstances.getById(instanceId, 'folder-key');
const stages = await caseInstances.getStages(instanceId, 'folder-key');
await caseInstances.close(instanceId, 'folder-key', {
comment: 'Case resolved successfully'
});
const result = await processes.start({
processKey: 'MyProcess_Key',
}, folderId);
const task = await tasks.create({
title: 'Review Invoice',
priority: 'High'
}, folderId);
await tasks.assign({
taskId: task.id,
userNameOrEmail: 'user@company.com'
}, folderId);
await tasks.complete(TaskType.App, {
taskId: task.id,
data: {},
action: 'submit'
}, folderId);
const bucket = await buckets.getById(bucketId, folderId);
const fileMetadata = await buckets.getFileMetaData(bucketId, folderId, {
prefix: '/invoices/'
});
await buckets.uploadFile({
bucketId: bucketId,
folderId: folderId,
prefix: '/folder1'
});
const downloadUrl = await buckets.getReadUri({
bucketId: bucketId,
folderId: folderId,
path: '/folder/file.pdf'
});
const entity = await entities.getById('entity-uuid');
const records = await entities.getAllRecords('entity-uuid', {
pageSize: 100,
expansionLevel: 1
});
const allChoiceSets = await choiceSets.getAll();
await entities.insertRecordsById('entity-uuid', [
{ name: 'John Doe', email: 'john@company.com', status: 'Active' },
{ name: 'Jane Smith', email: 'jane@company.com', status: 'Active' }
]);
await entities.updateRecordsById('entity-uuid', [
{ Id: 'record-id-1', status: 'Inactive' }
]);
await entities.deleteRecordsById('entity-uuid', ['record-id-1', 'record-id-2']);
Samples
Check out the /samples folder to see sample applications built using the SDK:
- process-app: A Maestro process management application demonstrating OAuth authentication and SDK usage
- conversational-agent-app: A Conversational Agent chat application with real-time streaming, conversation management, file attachments, tool call visualization, and feedback
- dashboards/agent-runtime-compliance: An Agent Runtime Compliance dashboard showing failed compliance checks, enforcement outcomes, failure reasons, and per-run compliance reports via the Agent Traces governance APIs
Development
Before submitting a pull request, please review our Contribution Guidelines.
Running Documentation Locally
To build and serve the documentation locally using MkDocs:
Prerequisites:
- Python
- Node.js 18.x or higher
- npm 8.x or higher
Steps:
pip3 install -r docs/requirements.txt
npm run docs:api
mkdocs build
mkdocs serve