# uip resources

> Syntax and options for `uip resources`, which declares the solution resources a coded project uses in `uipath_resources.ts` or `uipath_resources.py`.

`uip resources` declares the solution resources that a coded project uses. The declarations live in one file at the project root: `uipath_resources.ts` for a project on the TypeScript SDK, or `uipath_resources.py` for a project on the Python SDK. Each resource is a typed handle that the SDK accepts in place of a plain name.

```ts

export class ProjectResources {
    static readonly invoiceThreshold = resource.asset({ name: 'InvoiceThreshold', folderPath: 'Finance/Shared', type: 'integer' });
    static readonly invoiceReview = resource.queue({ name: 'InvoiceReview' });
}
```

```python
from uipath.resources import resource

class ProjectResources:
    invoice_threshold = resource.asset(name="InvoiceThreshold", folder_path="Finance/Shared", type="integer")
    invoice_review = resource.queue(name="InvoiceReview")
```

| Subcommand | Purpose |
|---|---|
| [`add`](#add) | Declare a resource, and add it to the project's solution when the project is in one. |
| [`list`](#list) | List the resources that the project declares. |
| [`sync`](#sync) | Declare the resources of the project's local solution that the project does not declare yet. |

There is no `remove` subcommand. To remove a declaration, delete its line from the file.

`uip resources` is provided by the `@uipath/resources-tool` plugin. If it is not yet installed, `uip tools install resources` adds it. See [Tools (plugins)](./concepts-tools.md).

## Synopsis

```
uip resources add [name] [--kind <kind>] [--folder-path <path>] [--type <type>] [--skip-verify] [--project-path <path>]
uip resources list [--kind <kind>] [--limit <number>] [--offset <number>] [--project-path <path>]
uip resources sync [--all] [--solution-folder <path>] [--project-path <path>]
```

Each subcommand honours the [global options](./global-options.md) and returns the [standard exit codes](./exit-codes.md).

## Common behaviour

- **Project folder.** Run the commands from the folder that holds `package.json` or `pyproject.toml`, or pass `--project-path`. For a coded app inside a solution, that is the app's `source/` folder.
- **Language.** The language is not an option. An existing declarations file decides. Otherwise the SDK that the project depends on decides: `@uipath/uipath-typescript` in `package.json` selects TypeScript, and `uipath` or one of its framework packages (for example `uipath-langchain`) in `pyproject.toml` selects Python.
- **Kinds.** `--kind` is one of `asset`, `bucket`, `queue`, `process`, `entity`, `connection`.
- **Bindings.** The commands do not write `bindings_v2.json`. For a coded app, [`uip codedapp pack`](./uip-codedapp-pack.md), [`uip codedapp push`](./uip-codedapp-push.md), [`uip solution pack`](./uip-solution-pack.md), [`uip solution upload`](./uip-solution-upload.md), and [`uip solution resources refresh`](./uip-solution-resources.md#refresh) derive the bindings from `uipath_resources.ts`. A `bindings_v2.json` already in the project is merged in for kinds that a declaration cannot express. Other project types keep their own bindings file: their packagers do not read the declarations file.
- **Folder.** A resource declared without a folder is one that the solution creates. A resource declared with a folder is an existing resource in that tenant folder.

---

## add

Declare a resource in the project's declarations file. Without `--skip-verify`, the command looks the resource up in the tenant and takes its folder and type from there, which requires [`uip login`](./authentication.md). Without a name, the command opens a picker, which needs an interactive terminal.

When the project belongs to a local solution, `add` also adds the resource to the solution, as [`uip solution resources refresh`](./uip-solution-resources.md#refresh) does.

### Arguments

- `[name]` *(optional)* — Resource name, as Orchestrator or Integration Service shows it. Required with `--skip-verify`, and when no interactive terminal is available.

### Options

| Long | Value | Default | Description |
|---|---|---|---|
| `--kind <kind>` | `asset` \| `bucket` \| `queue` \| `process` \| `entity` \| `connection` | — | Resource kind. Required when a name is passed. |
| `--folder-path <path>` | path | — | Folder that the resource sits in. Omit it, or pass `.`, for a resource that the solution creates. For a connection, it narrows the lookup. |
| `--type <type>` | text | from the tenant | Asset value type (`text`, `integer`, `bool`, `credential`, `secret`, `json`) or bucket provider (`orchestrator`, `amazon`, `azure`). For a process, the process kind, which is written as given. For a connection, the connector key (for example `uipath-slack`), which narrows the lookup. Queues and entities take no type. |
| `--skip-verify` | flag | off | Write the declaration as given, without looking the resource up. Use it offline, in CI, or for a resource that the solution creates. Needs the resource name. Does not apply to a connection. |
| `--project-path <path>` | path | current directory | Project folder, the one with `package.json` or `pyproject.toml`. |

A connection is declared by its ID and its connector key, and the name is only a label. The ID comes from the lookup, so a connection cannot be declared with `--skip-verify`.

Adding a resource that is already declared changes nothing in the file and returns `Added: false`.

### Examples

```bash
# An asset in a tenant folder; its type comes from the tenant
uip resources add InvoiceThreshold --kind asset --folder-path Finance/Shared

# A queue that the solution creates, without a tenant lookup
uip resources add InvoiceReview --kind queue --skip-verify

# An Integration Service connection, narrowed by connector
uip resources add "Finance Slack" --kind connection --type uipath-slack
```

### Data shape (--output json)

```json
{
  "Code": "ResourceDeclared",
  "Data": {
    "Added": true,
    "Kind": "asset",
    "Name": "InvoiceThreshold",
    "FolderPath": "Finance/Shared",
    "Type": "integer",
    "Field": "invoiceThreshold",
    "File": "uipath_resources.ts",
    "Solution": "Added"
  }
}
```

| Field | Description |
|---|---|
| `Added` | `false` when the same resource was already declared. |
| `Kind`, `Name` | The declared resource. |
| `Id` | The connection ID. Connections only. |
| `FolderPath` | The tenant folder. Absent for a resource that the solution creates. |
| `Type` | The asset value type, bucket provider, process kind, or connector key. Absent when the resource has none. |
| `Field` | The `ProjectResources` field that the declaration was written to. Absent when nothing was written. |
| `File` | The declarations file: `uipath_resources.ts` or `uipath_resources.py`. |
| `Solution` | What happened in the project's solution: `Added`, `Unchanged`, `Pending` (the resource is not in the solution yet, and the next `uip solution resources refresh` or `uip solution pack` adds it), or `NotInSolution` (the project is not in a solution). |

### Failure modes

- **A name without `--kind`**, a `--type` that the kind does not take, an empty name, or `--skip-verify` without a name or with a connection. Fails with `ValidationError`, `ErrorCode: invalid_argument`, exit code `3`.
- **No `package.json` or `pyproject.toml` in the project folder, or a project that depends on neither SDK.** Fails with `ErrorCode: invalid_argument`. `Instructions` names `--project-path` or the SDK to install.
- **Not logged in.** A lookup without a session fails with `AuthenticationError`, `ErrorCode: authentication_required`, exit code `2`. Run `uip login`, or pass `--skip-verify`.
- **No resource with that name in the tenant, or not in the folder that `--folder-path` names.** Fails with `ErrorCode: not_found`.
- **The name matches resources in more than one folder, or more than one connection.** Fails with `ErrorCode: invalid_argument`. `Instructions` lists the folders, or the connectors, to pass.
- **`--type` differs from the declaration already in the file.** Fails with `ErrorCode: invalid_argument`. Edit or remove the line in the file to change the type.
- **No name and no interactive terminal.** Fails with `ErrorCode: invalid_argument`.

---

## list

List the resources declared in the project's declarations file. A declaration that the CLI cannot read, such as a value that is not a literal, is reported as a warning on stderr and left out. The command works offline.

### Options

| Long | Value | Default | Description |
|---|---|---|---|
| `--kind <kind>` | `asset` \| `bucket` \| `queue` \| `process` \| `entity` \| `connection` | — | Only declarations of this kind. |
| `--limit <number>` | number | `50` | Number of declarations to return. |
| `--offset <number>` | number | `0` | Number of declarations to skip. |
| `--project-path <path>` | path | current directory | Project folder, the one with `package.json` or `pyproject.toml`. |

### Examples

```bash
uip resources list

uip resources list --kind queue
```

### Data shape (--output json)

```json
{
  "Code": "ResourceDeclarationList",
  "Data": [
    {
      "Kind": "asset",
      "Name": "InvoiceThreshold",
      "FolderPath": "Finance/Shared",
      "Type": "integer"
    },
    { "Kind": "queue", "Name": "InvoiceReview" }
  ],
  "Pagination": { "Returned": 2, "Limit": 50, "Offset": 0, "Total": 2 }
}
```

`Data` is an empty array when nothing is declared. A connection row also carries `Id`, and its `Type` is the connector key.

---

## sync

Declare resources of the project's local solution in the project's declarations file. The command lists the solution resources that the project does not declare yet and opens a picker to choose from them. `--all` declares every listed resource without a picker.

A resource that the solution creates is declared without a folder. A resource that the solution imported from the tenant is declared with its tenant name and folder, which the command reads from the tenant.

### Options

| Long | Value | Default | Description |
|---|---|---|---|
| `--all` | flag | off | Declare every listed resource without a picker. Required when there is no interactive terminal. |
| `--solution-folder <path>` | path | the nearest `.uipx` above the project | Solution root folder, the one with the `.uipx`. |
| `--project-path <path>` | path | current directory | Project folder, the one with `package.json` or `pyproject.toml`. |

### Examples

```bash
uip resources sync --all

uip resources sync --all --project-path ./Invoices/App/source
```

### Data shape (--output json)

```json
{
  "Code": "ResourcesSynced",
  "Data": {
    "Added": [
      { "Kind": "queue", "Name": "InvoiceReview", "Field": "invoiceReview" }
    ],
    "AlreadyDeclared": 2,
    "Unresolved": [],
    "File": "uipath_resources.ts"
  }
}
```

| Field | Description |
|---|---|
| `Added` | The declarations written, with the same fields as a [`list`](#list) row plus `Field`. |
| `AlreadyDeclared` | Number of solution resources that the project already declared. |
| `Unresolved` | Imported resources whose tenant folder could not be read, for example without a session. Each entry carries `Kind`, `Name`, and `Reason`. These resources are not declared, and a warning on stderr names each one. |
| `File` | The declarations file. |

Without a session, the command cannot check whether a resource was imported from the tenant. Such a resource is declared as one that the solution creates, and a warning on stderr names it.

### Failure modes

- **No `.uipx` above the project.** Fails with `ErrorCode: not_found`. Run the command inside a solution, or pass `--solution-folder`.
- **No `--all` and no interactive terminal.** Fails with `ErrorCode: invalid_argument`.

---

## Related commands

- [`uip solution resources`](./uip-solution-resources.md) — list, add, remove, edit, and refresh the resources of a solution.
- [`uip codedapp`](./uip-codedapp.md) — build, pack, and push the coded app that reads the declarations.

## See also

- [Global options](./global-options.md) and [Exit codes](./exit-codes.md) — contracts shared by every verb.
- [Tools (plugins)](./concepts-tools.md) — how tools are distributed and versioned.
