# Uipath Typescript Sdk

> Write, debug, and explain code that uses the UiPath TypeScript SDK (@uipath/uipath-typescript) to talk to UiPath Automation Cloud. Use this whenever the user is

- Skill: `csiddhant796-blip/uipath-typescript-sdk` (Agent Skill, multi-file: 9 files)
- Install (CLI): `npx get-skill add csiddhant796-blip/uipath-typescript-sdk`
- Raw SKILL.md: https://api.skillmd.com/api/skills/csiddhant796-blip/uipath-typescript-sdk/raw
- Safety review: pending
- Works with: any agent that reads SKILL.md (Claude Code, Claude.ai, Cursor, Codex, Windsurf, 60+ more)
- Category: Coding & Dev Tools
- Author: csiddhant796-blip (https://skillmd.com/u/csiddhant796-blip)
- Updated: 2026-12-05
- Page: https://skillmd.com/skills/csiddhant796-blip/uipath-typescript-sdk

---

---
name: uipath-typescript-sdk
description: >-
  Write, debug, and explain code that uses the UiPath TypeScript SDK
  (@uipath/uipath-typescript) to talk to UiPath Automation Cloud. Use this
  whenever the user is building or editing a UiPath Coded App, dashboard, or any
  TypeScript/JavaScript that calls UiPath — initializing/authenticating the SDK
  (OAuth, PAT/secret, or Coded App), starting or monitoring Orchestrator Jobs,
  Processes, Queues, Assets, Buckets, or Attachments, working with Action Center
  Tasks, reading/writing Data Fabric Entities or ChoiceSets, controlling Maestro
  processes/cases and their running instances, or wiring up Conversational
  Agents. Trigger this even when the user only says things like "UiPath SDK",
  "coded app", "Orchestrator API in code", "Action Center task in TypeScript",
  pastes UiPath TS SDK code, or is working on the vendor-risk-orchestrator /
  Third-Party Risk Gate project. Prefer this over guessing method names — the
  SDK has several non-obvious return-type and folder-scoping rules that are easy
  to get wrong from memory.
---

# UiPath TypeScript SDK

The `@uipath/uipath-typescript` package is a typed client for UiPath Automation
Cloud. You use it to build Coded Apps and dashboards that read and control
Orchestrator (Jobs, Processes, Queues, Assets, Buckets, Tasks/Action Center),
Data Fabric (Entities, ChoiceSets), Maestro (processes, cases, and their running
instances), and Conversational Agents.

This SKILL.md covers the setup, the few rules that break code if you get them
wrong, and a map of which reference file to read for each service. **Read the
relevant reference file before writing more than a trivial snippet** — the
method signatures there are the source of truth; do not invent method names or
parameters from memory.

## Install and import

```bash
npm install @uipath/uipath-typescript
```

Two import styles exist. **Prefer the modular style** — it keeps the bundle
small by pulling in only the services you use:

```ts
import { UiPath } from '@uipath/uipath-typescript/core';
import { Tasks } from '@uipath/uipath-typescript/tasks';

const sdk = new UiPath({ /* config */ });
await sdk.initialize();          // see auth rules below
const tasks = new Tasks(sdk);    // construct each service with the sdk
```

The all-in-one style also works but bundles every service whether you use it or
not: `import { UiPath } from '@uipath/uipath-typescript'` then `sdk.tasks.getAll()`.

## Critical rules (these are the things that break SDK code)

### 1. OAuth must call `initialize()`; secret/PAT does not
- **OAuth**: you MUST `await sdk.initialize()` before calling any service, and it
  must succeed. Wrap it in try/catch.
- **Secret / PAT (Personal Access Token) / Bearer token**: the SDK
  auto-initializes when you construct it — calling `initialize()` is not needed.
- **Coded App** (deployed on the platform): construct with `new UiPath()` (no
  args) — config is injected as meta tags — then `await sdk.initialize()`.

See `references/auth-and-setup.md` for all three flows, the OAuth callback
helpers (`completeOAuth`, `isInOAuthCallback`, etc.), `updateToken()` for
externally-managed tokens, and a runnable auth test script.

### 2. The return type of `getAll`/list methods depends on whether you pass pagination options
For most paginated services, `getAll()` (and similar list methods) returns:
- a `NonPaginatedResponse<T>` (has `.items` and `.totalCount`) when you pass **no**
  pagination options, or
- a `PaginatedResponse<T>` (adds `.hasNextPage`, `.nextCursor`, `.previousCursor`,
  etc.) when you pass **any** of `pageSize`, `cursor`, or `jumpToPage`.

Because the type is conditional, TypeScript needs a cast when you chain cursors:

```ts
let page = await assets.getAll({ pageSize: 10 }) as PaginatedResponse<AssetGetResponse>;
while (page.hasNextPage) {
  page.items.forEach(a => console.log(a.name));
  page = await assets.getAll({ cursor: page.nextCursor }) as PaginatedResponse<AssetGetResponse>;
}
```

### 3. Not every `getAll` returns `.items` — some return a plain array
This is the single easiest mistake to make. These methods return a **plain
array** (iterate directly, no `.items`):
- `entities.getAll()` → `EntityGetResponse[]`
- `choicesets.getAll()` → `ChoiceSetGetAllResponse[]`
- `maestroProcesses.getAll()` → array
- `cases.getAll()` → array
- `conversationalAgent.getAll()` → `AgentGetResponse[]`
- the Maestro/Cases analytics methods (`getTopRunCount`, `getInstanceStatusTimeline`, etc.) → arrays

Everything else with pagination (`assets`, `jobs`, `processes`, `queues`,
`buckets`, `tasks`, `processInstances`, `caseInstances`, `conversations`,
`exchanges` `getAll`; `entities.getAllRecords()`/`queryRecordsById()`;
`buckets.getFiles()`/`getFileMetaData()`; `choicesets.getById()`) returns the
`.items`-wrapped response from rule 2. When in doubt, check the reference file.

### 4. Folder scoping: Orchestrator uses `folderId` (number), Maestro uses `folderKey` (string GUID)
- Orchestrator `getById` and most operations **require** a numeric `folderId`.
  Many `getAll`/`getByName`/`start` methods also accept folder scoping as
  `folderId`, `folderKey` (GUID), or `folderPath` (e.g. `'Shared/Finance'`).
- Maestro process/case **instance** methods (`getById`, `cancel`, `pause`,
  `resume`, `close`, `reopen`, `getIncidents`, `getVariables`, `getBpmn`) take a
  string **`folderKey`**, not a numeric folderId.
- `tasks.complete(...)` and `tasks.create(...)` require `folderId` as a second
  argument.

### 5. Objects returned by `getById`/`getAll` carry bound methods
Returned entities are not plain data — they have operations bound to them. e.g.
`task.assign({ userId })`, `job.getOutput()`, `instance.cancel()`,
`entity.insertRecord({...})`, `conversation.startSession()`. You can call the
service method (`tasks.assign({ taskId, userId })`) or the bound instance method
(`task.assign({ userId })`) interchangeably — the bound form fills in the ids
for you.

### 6. `jobs.getAll()` never includes input/output
`inputArguments`, `inputFile`, `outputArguments`, and `outputFile` are always
`null` in `getAll` results. To read a job's output, call
`jobs.getOutput(jobKey, folderId)` (or `job.getOutput()`).

## Pagination

The pagination model (cursor navigation + optional page-jumping), the
`PaginationOptions` / `PaginatedResponse<T>` shapes, and the table of which
methods support `jumpToPage` live in `references/pagination.md`. Read it whenever
you build a list view or iterate over more than one page.

## Service map — which reference to read

| You're working with… | Read |
| --- | --- |
| SDK init, OAuth/PAT/Coded-App auth, token handling | `references/auth-and-setup.md` |
| Paging through any list, cursors, page-jump | `references/pagination.md` |
| Jobs (start/monitor/restart/resume/stop/output), Processes (start by key/name) | `references/orchestrator-jobs-processes.md` |
| Action Center Tasks (get/create/complete/assign/reassign/unassign, users) | `references/action-center-tasks.md` |
| Assets, Queues, Buckets (files/upload/download), Attachments | `references/orchestrator-storage.md` |
| Data Fabric Entities (records CRUD, attachments, queries) and ChoiceSets | `references/data-fabric.md` |
| Maestro processes & cases + their running instances (lifecycle, incidents, SLA, analytics) | `references/maestro.md` |
| Conversational Agents (real-time WebSocket streaming, history) | `references/conversational-agents.md` |

## Where this fits the vendor-risk-orchestrator project

The Third-Party Risk Gate runs a Maestro workflow that scores vendors, routes
risky ones to a human reviewer, and keeps an audit trail. If you build a Coded
App / dashboard on top of it with this SDK, the high-value areas are, in rough
order:

1. **Action Center Tasks** (`action-center-tasks.md`) — the human-in-the-loop
   review. Listing pending review tasks, showing the brief, and completing a
   task with an Approve/Reject action is the core interaction.
2. **Maestro** (`maestro.md`) — monitoring process/case instances, their status,
   incidents, and SLA; pausing/resuming/cancelling a run from a dashboard. Use
   the `folderKey` (string) scoping rule here.
3. **Jobs & Processes** (`orchestrator-jobs-processes.md`) — starting an
   automation and polling a job to a final state.
4. **Data Fabric Entities or Queues** (`data-fabric.md` / `orchestrator-storage.md`)
   — if the audit trail / vendor records are stored as Data Fabric records or
   Orchestrator queue items, this is how you read and write them.
5. **Auth** (`auth-and-setup.md`) — a deployed Coded App uses the zero-arg
   `new UiPath()` flow; local dev/standalone uses OAuth or a PAT.

Conversational Agents (`conversational-agents.md`) is the SDK's chat-streaming
API and is most likely **not** needed for this project — the project's "Agent
Builder" agents are a different platform feature. Read that reference only if you
are explicitly building a real-time chat UI.

## General guidance
- Always check the reference file for exact signatures before writing code; the
  SDK's conditional return types and folder-scoping rules are hard to remember.
- Prefer the modular imports.
- Wrap OAuth `initialize()` and any operation that can fail (stop/restart/resume,
  uploads, completions) in try/catch.
- Treat the uploaded SDK docs as the authority. If something you need isn't in
  the references and isn't in the docs, say so rather than guessing a method.

