# uip admin audit

> Syntax and options for `uip admin audit`, which queries and exports UiPath admin audit events at organization and tenant scope and manages organization audit exclusion rules.

`uip admin audit` queries and exports **UiPath audit events** — the platform-level admin audit trail (distinct from [`uip or audit-logs`](./uip-or-audit-logs.md), which covers Orchestrator entity changes). Part of `uip admin` ([overview](./uip-admin.md)), the UiPath admin tool.

Two scope subgroups register the identical three-verb read shape (`sources`, `events`, `export`):

- **`org`** — organization-scoped audit (admin events that are tenant-agnostic).
- **`tenant`** — tenant-scoped audit (events scoped to the active login tenant, or `--tenant-id`).

The `org` subgroup also has an `exclusions` subgroup, which manages the rules that stop matching events from being recorded. There is no tenant-scoped `exclusions` subgroup. A rule names the tenants it applies to with `--exclude-tenant`.

Typical workflow: `audit <scope> sources` (discover source IDs) → `audit <scope> events --source <guid> --from-date … --to-date …` (find the rows) → `audit <scope> export --from-date … --to-date … --output-path …` (download them).

## Synopsis

```text
uip admin audit org sources [--login-validity <minutes>]
uip admin audit org events [--from-date <iso>] [--to-date <iso>] [--source <guid>...] [--target <guid>...] [--type <guid>...] [--user-id <guid>...] [--search <term>] [--status Success|Failure] [--limit <n>]
uip admin audit org export --from-date <iso> --to-date <iso> --output-path <dir> [--file-format json|csv]

uip admin audit tenant sources [--tenant-id <guid>] [--login-validity <minutes>]
uip admin audit tenant events [--tenant-id <guid>] [... same filters as org events]
uip admin audit tenant export [--tenant-id <guid>] --from-date <iso> --to-date <iso> --output-path <dir> [--file-format json|csv]

uip admin audit org exclusions list
uip admin audit org exclusions get <rule>
uip admin audit org exclusions create --name <name> [--exclude-tenant <guid>...] [--source <guid>...] [--target <guid>...] [--type <guid>...] [--status Success|Failure] [--inactive]
uip admin audit org exclusions create --file <path>
uip admin audit org exclusions update <rule> --name <name> [selector flags as for create] [--inactive]
uip admin audit org exclusions update <rule> --file <path>
uip admin audit org exclusions delete <rule>
```

`tenant` verbs additionally accept `--tenant-id <guid>` to override the tenant from your login context; `org` verbs do not (organization scope has no tenant to override).

## uip admin audit org sources / uip admin audit tenant sources

List the audit event sources visible at this scope — each source is a top-level event category (for example `Identity`, `Tenant`, `Robot`). Use the returned `Id` values with `events --source <guid>`.

### Options

| Long | Value | Description |
|---|---|---|
| `--tenant-id <guid>` | GUID | *(`tenant` scope only.)* Override the tenant from login context. |
| `--login-validity <minutes>` | integer | Override the interactive-login token lifetime for this call. Rarely needed. |

### Example

```bash
uip admin audit org sources
```

### Data shape (--output json)

```json
{
  "Code": "AuditOrgSources",
  "Data": [
    { "Id": "11111111-1111-1111-1111-111111111111", "Name": "Identity", "EventTargets": [] }
  ]
}
```

`Code` is `AuditTenantSources` under `tenant`.

## uip admin audit org events / uip admin audit tenant events

Query audit events at this scope, paginated. Returns `{ AuditEvents, Next, Previous }` — **not** a bare array. Cursor naming is chronological: `Next` is newer events, `Previous` is older. When `--limit` exceeds 200 the CLI paginates internally (following the older-events cursor) since the server clamps each call to 200 rows.

### Options

| Long | Value | Description |
|---|---|---|
| `--from-date <iso>` | ISO 8601 | Start of the time interval. Inclusive. |
| `--to-date <iso>` | ISO 8601 | End of the time interval. Inclusive. |
| `--source <guid>` | GUID, repeatable | Filter by event source IDs. Discover with `sources`. |
| `--target <guid>` | GUID, repeatable | Filter by event target IDs. |
| `--type <guid>` | GUID, repeatable | Filter by event type IDs. |
| `--user-id <guid>` | GUID, repeatable | Filter by acting user IDs. |
| `--search <term>` | string | Server-side substring search. |
| `--status <status>` | `Success` \| `Failure` | Case-insensitive event-status filter. |
| `--limit <n>` | integer | Total events to return, 1–10000. Values over 200 are paginated client-side (server clamps each call to 200). |
| `--tenant-id <guid>` | GUID | *(`tenant` scope only.)* Override the tenant from login context. |
| `--login-validity <minutes>` | integer | Override the interactive-login token lifetime for this call. Rarely needed. |

### Examples

```bash
# Fetch the latest 50 org audit events
uip admin audit org events --limit 50
```

```bash
# Filter by source and a 7-day window
uip admin audit tenant events --source 11111111-1111-1111-1111-111111111111 \
  --from-date 2026-04-22T00:00:00Z --to-date 2026-04-29T00:00:00Z
```

### Data shape (--output json)

```json
{
  "Code": "AuditOrgEvents",
  "Data": { "AuditEvents": [], "Next": null, "Previous": null }
}
```

`Code` is `AuditTenantEvents` under `tenant`.

## uip admin audit org export / uip admin audit tenant export

Export audit events from the long-term store. Issues one HTTP call per UTC day inside `[--from-date, --to-date]` and aggregates the results in memory before writing anything out — the full window is fetched first, and on any single day's failure the export aborts atomically (nothing is written; the failure names the day that failed).

`--output-path` is a **base directory**, not a file path — pass a folder, and the CLI generates a uniquely-named output inside it, stamped with the window and generation time (e.g. `audit_2026-01-01_2026-02-01_20260617T112630`), so repeated exports of the same window never collide:

- `--file-format json` (default) — a folder of one JSON file per UTC day.
- `--file-format csv` — a single CSV file with every event merged under a shared header.

### Options

| Long | Value | Required | Description |
|---|---|---|---|
| `--from-date <iso>` | ISO 8601 | **yes** | Start of the time interval. |
| `--to-date <iso>` | ISO 8601 | **yes** | End of the time interval. |
| `--output-path <dir>` | path | conditionally | Base directory for the export (created if missing). Pass a directory only, never a filename — the CLI names the output for you. Required unless `--output-file` (deprecated alias) is passed instead. |
| `--output-file <dir>` | path | no | Deprecated alias for `--output-path`. Despite the name, still treated as a base directory. When both are passed, `--output-path` wins and a deprecation warning is logged. |
| `--file-format <format>` | `json` \| `csv` | no | Output shape. Default `json`. |
| `--tenant-id <guid>` | GUID | no | *(`tenant` scope only.)* Override the tenant from login context. |
| `--login-validity <minutes>` | integer | no | Override the interactive-login token lifetime for this call. Rarely needed. |

### Examples

```bash
# JSON export — a timestamped folder of day-wise JSON files is created under the base dir
uip admin audit org export --from-date 2026-01-01 --to-date 2026-02-01 --output-path ./audit-exports
```

```bash
# CSV export — a single uniquely-named .csv file under the base dir
uip admin audit tenant export --from-date 2026-01-01 --to-date 2026-02-01 \
  --file-format csv --output-path ./audit-exports
```

### Data shape (--output json)

JSON format:

```json
{
  "Code": "AuditOrgExport",
  "Data": {
    "Path": "./audit-exports/audit_2026-01-01_2026-02-01_20260617T112630",
    "Format": "json",
    "Files": 27,
    "Bytes": 12345,
    "Days": 31,
    "NonEmptyDays": 27,
    "GeneratedAt": "2026-06-17T11:26:30.000Z"
  }
}
```

CSV format adds an `Events` count in place of `Files`:

```json
{
  "Code": "AuditOrgExport",
  "Data": {
    "Path": "./audit-exports/audit_2026-01-01_2026-02-01_20260617T112630.csv",
    "Format": "csv",
    "Bytes": 98765,
    "Days": 31,
    "NonEmptyDays": 27,
    "Events": 1234,
    "GeneratedAt": "2026-06-17T11:26:30.000Z"
  }
}
```

`Code` is `AuditTenantExport` under `tenant`.

## uip admin audit org exclusions

Manage the organization's audit exclusion rules, which define the events the audit trail stops recording.

A rule carries at most one selector per dimension: `Tenant`, `EventSource`, `EventTarget`, `EventType`, and `Status`. Values inside a selector are OR-ed, and selectors are AND-ed: `--type A --type B --status Success` excludes successful events of type A or type B. A rule with no selector is refused, because it would exclude every event.

Exclusion starts when a rule becomes active and is never retroactive. Events already in the trail stay there, and widening a rule's match set resets its exclusion start time. An inactive rule excludes nothing, so you can stage a replacement next to the rule it replaces.

UiPath's own monitoring events and audit-configuration changes, including changes to the exclusion rules themselves, can never be excluded.

`get`, `update`, and `delete` take a `<rule>` positional: the rule's name or its policy ID. A name is unique only among active rules. If an inactive rule shares the name, the CLI asks for the policy ID instead of picking one. A rule name shaped like a GUID is refused.

Reading rules requires audit-read permission. Creating, updating, and deleting rules requires a user token whose identity is in the Administrators group. Service-to-service tokens are refused on writes.

### Write options (create and update)

`create` and `update` accept the same options. Pass either `--file` or the inline flags, not both.

| Long | Value | Description |
|---|---|---|
| `--name <name>` | string | Rule name, unique among the organization's active rules. Maximum 256 characters. Required unless `--file` is passed. |
| `--exclude-tenant <guid...>` | GUID, repeatable | `Tenant` selector: exclude events from these tenants only. A tenant outside the organization is accepted but matches nothing. |
| `--source <guid...>` | GUID, repeatable | `EventSource` selector. Discover IDs with `uip admin audit org sources`. |
| `--target <guid...>` | GUID, repeatable | `EventTarget` selector. Discover IDs with `uip admin audit org sources`. |
| `--type <guid...>` | GUID, repeatable | `EventType` selector. Discover IDs with `uip admin audit org sources`. |
| `--status <status>` | `Success` \| `Failure` | `Status` selector, case-insensitive. `0` and `1` are also accepted. Single-valued. |
| `--inactive` | flag | Save the rule without activating it. An inactive rule excludes nothing, and may reuse an active rule's name or match set. |
| `--file <path>` | path | JSON file holding the whole rule body. Mutually exclusive with the flags above. |
| `--login-validity <minutes>` | integer | Override the interactive-login token lifetime for this call. Rarely needed. |

Pass at least one selector flag. Selector values are GUIDs, except for `--status`.

A `--file` body accepts only the `name`, `enforcement`, `isActive`, and `selectors` keys. Each selector carries a `type` (one of the dimension names) and a non-empty `values` array. `enforcement` defaults to `Exclude`, the only accepted value, and `isActive` defaults to `true`. Server-owned fields, such as `policyId` and the timestamps, are rejected. The body uses camelCase field names, while `get` and `list` print PascalCase keys, so re-case the fields when you build a body from a rule you read.

```json
{
  "name": "Mute successful robot logins",
  "isActive": true,
  "selectors": [
    { "type": "EventType", "values": ["0f54d68a-15fd-427d-a86a-2812bb7fbb28"] },
    { "type": "Status", "values": ["Success"] }
  ]
}
```

### list

List every exclusion rule in the organization, ordered by name. The result is not paginated. A rule whose stored definition cannot be parsed is listed with an empty `Selectors` array, so you can still delete it.

```bash
uip admin audit org exclusions list
```

Data shape (`--output json`):

```json
{
  "Code": "AuditOrgExclusionsList",
  "Data": [
    {
      "PolicyId": "3f6b1d84-9a1e-4c2b-8e71-2f9c5d0a7b13",
      "Name": "Mute successful robot logins",
      "Enforcement": "Exclude",
      "IsActive": true,
      "ActivatedOn": "2026-09-17T09:14:22.000Z",
      "Selectors": [
        { "Type": "EventType", "Values": ["0f54d68a-15fd-427d-a86a-2812bb7fbb28"] },
        { "Type": "Status", "Values": ["Success"] }
      ],
      "CreatedOn": "2026-09-17T09:14:22.000Z",
      "LastModifiedOn": "2026-09-17T09:14:22.000Z"
    }
  ]
}
```

### get

Read one exclusion rule by name or policy ID.

| Argument | Description |
|---|---|
| `<rule>` | Rule name, or its policy ID. |

```bash
uip admin audit org exclusions get "Mute successful robot logins"
uip admin audit org exclusions get 3f6b1d84-9a1e-4c2b-8e71-2f9c5d0a7b13
```

Returns `Code: AuditOrgExclusionsGet` with a single rule object under `Data`, in the same shape as a `list` entry.

### create

Create an exclusion rule. The rule is active unless you pass `--inactive`. An active rule is refused when another active rule has the same name, or already excludes every event the new rule would.

```bash
# Stop recording successful events of one event type
uip admin audit org exclusions create --name "Mute successful robot logins" \
  --type 0f54d68a-15fd-427d-a86a-2812bb7fbb28 --status Success

# Stage a rule without activating it
uip admin audit org exclusions create --name "Staged" \
  --source 3f6b1d84-9a1e-4c2b-8e71-2f9c5d0a7b13 --inactive

# Create the rule from a JSON body
uip admin audit org exclusions create --file ./rule.json
```

Returns `Code: AuditOrgExclusionsCreated` with the created rule under `Data`. A rule created with `--inactive` has `IsActive: false` and `ActivatedOn: null`.

### update

Replace an exclusion rule in full. Any selector you omit is dropped, so resend every flag the rule keeps. Read the rule first with `exclusions get`. Without `--inactive`, the rule is saved as active, even when it was inactive before the update.

Renaming a rule keeps its exclusion start time. Changing the events it matches resets that time.

| Argument | Description |
|---|---|
| `<rule>` | Rule name, or its policy ID. Pass it before the selector flags: those flags take a list, so a value written after one is read as another selector value. |

```bash
uip admin audit org exclusions update "Mute successful robot logins" \
  --name "Mute successful robot logins" \
  --type 0f54d68a-15fd-427d-a86a-2812bb7fbb28 --status Success
```

Returns `Code: AuditOrgExclusionsUpdated` with the replaced rule under `Data`.

### delete

Delete an exclusion rule. Events the rule was excluding are recorded again from that point on. Events suppressed while the rule was active are not restored.

| Argument | Description |
|---|---|
| `<rule>` | Rule name, or its policy ID. |

```bash
uip admin audit org exclusions delete "Mute successful robot logins"
```

Data shape (`--output json`):

```json
{ "Code": "AuditOrgExclusionsDeleted", "Data": {} }
```

## Troubleshooting

- **`HTTP 401`** — token is likely missing the `Audit.Read` scope. Run `uip logout && uip login` to mint a fresh token.
- **`HTTP 403`** — the logged-in user lacks audit-read permission on this tenant; check role assignments in Automation Cloud.
- **`Tenant ID required`** (tenant scope) — pass `--tenant-id <guid>`, or log in and select a tenant first.
- **`HTTP 504` on export, or "Audit export failed for `<date>`"** — a single day's chunk timed out. Re-run — the export is idempotent. If it persists, narrow `--from-date`/`--to-date` to skip the failing day.
- **"resolves outside the output folder" / unsafe file name on export** — indicates a malformed server response; re-run, and report it if it persists.

## Related

- [`uip admin`](./uip-admin.md) — overview of the whole `uip admin` tool.
- [`uip or audit-logs`](./uip-or-audit-logs.md) — the Orchestrator-entity audit trail, a distinct surface from this admin-level audit.

## See also

- [Global options](./global-options.md)
- [Exit codes](./exit-codes.md)
