# Istari Digital — Python Client


---

<!-- Source: 01-setup.md -->

---
slug: /build/python/setup
sidebar_label: Setup
sidebar_position: 1
---

# Setup

`istari-digital-client` is the Python interface to the Istari Digital Platform. This page installs the package and builds a configured `Client` — the entry point for every other example in this section.

To create your first System end to end, work through [Python Client 201 — Your first System](../tutorials/automate/201-first-system.md) and come back here when you start writing your own code.

## Requirements

- Python 3.10 or newer. Supported versions are listed on the [PyPI project description](https://pypi.org/project/istari-digital-client/#description).
- `istari-digital-client` **13.2.1**, the Python client for Istari Digital Platform **2026.09**. The examples below install that version. Each release lists its client under **SDK Clients** in the [release notes](/releases/2026-09-01-Release). If you are not sure your instance is 2026.09, see [Match the client to the registry](#match-the-client-to-the-registry).
- A **Key** from the web app — see [Credentials](#credentials) below.

## Installation

Pick whichever fits how you already work. All three install the same package into an isolated environment.

**pip, in a virtual environment:**

```bash
python -m venv .venv && source .venv/bin/activate
pip install "istari-digital-client==13.2.1"
```

**[uv](https://docs.astral.sh/uv/), in a virtual environment:**

```bash
uv venv && source .venv/bin/activate
uv pip install "istari-digital-client==13.2.1"
```

**uv, as a project** — when the code is a repository rather than a one-off script:

```bash
uv init my-analysis && cd my-analysis
uv add "istari-digital-client==13.2.1"
uv run python analysis.py
```

`uv add` records the dependency in `pyproject.toml` and pins it in `uv.lock`, so a colleague reproduces your environment with `uv sync`. `uv run` executes in that environment without activating it.

On Windows, activate with `.venv\Scripts\activate`.

## Credentials

In the web app, open **avatar → Settings → Developer**. Click **Generate Key**, then **Download credentials** — the credentials file is shown once. It is JSON with `clientId`, `keyId`, and `key` (the private key). The dialog names it `istari-credentials.json`. Copy the **API URL** from the **Endpoints** section on the same page. Details: [Developer Settings — Keys](../users/user-guide/settings.md#developer-settings--keys).

Put both in a `.env` file beside your script:

```text
ISTARI_DIGITAL_API_URL=<API URL from Endpoints>
ISTARI_CLIENT_IDENTITY_SERVICE_SECRET_FILE=/absolute/path/to/istari-credentials.json
ISTARI_DIGITAL_IDENTITY_SERVICE_ENABLED=true
```

Note the `ISTARI_CLIENT_` prefix on the file path — it is the only name the client reads for the credentials file. With that path and `ISTARI_DIGITAL_API_URL` set, Key authentication turns on even when `ISTARI_DIGITAL_IDENTITY_SERVICE_ENABLED` is absent. The sample sets it to `true` so the choice is explicit. Set it to `false` to keep a personal access token while a key file is also configured.

Keep `.env` and the credentials file out of git, prompts, and chat logs.

## Initialize the client

`Configuration()` reads those names from the environment, so the credential stays out of your code:

```python
from dotenv import load_dotenv
from istari_digital_client import Client, Configuration

load_dotenv()                      # copies .env into the environment

client = Client(Configuration())
```

`python-dotenv` installs with the client, so there is nothing else to add. Point `load_dotenv("istari.env")` at another filename when you already keep credentials elsewhere — the tutorials use `istari.env`.

### Passing the values in code

Constructor arguments override the environment. Use them when the values come from a secret manager, or when one process talks to more than one instance:

```python
from istari_digital_client import Client, Configuration

client = Client(Configuration(
    digital_api_url="https://api.your-instance.istari.app",
    identity_service_secret_file="/absolute/path/to/istari-credentials.json",
    identity_service_enabled=True,
))
```

> Identity Service secrets should only be used when the Identity Service is [enabled](../icbs-install/03-control-plane/10-identity-service/01-Install-and-Configure.md).

### Personal Access Tokens

:::warning Deprecated

PATs are deprecated as of the July 2026 release and have been superseded by Keys. Support for PATs will be removed from the platform in a future release.

Which change matches your script is on [Move a Python script from a PAT to a key](./move-from-pat-to-key.md). The CLI exchange itself is [PAT → Key Exchange](../icbs-install/05-CLI/04-exchanging-pat-for-key.md).

:::

A PAT uses two names instead of the three above — `ISTARI_REGISTRY_URL` and `ISTARI_REGISTRY_AUTH_TOKEN` in `.env`, or the matching arguments:

```python
client = Client(Configuration(
    registry_url="https://your-instance.istari.digital",
    registry_auth_token="your-personal-access-token",
))
```

The **Registry URL** is in the **Endpoints** section of Developer Settings; see [Personal Access Tokens](../users/user-guide/settings.md#developer-settings--personal-access-tokens) for the token itself.

## Next steps

- [Patterns](./02-patterns/index.md) — the calls behind common workflows.
- [Keys](./api_reference/14-keys.md) — turn a personal access token into a key file, or list and revoke keys, with `client.keys`.
- [Branching and change requests](./04-branching.md) — commit Resources to a branch and merge a change request.
- [Folders in a System](./06-folders.md) — arrange a System's tree from Python.
- [V3Client quick start](./v3/01-quick-start.md) — the unified resource API.

## Match the client to the registry

This page installs `istari-digital-client` **13.2.1** for Istari Digital Platform **2026.09**.
Use the commands in [Installation](#installation) when your instance is that release.

If you are not sure, run [check-registry-readiness.py](pathname:///quickstart/check-registry-readiness.py).
It reads the registry version from your instance and prints the `istari-digital-client` pin that matches it.
Create the `.env` file in [Credentials](#credentials) first.
The script reads that file.

```bash
python -m pip install pyjwt
python -c "import urllib.request; urllib.request.urlretrieve('https://docs.istaridigital.com/quickstart/check-registry-readiness.py', 'check-registry-readiness.py')"
python check-registry-readiness.py
```

The first two lines of output are `registry_version=` and `sdk_version=`.
Install the version printed after `sdk_version=`.

A Key is the credential the script uses: `ISTARI_DIGITAL_API_URL` and `ISTARI_CLIENT_IDENTITY_SERVICE_SECRET_FILE` in `.env`.
PyJWT is required for a Key.
A personal access token also works when the Key file is unset: set `ISTARI_REGISTRY_URL` and `ISTARI_REGISTRY_AUTH_TOKEN` in the same `.env`.
The script prints the versions only. The Key and the token stay in `.env`.


---

<!-- Source: 02-patterns/01-workflows/01-sequential-pipeline.mdx -->

---
slug: /build/python/patterns/workflows/sequential-pipeline
sidebar_label: "Sequential pipeline"
---

# Sequential Pipeline

Chain multiple operations in order within a single engineering tool session so that each step sees the previous step's changes.

## When to use

Use a sequential pipeline when you need to run several functions on the same model in a defined order — for example, update parameters and then extract geometry from the modified state. Because all steps execute inside a single tool session, changes are carried forward automatically and the model file is transferred and opened only once.

## How it works

The sequential pipeline is implemented as a module function (`@istari:batch_execute`) built into supported integrations. The agent opens the model once, runs each step in order within that session, and aggregates all outputs into the job result. This avoids the overhead of uploading, downloading, and re-opening the model between steps.

| Supported integration   |
| ----------------------- |
| `dassault_3dexperience` |
| `ptc_creo_parametric`   |
| `siemens_nx`            |

### Input structure

| Field               | Type             | Description                                                                   |
| ------------------- | ---------------- | ----------------------------------------------------------------------------- |
| `func_list`         | Array of objects | Ordered list of steps to execute                                              |
| `func_list[].name`  | String           | Canonical function name (e.g. `@istari:extract`)                              |
| `func_list[].input` | Object           | Step-specific parameters. Use `{}` when the step requires no extra parameters |

### Behaviour

- Steps run in order. Model state carries forward — modifications from step N are visible to step N+1.
- The model file is provided to the pipeline; individual steps do not need it in their `input`.
- Step input values are bare (e.g. `"output_format": "step"`). No `{"type": "parameter", "value": ...}` wrapper is needed.
- All step outputs are aggregated into a flat list returned by the job.

## Examples

Update a wing length parameter and then extract from the modified 3DExperience model, all in one job:

```python
job = client.add_job(
    model_id=model.id,
    function="@istari:batch_execute",
    tool_name="dassault_3dexperience",
    tool_version="2023x",
    operating_system="Windows 11",
    parameters={
        "func_list": [
            {"name": "@istari:update_parameters", "input": {"parameters": {"wing_length": "20m"}}},
            {"name": "@istari:extract", "input": {}},
        ]
    },
)
```

Run all extraction functions on a Siemens NX model in a single session:

```python
job = client.add_job(
    model_id=model.id,
    function="@istari:batch_execute",
    tool_name="siemens_nx",
    tool_version="2506",
    operating_system="Windows 11",
    parameters={
        "func_list": [
            {"name": "@istari:extract", "input": {}},
            {"name": "@istari:extract_geometry", "input": {"output_format": "step"}},
            {"name": "@istari:extract_parameters_full", "input": {}},
            {"name": "@istari:update_parameters", "input": {
                "parameters": {"CogsCount": "15", "HoleDiam": "200"},
            }},
        ],
    },
)
```

:::tip
The `parameters` value can be stored in a separate JSON file for readability. Pass the file path via `parameters_file` instead of inline `parameters`.
:::

## Composing with other patterns

A sequential pipeline can be used as the operation inside a [Parameter study](./02-parameter-study.mdx), letting you run a multi-step workflow for each set of variable values. See [Parameter study — Composing patterns](./02-parameter-study.mdx#composing-patterns) for an example.


---

<!-- Source: 02-patterns/01-workflows/02-parameter-study.mdx -->

---
slug: /build/python/patterns/workflows/parameter-study
sidebar_label: "Parameter study"
---

# Parameter Study

Run the same operation across a set of variable values to explore a design space automatically.

## When to use

Use a parameter study when you need to repeat a function for multiple configurations — for example, sweeping a dimension across a range of values and collecting outputs for each. Because all iterations execute inside a single tool session, the model is transferred and opened only once, and the module handles substitution and iteration internally.

## How it works

The parameter study is implemented as a module function (`@istari:variable_sweep`) built into supported integrations. You define one operation and a set of variables; the agent opens the model once and runs the operation for each combination, substituting `$varName` placeholders on every iteration.

| Supported integration   |
| ----------------------- |
| `dassault_3dexperience` |
| `siemens_nx`            |

### Input structure

| Field            | Type   | Description                                                         |
| ---------------- | ------ | ------------------------------------------------------------------- |
| `function`       | Object | The operation to repeat                                             |
| `function.name`  | String | Canonical function name (e.g. `@istari:update_parameters`)          |
| `function.input` | Object | Operation parameters, optionally containing `$varName` placeholders |
| `variables`      | Object | Map of variable names to arrays of values                           |

### Behaviour

- Use `$varName` placeholders anywhere in the operation input. On each iteration the placeholder is replaced with the corresponding value from the `variables` map.
- Multiple variables can be swept simultaneously — all arrays must be the same length. Values are zipped by index (iteration 0 uses index 0 from every array, iteration 1 uses index 1, etc.).
- Each iteration produces its own set of outputs, all aggregated into the job results.

## Examples

Sweep a gear count parameter across four values on a Siemens NX model:

```python
job = client.add_job(
    model_id=model.id,
    function="@istari:variable_sweep",
    tool_name="siemens_nx",
    tool_version="2506",
    operating_system="Windows 11",
    parameters={
        "function": {
            "name": "@istari:update_parameters",
            "input": {"parameters": {"CogsCount": "$CogsCount"}},
        },
        "variables": {"CogsCount": ["8", "12", "16", "20"]},
    },
)
```

## Composing patterns

A parameter study's operation can itself be a [Sequential pipeline](./01-sequential-pipeline.mdx), letting you run a multi-step workflow for each set of variable values.

Sweep a wing length variable across four values. On each iteration, update the parameter and then export geometry — both within the same tool session:

```python
job = client.add_job(
    model_id=model.id,
    function="@istari:variable_sweep",
    tool_name="dassault_3dexperience",
    tool_version="2023x",
    operating_system="Windows 11",
    parameters={
        "variables": {"wing_len": ["10m", "15m", "20m", "25m"]},
        "function": {
            "name": "@istari:batch_execute",
            "input": {
                "func_list": [
                    {"name": "@istari:update_parameters", "input": {"parameters": {"wing_length": "$wing_len"}}},
                    {"name": "@istari:extract_geometry", "input": {"format": "stp"}},
                ]
            }
        }
    },
)
```

Variable values are referenced with a `$` prefix (e.g. `$wing_len`) and can appear anywhere within the nested function input.


---

<!-- Source: 02-patterns/01-workflows/index.md -->

---
slug: /build/python/patterns/workflows
sidebar_label: "Overview"
---

# Workflow Patterns

Workflow patterns coordinate multiple operations within a single engineering tool session. Because the model is transferred and opened only once, all steps share the same session state — changes from one step are immediately visible to the next, and no intermediate upload or download is needed.

These patterns are implemented as module functions built into supported integrations. The agent handles session management, step sequencing, and output aggregation internally.

| Pattern                                             | Module function          | Purpose                                                               |
| --------------------------------------------------- | ------------------------ | --------------------------------------------------------------------- |
| [Sequential pipeline](./01-sequential-pipeline.mdx) | `@istari:batch_execute`  | Chain operations in order; each step sees the previous step's changes |
| [Parameter study](./02-parameter-study.mdx)         | `@istari:variable_sweep` | Run the same operation across a set of variable values                |

These patterns can be composed — for example, a parameter study where each iteration runs a sequential pipeline.


---

<!-- Source: 02-patterns/index.md -->

---
slug: /build/python/patterns
sidebar_label: "Patterns"
---

# Patterns

A pattern is a reusable solution to a recurring problem. In the context of the Istari Digital Platform, patterns capture proven approaches for connecting engineering data, automating workflows, and building reliable digital threads with the Python client.

Each pattern describes **when** to use it, **how** it works, and provides ready-to-use SDK examples.

## Categories

### [Workflows](./01-workflows/index.md)

Patterns for composing multiple operations into coordinated workflows — running steps in sequence, sweeping parameters across design variants, or combining both.


---

<!-- Source: 04-branching.md -->

---
slug: /build/python/branching
sidebar_label: Branching
sidebar_position: 4
title: Branching and change requests
---

# Branching and change requests

Create **branches**, commit Resource revisions, and open, merge, or close **change requests** with the Istari Digital Python client. Use this when branching and merging are part of an automated pipeline — for example, committing simulation output to a branch and opening a change request for review.

For the conceptual model (Resource versions vs System branches), see [Version control](../intro/key-concepts/version-control.md). For the same flows in the web app, see [Branches](../users/user-guide/branches.md).

## Prerequisites

- A configured `Client` — see [SDK setup](./01-setup.md).
- **Editor** (or above) on the target System.

## Getting a System and its branches

Branch operations live on the `System` object. Every System starts with a `baseline` branch:

```python
system = client.get_system("26db98...")   # your system ID

baseline = system.get_branch("baseline")
branches = system.list_branches()          # all branches except baseline
```

## Creating a branch

Create a new branch off any existing branch to isolate the changes you're making:

```python
v2 = system.create_branch("v2", from_branch=baseline)
```

:::note

The `add_to_branch` helper commits to working branches; to update `baseline`, merge a change request into it as shown below.

:::

## Committing Resources to a branch

Upload each file as a model, then commit its revision to the branch. You can commit several revisions (and Subsystems) in a single commit. `add_model` is deprecated in 13.1.9 and warns. It still returns the `Model` whose `.revision` `add_to_branch` takes. The same upload on `V3Client` is [`create_resource`](./v3/v3-client.mdx#create_resource).

```python
render = client.add_model("renders/back.png")
bom = client.add_model("bill_of_materials.json")

v2 = system.add_to_branch(v2, revisions=[render.revision, bom.revision])
```

To remove tracked files from a branch, use `system.remove_from_branch()` with the same arguments. Each call to `add_to_branch` / `remove_from_branch` creates one commit:

```python
for commit in system.list_branch_history(v2):   # newest first, like `git log`
    print(commit.snapshot_id, commit.created)
```

## Creating a change request

Merge by creating a change request from your working branch (the **source**) into the branch you want to update (the **target**):

```python
from istari_digital_client import ChangeRequestCreateRequest

response = client.create_change_request(
    system_id=system.id,
    change_request_create_request=ChangeRequestCreateRequest(
        source_tag_id=v2.id,
        target_tag_id=baseline.id,
        title="Move v2 to baseline",
        description="Added the renders and bill of materials",
    ),
)

change_request = response.actual_instance   # an OpenChangeRequestResponse
print(change_request.change_request_id, change_request.status)   # ... OPEN
```

## Reviewing the changes

Get high-level counts first:

```python
summary = client.change_request_change_summary(
    system_id=system.id,
    change_request_id=change_request.change_request_id,
)
print(f"{summary.added_count} added, {summary.removed_count} removed, "
      f"{summary.changed_count} changed")
```

Then page through the full delta:

```python
diff_page = client.change_request_changes(
    system_id=system.id,
    change_request_id=change_request.change_request_id,
)

for item in diff_page.items:
    diff = item.actual_instance   # a resource diff or a subsystem diff
    print(diff.diff_type, diff.name)
```

You can filter the delta with `component_type=` (`RESOURCE`, `SUBSYSTEM`, or `ALL`) and `change_types=` (a list of `ADDED`, `REMOVED`, `CHANGED`), using the [`ChangeRequestComponentType`](./api_reference/08-enums.md#changerequestcomponenttype) and [`ChangeRequestDiffType`](./api_reference/08-enums.md#changerequestdifftype) enums. If `has_more` is true, pass `next_cursor` back as `cursor=` and the page's `head_pair_token` back as `x_head_pair_token=` so the next page stays on the same pair of branch heads.

## Merging the change request

```python
from istari_digital_client import ChangeRequestMergeRequest

merged = client.merge_change_request(
    system_id=system.id,
    change_request_id=change_request.change_request_id,
    change_request_merge_request=ChangeRequestMergeRequest(
        comment="Approved and merged",
    ),
).actual_instance

print(merged.status)   # MERGED
```

`merge_change_request` updates the target branch so that opening it shows the same Resources, versions, folders, and Subsystems as the source branch. When the same text file differs on the two branches, the target shows the source branch's version of that file, as a whole. Work saved only on the target stays in its commit history. The web app walkthrough, with an example, is [What a merge changes](../users/user-guide/branches.md#what-a-merge-changes).

To close a change request without merging it, call `update_change_request` with `status="CLOSED"`. The body is a full replacement: omitting `title` or `description` clears that field, so send the current values back when you only want to change the status. `MERGED` is not a valid status here — merging stays on `merge_change_request`. `status="OPEN"` reopens a closed request, with the same replacement rule.

```python
from istari_digital_client import ChangeRequestUpdateRequest

closed = client.update_change_request(
    system_id=system.id,
    change_request_id=change_request.change_request_id,
    change_request_update_request=ChangeRequestUpdateRequest(
        status="CLOSED",
        title=change_request.title,
        description=change_request.description,
        comment="Rejected",
    ),
).actual_instance

print(closed.status)   # CLOSED
```

## End-to-end example

```python
from istari_digital_client import (
    ChangeRequestCreateRequest,
    ChangeRequestMergeRequest,
    Client,
    Configuration,
)

client = Client(Configuration(
    digital_api_url="https://api.your-instance.istari.app",
    identity_service_secret_file="/absolute/path/to/key.json",
    identity_service_enabled=True,
))

system = client.get_system("26db98...")
baseline = system.get_branch("baseline")

v2 = system.create_branch("v2", from_branch=baseline)
bom = client.add_model("bill_of_materials.json")
v2 = system.add_to_branch(v2, revisions=[bom.revision])

change_request = client.create_change_request(
    system_id=system.id,
    change_request_create_request=ChangeRequestCreateRequest(
        source_tag_id=v2.id,
        target_tag_id=baseline.id,
        title="Move v2 to baseline",
    ),
).actual_instance

summary = client.change_request_change_summary(
    system_id=system.id,
    change_request_id=change_request.change_request_id,
)
print(f"{summary.added_count} added, {summary.removed_count} removed, "
      f"{summary.changed_count} changed")

client.merge_change_request(
    system_id=system.id,
    change_request_id=change_request.change_request_id,
    change_request_merge_request=ChangeRequestMergeRequest(comment="LGTM"),
)
```

## Related reference

- [Change requests](./api_reference/12-change-requests.md) — parameter tables for create, list, diff, merge, and close.
- [`System` branching methods](./api_reference/models/systems.md#system) — `create_branch`, `add_to_branch`, `list_branch_history`, and related helpers.
- [Systems API](./api_reference/04-systems.md) — System, configuration, snapshot, and folder methods on `Client`.


---

<!-- Source: 05-connected-resources.md -->

---
slug: /build/python/connected-resources
sidebar_label: Connected resources
sidebar_position: 5
---

# Connected resources

A **connected Resource** is a link to data in a third-party app ([Google Drive, Microsoft 365, Teamwork Cloud, 3DEXPERIENCE, or Windchill](../integrations/07-Third%20Party%20App%20Integrations/01-app_integrations.mdx#supported-applications)). You register it by uploading a small **metadata pointer file** with the Python Client. The platform stores the pointer; the engineering bytes stay in the external system until an agent fetches them for a job.

This page follows the order you work in: **connect** the Resource, **run jobs** on it, then **revise** it — using **`Client`** (`add_model`, `add_job`, `update_model`). For **`V3Client`**, see [Connected resources (V3Client)](./v3/04-connected-resources.md).

Connecting the **app** is an administrator task done once in the web app: they choose its sign-in method (**OAuth2 / OIDC** or **Basic**) and create any shared service accounts — see [App Integrations](../users/admin-guide/app-integrations.md) in the Administrator Guide. Credentials are then encrypted at rest and delivered to the agent that runs a job automatically; there is no key setup. Connecting the **Resources** themselves, and running jobs on them, is what you do from Python.

## Prerequisites

- **Python Client** — installed, and a configured `client` from [Setup → Initialize the client](./01-setup.md#initialize-the-client). Every example below assumes it.
- **App integration (admin)** — an administrator connects the target app once in the web app and chooses how people sign in to it. See [App Integrations](../users/admin-guide/app-integrations.md).
- **A stored credential** — needed to _run jobs_ on the Resource, not to connect it. See [Run jobs on a third-party Resource](#run-jobs-on-a-third-party-resource).
- **Host app access** — the agent account must be able to open the external object. See [Connecting files](../integrations/07-Third%20Party%20App%20Integrations/02-connect_files.mdx).

## Uploaded or third-party: two kinds of Resource

| Approach                | What you pass to `add_model`                                            | Where the bytes live |
| ----------------------- | ----------------------------------------------------------------------- | -------------------- |
| **Upload**              | Path to the real file (`.stl`, `.mdzip`, `.xlsx`, …)                    | Your data plane      |
| **Connect** (this page) | Path to a JSON **metadata pointer** file with a tool-specific extension | The third-party app  |

Both use the same SDK methods. The **filename extension** is what tells the platform the Resource is a link rather than an upload.

**UI:** **Resources → Add resources → Connect** writes the metadata Resource for you. See [Connect an external Resource](../users/user-guide/add-resources.md#connect-an-external-resource).

## Connect a third-party Resource

1. Create a JSON file that describes the external reference (project id, Windchill OID, SharePoint path, and so on). Field names come from the integration module.
2. Save it with the correct extension (see [Metadata extensions](#metadata-extensions)).
3. Call `client.add_model(path=...)`. That call is deprecated in 13.1.9 and warns. [`create_resource`](./v3/v3-client.mdx#create_resource) with `resource_type="model"` takes the same pointer path.

The client uploads the pointer as the model revision content. No CAD, PLM, or Office bytes are sent to your data plane.

### Metadata extensions

| Integration                | Base extension                                  | Notes                                                                                                                                      |
| -------------------------- | ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| Teamwork Cloud             | `.istari_teamwork_cloud_metadata`               | Often `.istari_teamwork_cloud_metadata_mdzip`. See [Dassault Cameo](../integrations/03-Systems%20Engineering/03-dassault_cameo/index.mdx). |
| Microsoft 365 / SharePoint | `.istari_microsoft_365_metadata`                | Type suffixes `_xlsx`, `_docx`, `_pptx`, `_csv`.                                                                                           |
| Google Drive               | `.istari_google_drive_metadata_*`               | Always suffixed: `_document`, `_spreadsheets`, `_presentation`.                                                                            |
| Windchill                  | `.istari_windchill_metadata`                    | See [PTC Creo](../integrations/02-CAD/03-ptc_creo/index.mdx).                                                                              |
| 3DEXPERIENCE (Enovia)      | `.istari_dassault_3dexperience_enovia_metadata` | See [3DEXPERIENCE Enovia](../integrations/03-Systems%20Engineering/05-dassault_3dexperience_enovia/index.mdx).                             |

Confirm the extension and JSON schema on the integration page or module manifest before production use.

### Example: Teamwork Cloud (Cameo)

Save a metadata pointer file (for example `my_project.istari_teamwork_cloud_metadata_mdzip`). Either shape below works:

**By project name, branch, and version:**

```json
{
  "project_name": "Istari_UAVOne(notional)",
  "branch_name": "trunk",
  "version": "11"
}
```

**By identifier URI:**

```json
{
  "identifier": "mdel://ANY?projectID=twcloud:/cf16d07a-9a9f-43dd-8ad9-bee73d9e2581/9903a418-e792-4a69-9add-dc01fe2f57de&serverType=esiserver&serverName=10.30.102.103&projectName=Istari_UAVOne(notional)&elementName=ANY_NAME"
}
```

Register:

```python
model = client.add_model(
    path="my_project.istari_teamwork_cloud_metadata_mdzip",
    display_name="TWC — Systems model",
)
```

### Example: Windchill (via Creo module)

Save `input.istari_windchill_metadata` with the `oid` from the Windchill URL (URL-decode `%3A` → `:`, `%2F` → `/`):

```json
{
  "oid": "VR:wt.epm.EPMDocument:132353"
}
```

```python
model = client.add_model(
    path="input.istari_windchill_metadata",
    display_name="Windchill CAD",
)
```

## Run jobs on a third-party Resource

Connecting the Resource needed no credential — the pointer file is only JSON. Running a job does, because this is the point where an agent signs in to the third-party app and fetches the real bytes.

Pick a stored credential, then bind it to the function's authentication input with **`auth_bindings`**:

```python
from istari_digital_client import NewCredentialBinding

twc_credential = next(
    c for c in client.list_credentials() if c.name == "My Teamwork Cloud account"
)

job = client.add_job(
    model_id=model.id,
    function="@istari:twc_extract",
    tool_name="dassault_cameo",
    tool_version="2022x Refresh2",
    operating_system="Windows 11",
    auth_bindings=[
        NewCredentialBinding(
            input_name="twc_auth_login",
            credential_id=twc_credential.id,
        )
    ],
)
```

Set **`tool_name`**, **`tool_version`**, and **`operating_system`** to match the module, exactly as for an uploaded Resource. The two binding fields are:

- **`input_name`** — the function's `auth_info` input, as declared in the module's manifest: `twc_auth_login` for Teamwork Cloud, `windchill_auth` for Windchill. Check the function's documentation, or the manifest itself, for the name it expects. A function with more than one authentication input takes one binding per input.
- **`credential_id`** — a stored credential you can use. `client.list_credentials()` returns every credential available to you: your own **linked accounts** and any organization **service accounts**. Each has an `id`, a human-readable `name` (the name shown under **Linked Accounts** in the web app), and a `status`. Pass `auth_integration_id` to narrow the list to one application.

No secret travels with the submission — a queued job holds no live token. The platform mints a fresh sign-in from the referenced credential only when an agent claims the job, so credentials added or refreshed after submission are picked up automatically. The agent then reads the metadata pointer and fetches the model from the third-party app.

`Model.add_job(...)` accepts the same `auth_bindings` argument. This is the SDK counterpart of the web app's credential picker, described in [App Integrations](../users/admin-guide/app-integrations.md#how-users-select-a-credential-when-running-a-job).

Use `parameters=` or `parameters_file=` as you would for an uploaded Resource, and poll outputs with `get_job`, `get_model`, and the artifact helpers — see [Jobs](./api_reference/03-jobs.md) and [Python Client 202](../tutorials/automate/202-python-client.md).

## Revise a third-party Resource

Connected Resources are versioned like uploaded ones:

- **`update_model(model_id=..., path=...)`** — upload an updated metadata pointer.
- **Mutating jobs** — some functions write back to the external system; the platform records a new revision on the same model id.
- **Re-run extract** — run another function on the latest revision without creating a new model id.

The model **id** is stable across revisions. Use `model.file.revisions` or `list_resource_revisions` with `V3Client`.

## Using a credential in your own module

If you are building a module that signs in to a third-party app, declare an authentication input and read the delivered sign-in at run time. See [Authenticating to external systems from a module](../connect/04-custom-modules/03-authenticating-from-a-module.md), and [Module design patterns](../connect/04-custom-modules/04-design-patterns.md) for how to validate and report on it.

## Related documentation

- [App Integrations](../users/admin-guide/app-integrations.md) — connecting an app, sign-in methods, and service accounts
- [Resources (key concepts)](../intro/key-concepts/resources.md)
- [Models and artifacts](./api_reference/02-files.md)
- [Connected resources (V3Client)](./v3/04-connected-resources.md)


---

<!-- Source: 06-folders.md -->

---
slug: /build/python/folders
sidebar_label: Folders
sidebar_position: 6
title: Folders in a System
---

# Folders in a System

Arrange the Resources tracked by a System into a tree from Python (`istari-digital-client` 13.2.1). A folder is a path prefix on a **tracked Resource** in a commit, not an object you create: the web app shows the names you typed, and the API stores an encoded path.

On 13.0.x, the branch method used below is named `branch.files()` rather than `branch.resources()`; everything else on this page is the same.

For what folders are and when a Subsystem fits better, see [Systems and Subsystems](../intro/key-concepts/systems.md#folders-inside-a-system). For the same task in the browser, see [Folders](../users/user-guide/folders.md).

## Prerequisites

- A configured `Client` — see [SDK setup](./01-setup.md).
- **Editor** (or above) on the target System.

## Path encoding

The write form is the System id without hyphens, then one dot-separated segment per folder level. Letters and digits stay literal; every other ASCII character becomes `_XX` — two uppercase hex digits of its code:

| You mean        | Stored as           |
| --------------- | ------------------- |
| `10-Analysis`   | `10_2DAnalysis`     |
| `tier 1 native` | `tier_201_20native` |
| `v1_extracted`  | `v1_5Fextracted`    |

Folder names must be ASCII. A bare `-`, space, or `_` in a segment is rejected.

```python
import re

def folder_path(system_id: str, *names: str) -> str:
    """The `<32-hex system id>.<label>…` form that NewTrackedFile(folder_path=…) expects."""
    def label(name: str) -> str:
        if not name.isascii():
            raise ValueError(f"folder names must be ASCII: {name!r}")
        return re.sub(r"[^A-Za-z0-9]", lambda m: f"_{ord(m.group()):02X}", name)

    return ".".join([system_id.replace("-", ""), *(label(n) for n in names)])
```

## Reading a path back

`branch.resources()` returns the branch's tracked Resources, each carrying a `path`. That path ends with the Resource's own id as a final segment (`<system-hex>.<folders…>.<file-hex>`); the path you write must not include it, so strip the trailing 32-hex segment before reusing a stored path:

```python
def folders_of(path: str | None) -> list[str]:
    """The encoded folder segments of a tracked Resource path, without the file-id tail."""
    hex32 = re.compile(r"^[0-9a-f]{32}$")
    return [] if not path else [s for s in path.split(".")[1:] if not hex32.match(s)]

def decode_label(segment: str) -> str:
    """`10_2DAnalysis` -> `10-Analysis`, the name the web app shows."""
    return re.sub(r"_([0-9A-F]{2})", lambda m: chr(int(m.group(1), 16)), segment)
```

## Committing into a folder

`branch.commit()` on the `Istari` facade takes only `add` and `remove`: it cannot set a folder, and it rebuilds every carried tracked file without one, so existing folders are dropped. Commit folder layout with `Client` instead — build a configuration in which every tracked Resource carries its `folder_path`, then move the branch tag to the snapshot that configuration produced.

Both clients take the same `Configuration`, so one credential serves the branch read and the commit:

```python
from istari_digital_client import (Client, NewSystemConfiguration, NewTrackedFile,
                                   TrackedFileSpecifierType, UpdateTag)
from istari_digital_client.sdk import Istari

istari, client = Istari(configuration), Client(configuration)

system = istari.systems.get(system_id)
baseline = system.get_branch("baseline")

# Carry what is already on the branch, each file keeping its own folder.
keep = [
    NewTrackedFile(
        specifier_type=TrackedFileSpecifierType(tracked.specifier_type),
        file_id=tracked.file_id,
        pinned_file_revision_id=tracked.pinned_file_revision_id,
        **({"folder_path": folder_path(system.id, *(decode_label(s) for s in folders_of(tracked.path)))}
           if folders_of(tracked.path) else {}),
    )
    for tracked in baseline.resources()
]

# Add the new Resource into 10-Model/. Omit folder_path to put it at the root.
new = [NewTrackedFile(specifier_type=TrackedFileSpecifierType.LATEST,
                      file_id=resource.file_id,
                      folder_path=folder_path(system.id, "10-Model"))]

configuration_ = client.create_configuration(
    system.id, NewSystemConfiguration(name="add bracket", tracked_files=keep + new))
snapshot = next(s for s in client.list_snapshots(system.id, page=1, size=100).items
                if s.configuration_id == configuration_.id)
tag = next(t for t in client.list_tags(system.id).items if t.tag == "baseline")
client.update_tag(tag.id, UpdateTag(snapshot_id=snapshot.id))
```

Every Resource you leave out of `tracked_files` leaves the branch, and every one you carry without a `folder_path` moves to the root — so build `keep` from the branch you are about to replace rather than from memory.

A runnable version of all of this is [`istari_quickstart_13_2_1.py`](pathname:///quickstart/istari_quickstart_13_2_1.py), and the [`istari-folders`](pathname:///skills/istari/istari-folders/SKILL.md) skill is the same recipe for an AI coding agent.

## Related reference

- [Branching and change requests](./04-branching.md) — commits, branches, and change requests on a System.
- [Systems API](./api_reference/04-systems.md) — `create_configuration`, `list_snapshots`, `update_tag`, and the folder list, rename, and move calls on `Client`.
- [Linking to the web app](./linking-to-the-web-app.md) — the URL that opens a Resource in its folder.


---

<!-- Source: api_reference/01-client.md -->

---
slug: /build/python/api_reference/client
sidebar_label: "Client overview"
---

# Client

The `Client` class is the main entry point for the Istari Digital Platform Python SDK. It provides methods for managing files, models, artifacts, jobs, access control, systems, agents, and more.

The SDK is shipped as the [`istari-digital-client`](https://pypi.org/project/istari-digital-client/) package on PyPI. **Supported Python versions** for the client are listed on the [PyPI project description](https://pypi.org/project/istari-digital-client/#description).

```python
from istari_digital_client import Client, Configuration

client = Client(Configuration(
    digital_api_url="https://your-instance.istari.digital",
    identity_service_secret_file="/path/to/your/key.json",
    identity_service_enabled=True,
))
```

See [Setup](../01-setup.md) for installation and configuration details.

## Server compatibility

Once instantiated, the client can verify it understands the registry it is talking to.

- **`Client.check_compatibility()`** — calls the readiness probe and returns a `CompatibilityResult` with the server's version and a verdict, or `None` if the server didn't return compatibility headers.
- **`Client.last_compatibility_result`** — the most recent compatibility result captured by any request, without forcing a new call.

## PAT deprecation

Once instantiated, the client can notify if it is authenticating with a PAT and the server supports keys.

Which change matches your script is on [Move a Python script from a PAT to a key](../move-from-pat-to-key.md). The CLI exchange is [PAT → Key Exchange](../../icbs-install/05-CLI/04-exchanging-pat-for-key.md).

- **`Client.check_auth_deprecation()`** — calls a lightweight authenticated endpoint and returns a `AuthDeprecationResult` with the server's verdict and message, or `None` if the server didn't return an auth deprecation header.
- **`Client.auth_deprecation`** — the most recent auth deprecation result captured by any request, without forcing a new call.

## Pagination

Most `list_*` methods support pagination via `page` and `size` parameters:

- **page** (_int_) – Page number. Minimum: `1`. Default: `1`.
- **size** (_int_) – Number of items per page. Range: `0`–`100`. Default: `10`.

## Common fields

Several methods accept the same optional metadata fields:

| Field                 | Type                             | Description                                      |
| --------------------- | -------------------------------- | ------------------------------------------------ |
| `display_name`        | _str \| None_                    | Human-readable name                              |
| `description`         | _str \| None_                    | Text describing the resource                     |
| `version_name`        | _str \| None_                    | User-defined version label                       |
| `external_identifier` | _str \| None_                    | External system identifier for cross-referencing |
| `sources`             | _list[NewSource \| str] \| None_ | Associated source references                     |

## String constraints (SDK and platform)

The Python SDK validates some fields from the bundled OpenAPI schema. The Istari Digital Platform registry service also persists data with stricter limits than the client always checks locally.

- **File revision metadata** (`description`, `display_name`, `version_name`, `external_identifier` on uploads such as `add_model`, `add_artifact`, and `create_revision`): In the registry database these are stored as **255-character** columns on the `file_revision` row (same length class as `mime`, `name`, and `extension`). The bundled `FileRevision` OpenAPI schema may omit `maxLength`, and the client does not apply Pydantic `max_length` for these fields, but **values longer than 255 characters are not storable** and should be treated as invalid for practical use.
- **Control tags** (`create_control_tag` / `update_control_tag`): Optional `description` on [`NewControlTag`](models/access.md#newcontroltag) and [`UpdateControlTag`](models/access.md#updatecontroltag) is validated as **0–255** characters on the platform (and in the OpenAPI schema). See [Access control](05-access.md#create_control_tag).
- **Full-text search** (`search_resources`): [`FullTextSearch`](models/files.md#fulltextsearch) on the platform requires `search_term` to be **at least 1** character, **`page` at least 1**, and **`size` between 1 and 100** (defaults page `1`, size `10`). See [search_resources](02-files.md#search_resources).

## Method reference

Methods are grouped by domain. Each page is self-contained with full parameter details.

### [Models and artifacts](02-files.md)

Upload, version, and manage models and artifacts. For third-party **connected** Resources (metadata pointer files), see [Connected resources](../05-connected-resources.md).

The model, artifact, file, and resource calls in this table are deprecated in 13.1.9. Use [`V3Client`](../v3/v3-client.mdx). `create_revision`, `read_contents`, and `read_properties` are storage helpers and are not part of that deprecation.

| Method                                                 | Description                                                                                                                  |
| ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
| `add_model` / `add_artifact`                           | Deprecated in 13.1.9. Use `V3Client.create_resource`                                                                         |
| `add_artifacts_bulk`                                   | Upload up to 10 artifacts in one call (deprecated)                                                                           |
| `update_file` / `update_model` / `update_artifact`     | Deprecated in 13.1.9. Use `V3Client.create_resource_revision`                                                                |
| `get_file` / `get_model` / `get_artifact`              | Deprecated in 13.1.9. Use `V3Client.get_resource`                                                                            |
| `list_files` / `list_models` / `list_artifacts`        | Deprecated in 13.1.9. Use `V3Client.list_resources`                                                                          |
| `create_revision` / `update_revision_content`          | Manage file revisions                                                                                                        |
| `read_contents` / `read_properties`                    | Read file data and metadata                                                                                                  |
| `get_resource` / `list_resources` / `search_resources` | Deprecated in 13.1.9. Use `V3Client.get_resource`, `list_resources`, and [`search`](../v3/08-search-and-favorites.md#search) |
| `archive_*` / `restore_*`                              | Deprecated in 13.1.9 for models, artifacts, and files. Use `V3Client.archive_resource` / `restore_resource`                  |

### [Jobs](03-jobs.md)

Create and monitor function execution.

| Method                                                              | Description                                                                                      |
| ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| `add_job`                                                           | Create a new job on a model                                                                      |
| `get_job` / `list_jobs` / `list_model_jobs`                         | Retrieve and filter jobs. `list_model_jobs` is deprecated in 13.1.9; use `list_jobs(model_id=…)` |
| `update_job_status`                                                 | Transition a job to a new status                                                                 |
| `update_job_assigned_agent` / `remove_job_assigned_agent`           | Assign or unassign an agent                                                                      |
| `update_job_assigned_agent_pool` / `remove_job_assigned_agent_pool` | Assign or unassign an agent pool                                                                 |

### [Systems & snapshots](04-systems.md)

Manage systems, configurations, and point-in-time snapshots.

| Method                                                        | Description                                        |
| ------------------------------------------------------------- | -------------------------------------------------- |
| `create_system` / `get_system` / `list_systems`               | Manage systems                                     |
| `create_configuration` / `list_system_configurations`         | System configurations                              |
| `list_folders` / `move_tracked_file` / `rename_folder_prefix` | Folder layout on a configuration                   |
| `compare_snapshots` / `compare_tag_to_live`                   | Diff two snapshots, or a branch against live state |
| `list_configuration_revisions`                                | Audit revisions tracked by a configuration         |
| `create_snapshot` / `list_snapshots`                          | Create and browse snapshots                        |
| `create_tag` / `update_tag` / `list_tags` / `get_tag_history` | Label snapshots with tags and view history         |

### [Access control](05-access.md)

Share resources and manage control tags.

| Method                                                 | Description                        |
| ------------------------------------------------------ | ---------------------------------- |
| `create_access` / `update_access` / `remove_access`    | Grant, modify, or revoke access    |
| `bulk_create_access`                                   | Share multiple resources at once   |
| `create_control_tag` / `update_control_tag`            | Create and manage control tags     |
| `add_*_control_taggings` / `remove_*_control_taggings` | Assign or revoke tags on resources |
| `list_resource_type_permissions`                       | Query permissions across resources |

### [Infosec levels](10-infosec.md)

Classify Resources and configure the platform infosec schema.

| Method                                                               | Description                               |
| -------------------------------------------------------------------- | ----------------------------------------- |
| `assign_infosec_level` / `list_infosec_levels`                       | Classify Resources, list available levels |
| `get_platform_infosec_settings` / `enable_platform_infosec_settings` | Read or update the platform schema        |

### [Documents](11-documents.md)

Manage versioned ProseMirror documents on a System configuration.

| Method                                                     | Description                                    |
| ---------------------------------------------------------- | ---------------------------------------------- |
| `create_document` / `update_document` / `archive_document` | Create, update, or archive a document          |
| `get_document` / `get_document_by_revision_id`             | Retrieve a document or a specific revision     |
| `list_documents` / `list_configuration_documents`          | List documents globally or per-configuration   |
| `export_document`                                          | Export to `json`, `markdown`, `docx`, or `pdf` |

### [Agents, modules & tools](06-agents.md)

Register agents, manage pools, and work with modules and functions.

| Method                                                | Description                                                   |
| ----------------------------------------------------- | ------------------------------------------------------------- |
| `register_agent` / `get_agent` / `list_agents`        | Agent lifecycle                                               |
| `create_agent_with_key` / `register_agent_public_key` | Provision an agent from a key, or register its RSA public key |
| `archive_agent` / `restore_agent`                     | Archive or restore an agent                                   |
| `create_agent_pool` / `update_agent_pool`             | Manage agent pools                                            |
| `archive_agent_pool` / `restore_agent_pool`           | Archive or restore a pool                                     |
| `create_module` / `get_module` / `list_modules`       | Module management                                             |
| `get_function` / `list_functions`                     | Query available functions                                     |
| `create_tool` / `list_tools`                          | Tool and version management                                   |

### [Users, tokens & admin](07-admin.md)

Manage users, authentication, and platform operations.

| Method                                                               | Description                                          |
| -------------------------------------------------------------------- | ---------------------------------------------------- |
| `get_current_user` / `list_users` / `batch_resolve_users`            | User lookup. `batch_resolve_users` is on `V3Client`. |
| `create_personal_access_token` / `revoke_all_personal_access_tokens` | Token management                                     |
| `create_auth_integration` / `get_integration_catalog`                | Auth integration setup                               |
| `generate_upload_url` / `generate_download_url`                      | Temporary storage URLs on `Client`                   |
| `liveness_check` / `readiness_check`                                 | Health probes                                        |

### [Change requests](12-change-requests.md)

Open, diff, merge, and close change requests. The how-to is [Branching](../04-branching.md).

| Method                                                                  | Description                      |
| ----------------------------------------------------------------------- | -------------------------------- |
| `create_change_request` / `list_change_requests` / `get_change_request` | Open and look up change requests |
| `change_request_change_summary` / `change_request_changes`              | Counts and the paged diff        |
| `merge_change_request` / `update_change_request`                        | Merge, or close and reopen       |

### [Credentials](13-credentials.md)

Store a secret, finish a browser link, or create a service connection.

| Method                                                         | Description                    |
| -------------------------------------------------------------- | ------------------------------ |
| `list_credentials` / `create_credential` / `delete_credential` | Store and disconnect secrets   |
| `get_credential_authorize_url` / `link_credential`             | Browser link                   |
| `create_service_connection` / `validate_credential`            | Service connections and probes |

### [Keys](14-keys.md)

`client.keys` — mint, list, and revoke the Identity Service key this process uses.

### [System webhooks](15-webhooks.md)

Register a target for `system.snapshot.created` and `system.change_request.opened`.

### [Identity administration](16-identity.md)

Manage tenants, memberships, principals, keys and role grants in the identity service through `IstariAdmin.identity`.

| Method                                                          | Description                           |
| --------------------------------------------------------------- | ------------------------------------- |
| `tenants.create` / `tenants.deactivate` / `tenants.set_default` | Tenant lifecycle                      |
| `memberships.grant` / `memberships.revoke`                      | Tenant membership                     |
| `principals.humans.create` / `principals.agents.create`         | Pre-register people and create agents |
| `keys.generate_and_register` / `keys.revoke`                    | Principal keys                        |
| `roles.grant_tenant_role` / `roles.grant_principal_role`        | Role grants                           |

### [Enums](08-enums.md)

Reference tables for all enum types: [JobStatusName](08-enums.md#jobstatusname), [ArchiveStatus](08-enums.md#archivestatus), [AccessRelation](08-enums.md#accessrelation), [OS](08-enums.md#os), [FunctionAuthType](08-enums.md#functionauthtype), [InfosecLevelObjectType](08-enums.md#infoseclevelobjecttype), and more.

### Data types

Structured types returned by client methods and accepted as parameters. Each page groups related types by domain, matching the method pages above.

| Page                                         | Contents                                                                                     |
| -------------------------------------------- | -------------------------------------------------------------------------------------------- |
| [Files, models & artifacts](models/files.md) | `File`, `Model`, `Artifact`, `FileRevision`, `Comment`, `NewSource`, and pagination wrappers |
| [Jobs](models/jobs.md)                       | `Job`, `JobStatus`, `JobStatusName`, `JobStatusMessage`                                      |
| [Systems & snapshots](models/systems.md)     | `System`, `Snapshot`, `SnapshotTag`, `SystemConfiguration`, `UpstreamRemoteInfo`             |
| [Access control](models/access.md)           | `Permission`, `AccessRelationship`, `ControlTag`, `SubjectInfo`                              |
| [Agents & modules](models/agents.md)         | `Agent`, `AgentPool`, `Module`, `Function`, `Tool`, and related input/status types           |
| [Users, tokens & admin](models/admin.md)     | `User`, `Token`, `Tenant`, `AuthIntegration`                                                 |
| [Common types](models/common.md)             | `Archive`, `Restore`, `Pageable`, `FilterBy`, `PatchOp`, and validation types                |


---

<!-- Source: api_reference/02-files.md -->

---
slug: /build/python/api_reference/files
sidebar_label: "Models and artifacts"
---

# Models and artifacts

Methods for uploading, updating, and managing models, artifacts, comments, and revisions on the Istari Digital Platform.

All methods below are on the [`Client`](01-client.md) instance. Parameters marked **(required)** must be provided. See [Enums](08-enums.md) for valid enum values and [Pagination](01-client.md#pagination) for `page`/`size` defaults.

In 13.1.9 the model, artifact, file, revision, and resource routes on `Client` are deprecated and emit `DeprecationWarning`. New code uses [`V3Client`](../v3/v3-client.mdx). The [method map](../v3/02-migration.mdx#full-method-map) pairs each deprecated call with its replacement, and each deprecated entry below links to that call. Storage helpers (`create_revision`, `read_contents`) and the control-tag calls are not part of this deprecation.

Upload with [`create_resource`](../v3/v3-client.mdx#create_resource) and `resource_type="model"`. That registers a model: a Resource you can share, track in a System, and run jobs on. Use `resource_type="artifact"` to attach an output to a model you already have. `v3` in the example is a [`V3Client`](../v3/01-quick-start.md).

```python
model = v3.create_resource("bracket.stl", resource_type="model", display_name="Bracket")
print(model.resource_id)
```

`create_resource` returns a `ResourceDto`. The deprecated `Client` methods further down still return a `Model` or `Artifact`, and each includes its storage File (`model.file`, `artifact.file`).

## Upload vs connected Resources

- **Upload** — pass `path` to the real file bytes (`.stl`, `.mdzip`, `.xlsx`, …).
- **Connect** — pass `path` to a JSON **metadata pointer** file (extension `.istari_{tool_key}_metadata`, with optional suffixes per module). [`create_resource`](../v3/v3-client.mdx#create_resource) with `resource_type="model"` takes that path. The deprecated [`add_model`](#add_model) and [`update_model`](#update_model) methods do the same.

See [Connected resources](../05-connected-resources.md) for integration extensions, job examples, and revision behavior. For `V3Client`, see [Connected resources (V3Client)](../v3/04-connected-resources.md).

## Files

These methods read and update the storage File on a model or artifact (`model.file`, `artifact.file`). To upload a Resource, use [`create_resource`](../v3/v3-client.mdx#create_resource).

### update_file()

**Deprecated** in 13.1.9. Use [`create_resource_revision`](../v3/v3-client.mdx#create_resource_revision).

Update an existing file with a new version and optional metadata.

This method replaces the contents of a file by uploading a new version from the specified path.
You can also update metadata such as sources, description, version name, or external identifier.

- **Parameters:**
  - **file_id** (_str_) – Unique identifier of the file to update.
  - **path** (_PathLike_ _|_ _str_) – Filesystem path or string path to the new file contents.
  - **sources** (_list_ _[\*\*[NewSource](models/files.md#newsource)_ _|_ _str_ _]_ _|_ _None_) – Optional list of sources related to the file. Each item may be a
    NewSource instance or a string source name.
  - **description** (_str_ _|_ _None_) – Optional updated description of the file.
  - **version_name** (_str_ _|_ _None_) – Optional user-defined version label for the updated file.
  - **external_identifier** (_str_ _|_ _None_) – Optional external system identifier for the file.
  - **display_name** (_str_ _|_ _None_) – Optional human-readable name for the file.

- **Return Type:** [File](models/files.md#file)

### update_file_properties()

**Deprecated** in 13.1.9. Use [`update_resource_revision`](../v3/v3-client.mdx#update_resource_revision).

Update metadata properties of an existing file.

This method updates non-content attributes of a file, such as display name, description,
version name, or external identifier, without modifying the file’s contents.

- **Parameters:**
  - **file** ([_File_](models/files.md#file)) – The file object whose metadata will be updated.
  - **display_name** (_str_ _|_ _None_) – Optional human-readable name to assign to the file.
  - **description** (_str_ _|_ _None_) – Optional text describing the file.
  - **external_identifier** (_str_ _|_ _None_) – Optional external system identifier for cross-referencing the file.
  - **version_name** (_str_ _|_ _None_) – Optional user-defined version label for the file.

- **Return Type:** [File](models/files.md#file)

### get_file()

**Deprecated** in 13.1.9. Use [`get_resource`](../v3/v3-client.mdx#get_resource).

Gets a file by id.

- **Parameters:**
  - **file_id** (_str_) – The id of the file to get. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [File](models/files.md#file)

### get_file_by_revision_id()

**Deprecated** in 13.1.9. Use [`get_resource_revision`](../v3/v3-client.mdx#get_resource_revision). That call also takes the resource id.

Gets a file by revision id.

- **Parameters:**
  - **revision_id** (_str_) – The revision id of the file to get. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [File](models/files.md#file)

### list_files()

**Deprecated** in 13.1.9. Use [`list_resources`](../v3/v3-client.mdx#list_resources) with `type_name=["file"]`.

Lists all files that a user has access to.

- **Parameters:**
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **filter_by** ([_FilterBy_](08-enums.md#filterby)) – Filter results by ownership. One of: `created_by_id` (created by you), `-created_by_id` (shared with you).
  - **archive_status** ([_ArchiveStatus_](08-enums.md#archivestatus)) – Filter results by archive status. One of: `active`, `archived`, `all`. Default: `active`.
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageFile](models/files.md#pagefile)

### archive_file()

**Deprecated** in 13.1.9. Use [`archive_resource`](../v3/v3-client.mdx#archive_resource).

Archives a file by updating it’s archive status to Archived.

- **Parameters:**
  - **file_id** (_str_) – The id of the file to archive. (required)
  - **archive** ([_Archive_](models/common.md#archive))
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [File](models/files.md#file)

### restore_file()

**Deprecated** in 13.1.9. Use [`restore_resource`](../v3/v3-client.mdx#restore_resource).

Restores a file by updating it’s archive status to Active.

- **Parameters:**
  - **file_id** (_str_) – The id of the file to restore. (required)
  - **restore** ([_Restore_](models/common.md#restore))
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [File](models/files.md#file)

### get_file_control_tagging_history()

Gets the full history of control taggings added to and removed from a file.

- **Parameters:**
  - **file_id** (_str_) – The ID of the file to get.. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[FileControlTagging](models/files.md#filecontroltagging)]

### get_file_control_taggings()

Gets a file’s active control taggings.

- **Parameters:**
  - **file_id** (_str_) – The ID of the file to get.. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[FileControlTagging](models/files.md#filecontroltagging)]

## Models

### add_model()

**Deprecated** in 13.1.9. Use [`create_resource`](../v3/v3-client.mdx#create_resource) with `resource_type="model"`.

Upload a filesystem path as a model: the Resource you share, track in a System, and run jobs on. This is the usual way to upload, and it matches **Add resources** in the web app.

The returned [Model](models/files.md#model) includes its storage File as `model.file`.

This method optionally attaches metadata, including description, version name, external identifier, display name, and sources.

- **Parameters:**
  - **path** (_PathLike_) – Filesystem path to the model file to upload.
  - **sources** (_list_ _[\*\*[NewSource](models/files.md#newsource)_ _|_ _str_ _]_ _|_ _None_) – Optional list of sources associated with the model. Each item may be a
    NewSource instance or a string source name.
  - **description** (_str_ _|_ _None_) – Optional text describing the model’s purpose or contents.
  - **version_name** (_str_ _|_ _None_) – Optional user-defined version label for the model.
  - **external_identifier** (_str_ _|_ _None_) – Optional external system identifier for the model.
  - **display_name** (_str_ _|_ _None_) – Optional human-readable name for the model.

- **Return Type:** [Model](models/files.md#model)

### update_model()

**Deprecated** in 13.1.9. Use [`create_resource_revision`](../v3/v3-client.mdx#create_resource_revision).

Update an existing model with a new file and optional metadata.

This method replaces the contents of a model by uploading a new file from the specified path.
You can also update metadata such as description, version name, external identifier, and sources.

- **Parameters:**
  - **model_id** (_str_) – Unique identifier of the model to update.
  - **path** (_PathLike_) – Filesystem path to the new model file.
  - **sources** (_list_ _[\*\*[NewSource](models/files.md#newsource)_ _|_ _str_ _]_ _|_ _None_) – Optional list of sources associated with the model. Each item may be a
    NewSource instance or a string source name.
  - **description** (_str_ _|_ _None_) – Optional updated description of the model.
  - **version_name** (_str_ _|_ _None_) – Optional user-defined version label for the model.
  - **external_identifier** (_str_ _|_ _None_) – Optional external system identifier for the model.
  - **display_name** (_str_ _|_ _None_) – Optional human-readable name for the model.

- **Return Type:** [Model](models/files.md#model)

### get_model()

**Deprecated** in 13.1.9. Use [`get_resource`](../v3/v3-client.mdx#get_resource).

Gets a model by id.

- **Parameters:**
  - **model_id** (_str_) – The model ID to get.. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Model](models/files.md#model)

### list_models()

**Deprecated** in 13.1.9. Use [`list_resources`](../v3/v3-client.mdx#list_resources) with `type_name=["model"]`.

Lists all models a user has access to.

- **Parameters:**
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **filter_by** ([_FilterBy_](08-enums.md#filterby)) – Filter results by ownership. One of: `created_by_id` (created by you), `-created_by_id` (shared with you).
  - **archive_status** ([_ArchiveStatus_](08-enums.md#archivestatus)) – Filter results by archive status. One of: `active`, `archived`, `all`. Default: `active`.
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageModelListItem](models/files.md#pagemodellistitem)

### archive_model()

**Deprecated** in 13.1.9. Use [`archive_resource`](../v3/v3-client.mdx#archive_resource).

Archives a model by updating it’s archive status to Archived.

- **Parameters:**
  - **model_id** (_str_) – The id of the model to archive. (required)
  - **archive** ([_Archive_](models/common.md#archive))
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Model](models/files.md#model)

### restore_model()

**Deprecated** in 13.1.9. Use [`restore_resource`](../v3/v3-client.mdx#restore_resource).

Restores a model by updating it’s archive status to Active.

- **Parameters:**
  - **model_id** (_str_) – The id of the model to restore. (required)
  - **restore** ([_Restore_](models/common.md#restore))
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Model](models/files.md#model)

### get_model_control_tagging_history()

Gets the full history of control taggings added to and removed from a model.

- **Parameters:**
  - **model_id** (_str_) – The ID of the model to get.. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[ResourceControlTagging](models/access.md#resourcecontroltagging)]

### get_model_control_taggings()

Gets a model’s active control taggings.

- **Parameters:**
  - **model_id** (_str_) – The ID of the model to get.. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[ResourceControlTagging](models/access.md#resourcecontroltagging)]

## Artifacts

### add_artifact()

**Deprecated** in 13.1.9. Use [`create_resource`](../v3/v3-client.mdx#create_resource) with `resource_type="artifact"`.

Upload a filesystem path and attach an artifact Resource to an existing model (`model_id`).

The Resources page nests the artifact under that model. The returned [Artifact](models/files.md#artifact) includes its storage File as `artifact.file`.

Optionally include metadata such as version name, description, external identifier, and source references.

- **Parameters:**
  - **model_id** (_str_) – Unique identifier of the model to which the artifact will be added.
  - **path** (_PathLike_) – Filesystem path to the artifact file to upload.
  - **sources** (_list_ _[\*\*[NewSource](models/files.md#newsource)_ _|_ _str_ _]_ _|_ _None_) – Optional list of sources associated with the artifact. Each item may be a
    NewSource instance or a string source name.
  - **description** (_str_ _|_ _None_) – Optional text describing the artifact’s contents or purpose.
  - **version_name** (_str_ _|_ _None_) – Optional user-defined version label for the artifact.
  - **external_identifier** (_str_ _|_ _None_) – Optional external system identifier for cross-referencing.
  - **display_name** (_str_ _|_ _None_) – Optional human-readable name for the artifact.

- **Return Type:** [Artifact](models/files.md#artifact)

### add_artifacts_bulk()

Add multiple artifacts to a model in a single bulk request.

This method uploads several files and registers them as artifacts on the same model. It is more efficient than calling [`add_artifact`](#add_artifact) in a loop when you have a batch of small files.

:::warning Deprecated and unstable
`add_artifacts_bulk` is deprecated and may be removed in a future release. Prefer [`add_artifact`](#add_artifact). The bulk endpoint is also limited to **10 items per call** and does not support files larger than the multipart upload threshold.
:::

- **Parameters:**
  - **model_id** (_str_) – Unique identifier of the model to which the artifacts will be added.
  - **revision_create_dtos** (_list_[[_RevisionBulkCreateItem_](models/files.md#revisionbulkcreateitem)]) – Up to 10 revision items, each specifying a file path and optional metadata (sources, description, version_name, external_identifier, display_name).

- **Return Type:** List[[Artifact](models/files.md#artifact)]

### update_artifact()

**Deprecated** in 13.1.9. Use [`create_resource_revision`](../v3/v3-client.mdx#create_resource_revision).

Update an existing artifact with a new file and optional metadata.

This method replaces the contents of an existing artifact by uploading a new file
and optionally modifying associated metadata such as sources, version, or identifiers.

- **Parameters:**
  - **artifact_id** (_str_) – Unique identifier of the artifact to update.
  - **path** (_PathLike_) – Filesystem path to the new artifact file.
  - **sources** (_list_ _[\*\*[NewSource](models/files.md#newsource)_ _|_ _str_ _]_ _|_ _None_) – Optional list of sources associated with the artifact. Each item may be a
    NewSource instance or a string source name.
  - **description** (_str_ _|_ _None_) – Optional text describing the updated artifact.
  - **version_name** (_str_ _|_ _None_) – Optional user-defined version label for the updated artifact.
  - **external_identifier** (_str_ _|_ _None_) – Optional external system identifier for cross-referencing.
  - **display_name** (_str_ _|_ _None_) – Optional human-readable name for the updated artifact.

- **Return Type:** [Artifact](models/files.md#artifact)

### get_artifact()

**Deprecated** in 13.1.9. Use [`get_resource`](../v3/v3-client.mdx#get_resource).

Gets an artifact from the database.

- **Parameters:**
  - **artifact_id** (_str_) – The id of the artifact to get.. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Artifact](models/files.md#artifact)

### list_artifacts()

**Deprecated** in 13.1.9. Use [`list_resources`](../v3/v3-client.mdx#list_resources) with `type_name=["artifact"]`.

Lists all artifacts a user has access to.

- **Parameters:**
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **filter_by** ([_FilterBy_](08-enums.md#filterby)) – Filter artifacts by ownership. One of: `created_by_id` (created by you), `-created_by_id` (shared with you).
  - **archive_status** ([_ArchiveStatus_](08-enums.md#archivestatus)) – Filter results by archive status. One of: `active`, `archived`, `all`. Default: `active`.
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageArtifact](models/files.md#pageartifact)

### list_model_artifacts()

**Deprecated** in 13.1.9. Use [`list_resources`](../v3/v3-client.mdx#list_resources) with `type_name=["artifact"]`. That call does not take a parent model id.

Lists all artifacts a user has access to for a model.

- **Parameters:**
  - **model_id** (_str_) – The id of the model to list artifacts for. (required)
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **filter_by** ([_FilterBy_](08-enums.md#filterby)) – Filter model artifacts by ownership. One of: `created_by_id` (created by you), `-created_by_id` (shared with you).
  - **archive_status** ([_ArchiveStatus_](08-enums.md#archivestatus)) – Filter results by archive status. One of: `active`, `archived`, `all`. Default: `active`.
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageArtifact](models/files.md#pageartifact)

### archive_artifact()

**Deprecated** in 13.1.9. Use [`archive_resource`](../v3/v3-client.mdx#archive_resource).

Archives an artifact by updating it’s archive status to Archived.

- **Parameters:**
  - **artifact_id** (_str_) – The id of the artifact to archive.. (required)
  - **archive** ([_Archive_](models/common.md#archive))
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Artifact](models/files.md#artifact)

### restore_artifact()

**Deprecated** in 13.1.9. Use [`restore_resource`](../v3/v3-client.mdx#restore_resource).

Restores an artifact by updating it’s archive status to Active.

- **Parameters:**
  - **artifact_id** (_str_) – The id of the artifact to restore.. (required)
  - **restore** ([_Restore_](models/common.md#restore))
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Artifact](models/files.md#artifact)

### get_artifact_control_tagging_history()

Gets the full history of control taggings added to and removed from an artifact.

- **Parameters:**
  - **artifact_id** (_str_) – The ID of the artifact to get.. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[ResourceControlTagging](models/access.md#resourcecontroltagging)]

### get_artifact_control_taggings()

Gets a artifact’s active control taggings.

- **Parameters:**
  - **artifact_id** (_str_) – The ID of the artifact to get.. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[ResourceControlTagging](models/access.md#resourcecontroltagging)]

## Comments

### add_comment()

Add a new comment to a resource.

This method uploads a file as a comment and associates it with the specified resource.
An optional description can be provided to summarize or contextualize the comment content.

- **Parameters:**
  - **resource_id** (_str_) – Unique identifier of the resource to which the comment will be added.
  - **path** (_PathLike_) – Filesystem path to the comment file to upload.
  - **description** (_str_ _|_ _None_) – Optional text describing the comment or its relevance.

- **Return Type:** [Comment](models/files.md#comment)

### update_comment()

Update an existing comment with a new file and optional description.

This method replaces the contents of an existing comment by uploading a new file.
An optional description can be provided to revise or clarify the comment’s purpose.

- **Parameters:**
  - **comment_id** (_str_) – Unique identifier of the comment to update.
  - **path** (_PathLike_) – Filesystem path to the new comment file.
  - **description** (_str_ _|_ _None_) – Optional updated description of the comment.

- **Return Type:** [Comment](models/files.md#comment)

### get_comment()

Gets a comment by id

- **Parameters:**
  - **comment_id** (_str_) – The ID of the comment to retrieve. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Comment](models/files.md#comment)

### list_artifact_comments()

**Deprecated** in 13.1.9. Use [`list_comments`](../v3/v3-client.mdx#list_comments).

Lists all comments a user has access to for an artifact.

- **Parameters:**
  - **artifact_id** (_str_) – The id of the artifact to get comments for.. (required)
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **archive_status** ([_ArchiveStatus_](08-enums.md#archivestatus)) – Filter results by archive status. One of: `active`, `archived`, `all`. Default: `active`.
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageComment](models/files.md#pagecomment)

### list_model_comments()

**Deprecated** in 13.1.9. Use [`list_comments`](../v3/v3-client.mdx#list_comments).

Lists all comments a user has access to for a model.

- **Parameters:**
  - **model_id** (_str_) – The model ID to which the comment belongs. (required)
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **archive_status** ([_ArchiveStatus_](08-enums.md#archivestatus)) – Filter results by archive status. One of: `active`, `archived`, `all`. Default: `active`.
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageComment](models/files.md#pagecomment)

### archive_comment()

Archives a comment by updating it’s archive status to Archived.

- **Parameters:**
  - **comment_id** (_str_) – The ID of the comment to archive. (required)
  - **archive** ([_Archive_](models/common.md#archive))
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Comment](models/files.md#comment)

### restore_comment()

Restores a comment by updating it’s archive status to Active.

- **Parameters:**
  - **comment_id** (_str_) – The ID of the comment to restore. (required)
  - **restore** ([_Restore_](models/common.md#restore))
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Comment](models/files.md#comment)

## Revisions

### create_revision()

Create a new file revision from a given file path and optional metadata.

This method uploads a file as a new revision and optionally attaches metadata such as
sources, display name, description, version name, and an external identifier.

- **Parameters:**
  - **file_path** (_PathLike_) – Filesystem path to the file being uploaded as a revision.
  - **sources** (_list_ _[\*\*[NewSource](models/files.md#newsource)_ _|_ _str_ _]_ _|_ _None_) – Optional list of sources associated with the revision. Each item may be a
    NewSource instance or a string source name.
  - **display_name** (_str_ _|_ _None_) – Optional human-readable name for the revision.
  - **description** (_str_ _|_ _None_) – Optional text describing the revision’s contents or purpose.
  - **version_name** (_str_ _|_ _None_) – Optional user-defined version label for the revision.
  - **external_identifier** (_str_ _|_ _None_) – Optional external system identifier for the revision.

- **Return Type:** [FileRevision](models/files.md#filerevision)

### create_revisions_bulk()

Uploads several files as new revisions in one call. Files larger than the multipart threshold are rejected; upload those with [`create_revision()`](#create_revision) one at a time.

- **Parameters:**
  - **revision_items** (_list_ of [_RevisionBulkCreateItem_](models/files.md#revisionbulkcreateitem)) – Each item is a path plus optional metadata.

- **Return Type:** list of [FileRevision](models/files.md#filerevision)

### create_secret_revision()

Create a new secret file revision from a given file path and optional metadata.

This method uploads a file containing secret content as a new revision, and optionally
associates metadata such as sources, display name, description, version name, and an external identifier.

- **Parameters:**
  - **file_path** (_PathLike_) – Filesystem path to the secret file being uploaded as a revision.
  - **sources** (_list_ _[\*\*[NewSource](models/files.md#newsource)_ _|_ _str_ _]_ _|_ _None_) – Optional list of sources associated with the revision. Each item may be a
    NewSource instance or a string source name.
  - **display_name** (_str_ _|_ _None_) – Optional human-readable name for the revision.
  - **description** (_str_ _|_ _None_) – Optional text describing the revision’s contents or purpose.
  - **version_name** (_str_ _|_ _None_) – Optional user-defined version label for the revision.
  - **external_identifier** (_str_ _|_ _None_) – Optional external system identifier for the revision.

- **Return Type:** [FileRevision](models/files.md#filerevision)

### update_revision_content()

Update the contents of an existing file revision.

This method uploads new content from the given file path to update an existing revision.
A salt value must be provided to locate or identify the revision being updated.
Optional metadata such as sources, display name, description, version name, and
external identifier can also be modified.

- **Parameters:**
  - **file_path** (_PathLike_) – Filesystem path to the new file content for the revision.
  - **salt** (_str_) – Unique salt value used to identify or deduplicate the revision update.
  - **sources** (_list_ _[\*\*[NewSource](models/files.md#newsource)_ _|_ _str_ _]_ _|_ _None_) – Optional list of sources associated with the revision. Each item may be a
    NewSource instance or a string source name.
  - **display_name** (_str_ _|_ _None_) – Optional human-readable name for the revision.
  - **description** (_str_ _|_ _None_) – Optional text describing the updated revision content.
  - **version_name** (_str_ _|_ _None_) – Optional user-defined version label for the revision.
  - **external_identifier** (_str_ _|_ _None_) – Optional external system identifier for the revision.

- **Return Type:** [FileRevision](models/files.md#filerevision)

### update_revision_properties()

Update metadata properties of an existing file revision.

This method modifies the metadata associated with a file revision, such as display name,
description, version name, or external identifier. The revision content itself is not changed.

- **Parameters:**
  - **file_revision** ([_FileRevision_](models/files.md#filerevision)) – The file revision object whose metadata will be updated.
  - **display_name** (_str_ _|_ _None_) – Optional human-readable name for the revision.
  - **description** (_str_ _|_ _None_) – Optional text describing the revision.
  - **external_identifier** (_str_ _|_ _None_) – Optional external system identifier for the revision.
  - **version_name** (_str_ _|_ _None_) – Optional user-defined version label for the revision.

- **Return Type:** [File](models/files.md#file)

### get_revision()

**Deprecated** in 13.1.9. Use [`get_resource_revision`](../v3/v3-client.mdx#get_resource_revision). That call also takes the resource id.

Gets a revision by id.

- **Parameters:**
  - **revision_id** (_str_) – The id of the revision to get (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [FileRevision](models/files.md#filerevision)

### archive_file_revision()

**Deprecated** in 13.1.9. `V3Client` has no call that archives a single revision. [`archive_resource`](../v3/v3-client.mdx#archive_resource) archives the Resource.

Archives a FileRevision by updating it’s archive status to Archived.

- **Parameters:**
  - **revision_id** (_str_) – The id of the file revision to archive. (required)
  - **archive** ([_Archive_](models/common.md#archive))
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [FileRevision](models/files.md#filerevision)

### restore_file_revision()

**Deprecated** in 13.1.9. `V3Client` has no call that restores a single revision. [`restore_resource`](../v3/v3-client.mdx#restore_resource) restores the Resource.

Restores a FileRevision by updating it’s archive status to Active.

- **Parameters:**
  - **revision_id** (_str_) – The id of the file revision to restore. (required)
  - **restore** ([_Restore_](models/common.md#restore))
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [FileRevision](models/files.md#filerevision)

### read_contents()

Read and return the raw contents of a file associated with a token.

This method retrieves the file data as a byte stream using the specified token,
which grants access to the protected resource.

- **Parameters:**
  **token** (_Token_) – Access token for retrieving the file contents.

- **Return Type:** bytes

### read_properties()

Retrieve metadata properties for a file associated with a token.

This method returns descriptive metadata about the file identified by the provided access token.
The returned Properties object includes non-content attributes such as file name, extension,
size, MIME type, and optional descriptive metadata.

Fields include:

- name: Full file name with extension (e.g., “foo.JPG”).
- stem: File name without extension (e.g., “foo”).
- extension: Lowercased file extension without the dot (e.g., “jpg”).
- suffix: File suffix with original casing and a leading dot (e.g., “.JPG”).
- size: File size in bytes.
- mime_type: MIME type of the file (e.g., “image/jpeg”).
- description: Optional description set on the file.
- version_name: Optional version label.
- external_identifier: Optional external reference ID.
- display_name: Optional user-facing display name.

* **Parameters:**
  **token** (_Token_) – Access token used to retrieve file properties.

* **Return Type:** [Properties](models/agents.md#properties)

### copy_revision_to_existing_file()

**Deprecated** in 13.1.9. `V3Client` has no copy call.

Copies a revision to an existing file.

- **Parameters:**
  - **revision_id** (_str_) – The id of the revision to copy (required)
  - **file_id** (_str_) – The id of the file to copy the revision to (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [File](models/files.md#file)

### copy_revision_to_new_file()

**Deprecated** in 13.1.9. `V3Client` has no copy call.

Copies a revision to a new file.

- **Parameters:**
  - **revision_id** (_str_) – The id of the revision to copy (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [File](models/files.md#file)

### transfer_revision_to_existing_file()

**Deprecated** in 13.1.9. `V3Client` has no transfer call.

Transfers a file revision to an existing file. The original revision that was copied will be archived and no longer active.

- **Parameters:**
  - **revision_id** (_str_) – The id of the revision to transfer (required)
  - **file_id** (_str_) – The id of the file to transfer the revision to (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [File](models/files.md#file)

### transfer_revision_to_new_file()

**Deprecated** in 13.1.9. `V3Client` has no transfer call.

Transfers a file revision to a new file. The original revision that was copied will be archived and no longer active.

- **Parameters:**
  - **revision_id** (_str_) – The id of the revision to transfer (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [File](models/files.md#file)

### transfer_revision_to_existing_artifact()

**Deprecated** in 13.1.9. `V3Client` has no transfer call.

Transfers a revision to an existing artifact. The original revision that was copied will be archived and no longer active.

- **Parameters:**
  - **revision_id** (_str_) – The id of the revision to transfer (required)
  - **artifact_id** (_str_) – The id of the artifact to transfer the revision to (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [FileRevision](models/files.md#filerevision)

### transfer_revision_to_new_artifact()

**Deprecated** in 13.1.9. `V3Client` has no transfer call.

Transfers a revision to a new artifact. The original revision that was copied will be archived and no longer active.

- **Parameters:**
  - **revision_id** (_str_) – The id of the revision to transfer (required)
  - **model_id** (_str_) – The id of the model to transfer the revision to (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [FileRevision](models/files.md#filerevision)

## Search

### get_resource()

**Deprecated** in 13.1.9 for a model, artifact, or file: this method calls the deprecated getters. Use [`get_resource`](../v3/v3-client.mdx#get_resource).

Retrieve a resource by type and ID.

This method fetches a resource of the specified type using its unique identifier.
It dispatches to the appropriate `get_*` method based on the resource type.

- **Parameters:**
  - **resource_type** (_str_) – Type of the resource to retrieve. Must be one of: `Artifact`, `Comment`, `Model`, `Job`, `FunctionAuthSecretEntity`. (required)
  - **resource_id** (_str_) – Unique identifier of the resource. (required)

- **Return Type:** [Artifact](models/files.md#artifact) | [Comment](models/files.md#comment) | [Model](models/files.md#model) | [Job](models/jobs.md#job) | [FunctionAuthSecret](models/agents.md#functionauthsecret)

- **Raises:** `TypeError` if `resource_type` is not one of the supported values.

### list_resources()

**Deprecated** in 13.1.9. Use [`list_resources`](../v3/v3-client.mdx#list_resources).

Lists all resources a user has access to.

- **Parameters:**
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **id** (_List_ _[\*\*Optional_ _[\*\*str_ _]_ _]_) – A list of resource IDs to filter on
  - **file_name** (_List_ _[\*\*Optional_ _[\*\*str_ _]_ _]_) – A list of file names to filter on (single value performs a like comparison)
  - **type_name** (_List_ _[\*\*[ResourceType](08-enums.md#resourcetype)_ _]_) – A list of resource types to filter on. Values: `model`, `artifact`, `comment`, `job`, `document`, `resource`.
  - **description** (_List_ _[\*\*str_ _]_) – A list of file descriptions to filter on (single value performs a like comparison)
  - **version_name** (_List_ _[\*\*str_ _]_) – A list of file version names to filter on (single value performs a like comparison)
  - **external_identifier** (_List_ _[\*\*str_ _]_) – A list of file external identifiers to filter on (single value performs a like comparison)
  - **display_name** (_List_ _[\*\*str_ _]_) – A list of file display names to filter on (single value performs a like comparison)
  - **mime_type** (_List_ _[\*\*str_ _]_) – A list of file mime types to filter on
  - **file_size** (_List_ _[\*\*int_ _]_) – A list of file sizes to filter on
  - **created_timestamp** (_List_ _[\*\*Optional_ _[\*\*datetime_ _]_ _]_) – A list of file creation timestamps to filter on
  - **updated_timestamp** (_List_ _[\*\*datetime_ _]_) – A list of file update timestamps to filter on
  - **created_by_id** (_List_ _[\*\*str_ _]_) – A list of user IDs that created the file to filter on
  - **updated_by_id** (_List_ _[\*\*str_ _]_) – A list of user IDs that updated the file to filter on
  - **archive_status** (_List_ _[\*\*[ArchiveStatusName](08-enums.md#archivestatusname)_ _]_) – A list of archive statuses to filter on. Values: `Archived`, `Active`.
  - **access_type** ([_BulkSharingAccessRelation_](08-enums.md#bulksharingaccessrelation)) – Filter resources by access type. One of: `viewer`, `editor`.
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageResourceSearchItem](models/files.md#pageresourcesearchitem)

### search_resources()

**Deprecated** in 13.1.9. Use [`search`](../v3/08-search-and-favorites.md#search).

Performs a full-text search across resources.

- **Parameters:**
  - **full_text_search** ([_FullTextSearch_](models/files.md#fulltextsearch)) – The search query. The `search_term` field must be at least 1 character. `page` must be at least `1`; `size` must be between `1` and `100` (defaults: page `1`, size `10`). (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageTypeVarCustomizedResourceSearchItem](models/files.md#pagetypevarcustomizedresourcesearchitem)


---

<!-- Source: api_reference/03-jobs.md -->

---
slug: /build/python/api_reference/jobs
sidebar_label: "Jobs"
---

# Jobs

Methods for creating, monitoring, and managing job execution on the Istari Digital Platform.

All methods are available on the [`Client`](01-client.md) instance. Parameters marked **(required)** must be provided. See [Enums](08-enums.md) for valid enum values and [Pagination](01-client.md#pagination) for `page`/`size` defaults.

## Create and retrieve

### add_job()

Add a new job to a model.

This method creates and registers a new job associated with the specified model.
You can define the job’s function and optionally provide input parameters, execution
environment details, and descriptive metadata.

- **Parameters:**
  - **model_id** (_str_) – Unique identifier of the model to which the job will be attached.
  - **function** (_str_) – Name of the function that the job will execute.
  - **parameters** (_JSON_ _|_ _None_) – Optional structured input parameters to pass to the function.
  - **parameters_file** (_PathLike_ _|_ _None_) – Optional filesystem path to a file containing job parameters.
  - **tool_name** (_str_ _|_ _None_) – Optional name of the tool used in this job.
  - **tool_version** (_str_ _|_ _None_) – Optional version of the tool used in this job.
  - **operating_system** ([_OS_](08-enums.md#os) _|_ _None_) – Optional target operating system for job execution. See [OS](08-enums.md#os) for valid values (e.g. `Windows 11`, `Ubuntu 24.04`).
  - **assigned_agent_id** (_str_ _|_ _None_) – Optional ID of a specific agent to execute the job.
  - **assigned_agent_pool_id** (_str_ _|_ _None_) – Optional ID of an agent pool to execute the job.
  - **agent_id** (_str_ _|_ _None_) – Optional identifier for the agent that created the job.
  - **auth_bindings** (_list_ _[\*\*[NewCredentialBinding](models/jobs.md#newcredentialbinding)_ _]_ _|_ _None_) – Optional credential bindings for the function's `auth_info`
    inputs. Each binding names a function input and the ID of the stored
    credential that will feed it when the job is claimed.
  - **sources** (_list_ _[\*\*[NewSource](models/files.md#newsource)_ _|_ _str_ _]_ _|_ _None_) – Optional list of sources associated with the job. Each item may be a
    NewSource instance or a string source name.
  - **description** (_str_ _|_ _None_) – Optional description of the job.
  - **version_name** (_str_ _|_ _None_) – Optional user-defined version label for the job.
  - **external_identifier** (_str_ _|_ _None_) – Optional external system identifier for the job.
  - **display_name** (_str_ _|_ _None_) – Optional human-readable name for the job.

- **Return Type:** [Job](models/jobs.md#job)

### get_job()

Gets a job by id.

- **Parameters:**
  - **job_id** (_str_) – The id of the job to get. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Job](models/jobs.md#job)

### update_job()

Update an existing job with a new file and optional metadata.

This method replaces the contents of a job by uploading a new file and allows updating
associated metadata such as description, version name, external identifier, and sources.

- **Parameters:**
  - **job_id** (_str_) – Unique identifier of the job to update.
  - **path** (_PathLike_) – Filesystem path to the new job file.
  - **sources** (_list_ _[\*\*[NewSource](models/files.md#newsource)_ _|_ _str_ _]_ _|_ _None_) – Optional list of sources associated with the job. Each item may be a
    NewSource instance or a string source name.
  - **description** (_str_ _|_ _None_) – Optional updated description of the job.
  - **version_name** (_str_ _|_ _None_) – Optional user-defined version label for the job.
  - **external_identifier** (_str_ _|_ _None_) – Optional external system identifier for the job.
  - **display_name** (_str_ _|_ _None_) – Optional human-readable name for the job.

- **Return Type:** [Job](models/jobs.md#job)

## List and filter

### list_jobs()

Lists the jobs that a user has access to.

- **Parameters:**
  - **model_id** (_str_) – Filter jobs by model id
  - **status_name** ([_JobStatusName_](08-enums.md#jobstatusname)) – Filter jobs by status name. One of: `Created`, `Pending`, `Claimed`, `Validating`, `Running`, `Uploading`, `Completed`, `Failed`, `Canceled`, `Unknown`.
  - **all_users** (_bool_) – Show jobs owned by all users (requires admin privileges).
  - **page** (_int_) – Page number. Min: `1`. Default: `1`.
  - **size** (_int_) – Page size. Range: `0`–`100`. Default: `10`.
  - **archive_status** ([_ArchiveStatus_](08-enums.md#archivestatus)) – Filter jobs by archive status. One of: `active`, `archived`, `all`. Default: `active`.
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageJob](models/jobs.md#pagejob)

### list_model_jobs()

**Deprecated** in 13.1.9. `GET /api/v2/models/{model_id}/jobs` emits `DeprecationWarning`. Use [`list_jobs`](#list_jobs) with `model_id`. Jobs stay on `Client`; `V3Client` has no job calls.

Lists all jobs a user has access to for a model.

- **Parameters:**
  - **model_id** (_str_) – The id of the model to list jobs for. (required)
  - **status_name** ([_JobStatusName_](08-enums.md#jobstatusname)) – Filter results by job status. One of: `Created`, `Pending`, `Claimed`, `Validating`, `Running`, `Uploading`, `Completed`, `Failed`, `Canceled`, `Unknown`.
  - **page** (_int_) – Page number. Min: `1`. Default: `1`.
  - **size** (_int_) – Page size. Range: `0`–`100`. Default: `10`.
  - **archive_status** ([_ArchiveStatus_](08-enums.md#archivestatus)) – Filter results by archive status. One of: `active`, `archived`, `all`. Default: `active`.
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageJob](models/jobs.md#pagejob)

## Status and assignment

### update_job_status()

Updates the status of a job.

- **Parameters:**
  - **job_id** (_str_) – The id of the job to update (required)
  - **status_name** ([_JobStatusName_](08-enums.md#jobstatusname)) – The new status name to update the job with. One of: `Created`, `Pending`, `Claimed`, `Validating`, `Running`, `Uploading`, `Completed`, `Failed`, `Canceled`, `Unknown`. (required)
  - **agent_id** (_str_) – An optional id for the agent.
  - **job_status_message** ([_JobStatusMessage_](models/jobs.md#jobstatusmessage))
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Job](models/jobs.md#job)

### update_job_assigned_agent()

Updates the assigned agent for a job.

- **Parameters:**
  - **job_id** (_str_) – The id of the job to update the assigned agent for. (required)
  - **new_job_assigned_agent** ([_NewJobAssignedAgent_](models/jobs.md#newjobassignedagent)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Job](models/jobs.md#job)

### remove_job_assigned_agent()

Removes the assigned agent from a job.

- **Parameters:**
  - **job_id** (_str_) – The id of the job to remove the assigned agent from. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Job](models/jobs.md#job)

### update_job_assigned_agent_pool()

Assign an agent pool to a job. Any agent in the pool that matches the job's requirements may claim the job.

- **Parameters:**
  - **job_id** (_str_) – The id of the job to update the assigned agent pool for. (required)
  - **new_job_assigned_agent_pool** ([_NewJobAssignedAgentPool_](models/jobs.md#newjobassignedagentpool)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Job](models/jobs.md#job)

### remove_job_assigned_agent_pool()

Remove the assigned agent pool from a job.

- **Parameters:**
  - **job_id** (_str_) – The id of the job to remove the assigned agent pool from. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Job](models/jobs.md#job)

## Archive and restore

### archive_job()

Archives a job by updating it’s archive status to Archived.

- **Parameters:**
  - **job_id** (_str_) – The id of the job to archive. (required)
  - **archive** ([_Archive_](models/common.md#archive))
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Job](models/jobs.md#job)

### restore_job()

Restores a job by updating it’s archive status to Active.

- **Parameters:**
  - **job_id** (_str_) – The id of the job to restore. (required)
  - **restore** ([_Restore_](models/common.md#restore))
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Job](models/jobs.md#job)


---

<!-- Source: api_reference/04-systems.md -->

---
slug: /build/python/api_reference/systems
sidebar_label: "Systems"
---

# Systems

Methods for managing systems, configurations, snapshots, tags, and tracked files on the Istari Digital Platform.

All methods are available on the [`Client`](01-client.md) instance. Parameters marked **(required)** must be provided. See [Enums](08-enums.md) for valid enum values and [Pagination](01-client.md#pagination) for `page`/`size` defaults.

## Systems

### create_system()

Creates a new system.

- **Parameters:**
  - **new_system** ([_NewSystem_](models/systems.md#newsystem)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [System](models/systems.md#system)

### update_system()

Updates an existing system.

- **Parameters:**
  - **system_id** (_str_) – The id of the system to update. (required)
  - **update_system** ([_UpdateSystem_](models/systems.md#updatesystem)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [System](models/systems.md#system)

### get_system()

Gets a system by id.

- **Parameters:**
  - **system_id** (_str_) – The id of the system to get. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [System](models/systems.md#system)

### list_systems()

Lists all the systems a user has access to.

- **Parameters:**
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **filter_by** ([_FilterBy_](08-enums.md#filterby)) – Filter results by ownership. One of: `created_by_id` (created by you), `-created_by_id` (shared with you).
  - **archive_status** ([_ArchiveStatus_](08-enums.md#archivestatus)) – Filter results by archive status. One of: `active`, `archived`, `all`. Default: `active`.
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageSystem](models/systems.md#pagesystem)

### get_system_baseline()

Gets the system baseline by system id.

- **Parameters:**
  - **system_id** (_str_) – The id of the system to get the baseline for. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [SystemBaseline](models/systems.md#systembaseline)

### archive_system()

Archives a system by updating it’s archive status to Archived.

- **Parameters:**
  - **system_id** (_str_) – The id of the system to archive. (required)
  - **archive** ([_Archive_](models/common.md#archive))
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [System](models/systems.md#system)

### restore_system()

Restores a system by updating it’s archive status to Active.

- **Parameters:**
  - **system_id** (_str_) – The id of the system to restore. (required)
  - **restore** ([_Restore_](models/common.md#restore))
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [System](models/systems.md#system)

## Configurations

### create_configuration()

Creates a new configuration for a system.

- **Parameters:**
  - **system_id** (_str_) – The id of the system to create a configuration for. (required)
  - **new_system_configuration** ([_NewSystemConfiguration_](models/systems.md#newsystemconfiguration)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [SystemConfiguration](models/systems.md#systemconfiguration)

### get_configuration()

Gets a configuration by id.

- **Parameters:**
  - **configuration_id** (_str_) – The id of the configuration to get. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [SystemConfiguration](models/systems.md#systemconfiguration)

### list_system_configurations()

Lists all the system configurations a user has access to.

- **Parameters:**
  - **system_id** (_str_) – The id of the system to list configurations for. (required)
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **archive_status** ([_ArchiveStatus_](08-enums.md#archivestatus)) – Filter results by archive status. One of: `active`, `archived`, `all`. Default: `active`.
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageSystemConfiguration](models/systems.md#pagesystemconfiguration)

### archive_configuration()

Archives a configuration by updating it’s archive status to Archived.

- **Parameters:**
  - **configuration_id** (_str_) – The id of the configuration to archive. (required)
  - **archive** ([_Archive_](models/common.md#archive))
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [SystemConfiguration](models/systems.md#systemconfiguration)

### restore_configuration()

Restores a configuration by updating it’s archive status to Active.

- **Parameters:**
  - **configuration_id** (_str_) – The id of the configuration to restore. (required)
  - **restore** ([_Restore_](models/common.md#restore))
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [SystemConfiguration](models/systems.md#systemconfiguration)

### list_tracked_files()

List all the tracked files for a configuration that the user has access to.

- **Parameters:**
  - **configuration_id** (_str_) – The id of the configuration to list tracked files for. (required)
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageTrackedFile](models/files.md#pagetrackedfile)

### list_configuration_revisions()

List file revisions tracked by a configuration that the user has access to. Useful for auditing what each tracked file pointed to over time.

- **Parameters:**
  - **configuration_id** (_str_) – The id of the configuration to list revisions for. (required)
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageConfigurationRevisionSearchItem](models/systems.md#pageconfigurationrevisionsearchitem)

## System composition

A system can be composed from other systems by listing them as **subsystems** on a configuration. Each subsystem entry pins a child system to a specific snapshot tag (e.g. the child's `main` branch), so the parent's snapshot captures both its own tracked files and a deterministic version of every linked child. This makes it possible to model an assembly hierarchy — vehicle → subassembly → component — and have the parent snapshot resolve the exact files that belonged to each subsystem at the time it was taken.

### Creating a configuration with subsystems

Pass [`NewTrackedSystem`](models/systems.md#newtrackedsystem) entries in the `tracked_systems` field of [`NewSystemConfiguration`](models/systems.md#newsystemconfiguration) when calling [`create_configuration()`](#create_configuration). Each entry references a child `system_id` and a `tag_id` that pins the subsystem to a specific [`SnapshotTag`](models/systems.md#snapshottag) on the child.

The typical workflow is:

1. Create the **child** system and a configuration on it with the files you want exposed as a subsystem.
2. Look up the child configuration's latest snapshot via [`list_snapshots()`](#list_snapshots).
3. Tag that snapshot with [`create_tag()`](#create_tag) so it can be referenced by the parent.
4. Create the **parent** system and configuration, passing a `NewTrackedSystem(system_id=<child>, tag_id=<tag>)` for each subsystem.

Omitting `tag_id` is allowed but rarely useful: it falls back to the child's baseline, which on a freshly-created system is an empty bootstrap snapshot with no tracked files.

```python
from istari_digital_client import (
    NewSnapshotTag,
    NewSystem,
    NewSystemConfiguration,
    NewTrackedFile,
    NewTrackedSystem,
    TrackedFileSpecifierType,
)

child = client.create_system(NewSystem(name="actuator", description="actuator subsystem"))
child_config = client.create_configuration(
    system_id=child.id,
    new_system_configuration=NewSystemConfiguration(
        name="v1",
        tracked_files=[
            NewTrackedFile(
                specifier_type=TrackedFileSpecifierType.LATEST,
                file_id=child_model.file.id,
            ),
        ],
    ),
)
child_snapshot = client.list_snapshots(
    configuration_id=child_config.id, size=1, sort="-created"
).items[0]
child_tag = client.create_tag(
    snapshot_id=child_snapshot.id,
    new_snapshot_tag=NewSnapshotTag(tag="v1"),
)

parent = client.create_system(NewSystem(name="vehicle", description="parent vehicle"))
parent_config = client.create_configuration(
    system_id=parent.id,
    new_system_configuration=NewSystemConfiguration(
        name="v1",
        tracked_files=[
            NewTrackedFile(
                specifier_type=TrackedFileSpecifierType.LATEST,
                file_id=parent_model.file.id,
            ),
        ],
        tracked_systems=[
            NewTrackedSystem(system_id=child.id, tag_id=child_tag.id),
        ],
    ),
)
```

To revise the subsystem set later, create a new configuration on the parent with the updated `tracked_systems` list. To move a subsystem pin to a different snapshot of the child without changing the parent, use [`update_tag()`](#update_tag) to point the existing child tag at a new snapshot.

### list_configuration_subsystems()

Lists the subsystems linked from a configuration. Each item resolves the child system together with the [`SystemConfiguration`](models/systems.md#systemconfiguration) and snapshot it is pinned to.

- **Parameters:**
  - **configuration_id** (_str_) – The id of the configuration to list subsystems for. (required)
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageSubsystem](models/systems.md#pagesubsystem)

### list_snapshot_subsystems()

Lists the subsystems captured by a snapshot. Use this to inspect the subsystem set that was pinned when a snapshot was taken (including subsystems whose underlying system has since been archived).

- **Parameters:**
  - **snapshot_id** (_str_) – The id of the snapshot to list subsystems for. (required)
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageSnapshotSubsystemItem](models/systems.md#pagesnapshotsubsystemitem)

## Snapshots

### create_snapshot()

Creates a new snapshot.

- **Parameters:**
  - **configuration_id** (_str_) – The id of the configuration to create a snapshot for. (required)
  - **new_snapshot** ([_NewSnapshot_](models/systems.md#newsnapshot)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [ResponseCreateSnapshot](models/systems.md#responsecreatesnapshot)

### get_snapshot()

Gets a snapshot by id.

- **Parameters:**
  - **snapshot_id** (_str_) – The id of the snapshot to get. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Snapshot](models/systems.md#snapshot)

### list_snapshots()

Lists all the snapshots a user has access to

- **Parameters:**
  - **system_id** (_str_) – The id of the system to filter snapshots by
  - **configuration_id** (_str_) – The id of the configuration to filter snapshots by
  - **tag** (_str_) – The tag to filter snapshots by
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageSnapshot](models/systems.md#pagesnapshot)

### list_snapshot_items()

Lists all the snapshot items a user has access to.

- **Parameters:**
  - **snapshot_id** (_str_) – The id of the snapshot to list items for. (required)
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageSnapshotItem](models/systems.md#pagesnapshotitem)

### list_snapshot_revisions()

Gets a snapshot’s revisions.

- **Parameters:**
  - **snapshot_id** (_str_) – The id of the system snapshot to list revisions for. (required)
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **name** (_List_ _[\*\*str_ _]_) – A list of file names to filter on (single value performs a like comparison)
  - **extension** (_List_ _[\*\*str_ _]_) – A list of file extensions to filter on (single value performs a like comparison)
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageSnapshotRevisionSearchItem](models/files.md#pagesnapshotrevisionsearchitem)

## Snapshot tags

### create_tag()

Creates a new snapshot tag.

- **Parameters:**
  - **snapshot_id** (_str_) – The id of the snapshot to create a tag for. (required)
  - **new_snapshot_tag** ([_NewSnapshotTag_](models/systems.md#newsnapshottag)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [SnapshotTag](models/systems.md#snapshottag)

### get_tag()

Gets a snapshot tag by id.

- **Parameters:**
  - **tag_id** (_str_) – The id of the tag to get. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [SnapshotTag](models/systems.md#snapshottag)

### update_tag()

Updates an existing snapshot tag by moving it to a different snapshot.

- **Parameters:**
  - **tag_id** (_str_) – The id of the tag to update. (required)
  - **update_tag** ([_UpdateTag_](models/systems.md#updatetag)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [SnapshotTag](models/systems.md#snapshottag)

### list_tags()

Lists all the snapshot tags a user has access to.

- **Parameters:**
  - **system_id** (_str_) – The id of the system to filter tags by
  - **configuration_id** (_str_) – The id of the configuration to filter tags by
  - **snapshot_id** (_str_) – The id of the snapshot to filter tags by
  - **archive_status** ([_ArchiveStatus_](08-enums.md#archivestatus)) – Filter results by archive status. One of: `active`, `archived`, `all`. Default: `active`.
  - **page** (_int_) – Page number. Min: `1`. Default: `1`.
  - **size** (_int_) – Page size. Range: `0`–`100`. Default: `10`.
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageSnapshotTag](models/systems.md#pagesnapshottag)

### get_tag_history()

Get the full revision history of a snapshot tag, including every snapshot it has pointed to and every move/rename event.

- **Parameters:**
  - **tag_id** (_str_) – The id of the tag to get history for. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[SnapshotTagRevision](models/systems.md#snapshottagrevision)]

### archive_tag()

Archives a snapshot tag by updating it’s archive status to Archived.

- **Parameters:**
  - **tag_id** (_str_) – The id of the tag to archive. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [SnapshotTag](models/systems.md#snapshottag)

### restore_tag()

Restores a snapshot tag by updating it’s archive status to Active.

- **Parameters:**
  - **tag_id** (_str_) – The id of the tag to restore. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [SnapshotTag](models/systems.md#snapshottag)

## Folders

A folder is a path prefix on a tracked Resource in a configuration. Writing a folder on a commit is covered in [Folders in a System](../06-folders.md). The methods below list and move paths on one configuration.

`folder_path` values use the encoded form described on that page.

### list_folders()

Lists the distinct folder prefixes on a configuration. The response is a flat list, not a page.

- **Parameters:**
  - **configuration_id** (_str_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `FolderList` — `folders`, each with a `path`.

### rename_folder_prefix()

Renames or reparents a folder prefix.

- **Parameters:**
  - **configuration_id** (_str_) – (required)
  - **rename_folder_prefix** (`RenameFolderPrefix`) – (required). `from_path` and `to_path`.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** [SystemConfiguration](models/systems.md#systemconfiguration)

### move_tracked_file()

Moves one tracked file to another folder. `folder_path` null places it at the configuration root.

- **Parameters:**
  - **configuration_id** (_str_) – (required)
  - **tracked_file_id** (_str_) – (required)
  - **move_tracked_file** (`MoveTrackedFile`) – (required). `folder_path`.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** [SystemConfiguration](models/systems.md#systemconfiguration)

### bulk_move_tracked_files()

Moves several tracked files into one folder.

- **Parameters:**
  - **configuration_id** (_str_) – (required)
  - **bulk_move_tracked_files** (`BulkMoveTrackedFiles`) – (required). `tracked_file_ids` and `target_folder_path`.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** [SystemConfiguration](models/systems.md#systemconfiguration)

## Tracked containers

### list_tracked_containers()

Lists connected containers tracked by a configuration.

- **Parameters:**
  - **configuration_id** (_str_) – (required)
  - **page** (_int_, _optional_)
  - **size** (_int_, _optional_) – 1–100. Default 10.
  - **sort** (_str_, _optional_)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `PageTrackedContainer`

## Snapshot comparison

The same filters are used by change-request diffs. See [Change requests](12-change-requests.md).

### compare_snapshots()

Compares two snapshots. Both sides are immutable ids, so the page has `items`, `next_cursor`, and `has_more` and no pin token. Pass `next_cursor` back as `cursor`.

- **Parameters:**
  - **system_id** (_str_) – (required)
  - **source_snapshot_id** (_str_) – (required)
  - **target_snapshot_id** (_str_) – (required)
  - **component_type** ([_ChangeRequestComponentType_](08-enums.md#changerequestcomponenttype), _optional_) – `RESOURCE`, `SUBSYSTEM`, or `ALL`.
  - **change_types** (_list_ of [_ChangeRequestDiffType_](08-enums.md#changerequestdifftype), _optional_)
  - **search** (_str_, _optional_) – Name filter.
  - **cursor** (_str_, _optional_)
  - **limit** (_int_, _optional_) – Maximum 100.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `CompareDiffPage`

### compare_tag_to_live()

Compares a branch head to the configuration's live tracked state. The page includes `live_diff_token`. On the next page of the **same** `component_type`, pass that value as `x_live_diff_token` together with `cursor`. The token applies only when `cursor` is set. A cursorless request starts a new diff and returns a new token. HTTP 409 means the pinned live state moved; start the diff again.

- **Parameters:**
  - **system_id** (_str_) – (required)
  - **target_tag_id** (_str_) – Branch (tag) id whose head snapshot is the diff base. (required)
  - **component_type** ([_ChangeRequestComponentType_](08-enums.md#changerequestcomponenttype), _optional_)
  - **change_types** (_list_ of [_ChangeRequestDiffType_](08-enums.md#changerequestdifftype), _optional_)
  - **search** (_str_, _optional_)
  - **cursor** (_str_, _optional_)
  - **limit** (_int_, _optional_) – Maximum 100.
  - **x_live_diff_token** (_str_, _optional_) – `live_diff_token` from a prior page of the same `component_type`.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `CompareLiveDiffPage`


---

<!-- Source: api_reference/05-access.md -->

---
slug: /build/python/api_reference/access
sidebar_label: "Access control"
---

# Access control

Methods for sharing resources, managing permissions, and assigning control tags on the Istari Digital Platform.

All methods are available on the [`Client`](01-client.md) instance. Parameters marked **(required)** must be provided. See [Enums](08-enums.md) for valid enum values and [Pagination](01-client.md#pagination) for `page`/`size` defaults.

On this page, a **tenant administrator** is a caller who holds one of these roles:

- On installations with [tenant management](16-identity.md#tenant-management): `tenant_admin` in their own tenant, or the platform `admin` role.
- On other installations: `customer_admin`, the [organization administrator](../../intro/terminology.md#organization-administrator) role.

## Sharing

Tool and function **executor** access uses a separate API from the generic sharing methods below.

- To read a user's executor access, call [`list_resource_type_permissions()`](#list_resource_type_permissions) with `resource_type` `tool` or `function` and `permission` `execute`.
- To set it, call [`update_access_for_resource_type()`](#update_access_for_resource_type) with relation `executor`.
- A tenant administrator can grant executor access without holding view permission on each tool.
- Do not use [`create_access()`](#create_access), [`update_access()`](#update_access), or [`list_access()`](#list_access) for tool or function executor grants.

### create_access()

Shares a resource or file with a user by updating the resource or file’s access.

Does not support `tool` or `function` resource types, or the `executor` relation on any resource type. For tool and function executor access, use [`update_access_for_resource_type()`](#update_access_for_resource_type).

- **Parameters:**
  - **access_relationship** ([_AccessRelationship_](models/access.md#accessrelationship)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [AccessRelationship](models/access.md#accessrelationship)

### update_access()

Updates access to a resource or file.

Does not support `tool` or `function` resource types, or the `executor` relation on any resource type. For tool and function executor access, use [`update_access_for_resource_type()`](#update_access_for_resource_type).

- **Parameters:**
  - **subject_type** ([_AccessSubjectType_](08-enums.md#accesssubjecttype)) – The type of the subject to update. Currently only `user`. (required)
  - **subject_id** (_str_) – The id of the subject to update. (required)
  - **resource_type** ([_AccessResourceType_](08-enums.md#accessresourcetype)) – The type of the resource to update. One of: `model`, `artifact`, `resource`, `job`, `file`, `filerevision`, `tool`, `function`, `functionversion`, `tenant`, `system`, `functionauthsecret`, `authintegration`, `document`. (required)
  - **resource_id** (_str_) – The id of the resource to update. (required)
  - **update_access_relationship** ([_UpdateAccessRelationship_](models/access.md#updateaccessrelationship)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [AccessRelationship](models/access.md#accessrelationship)

### remove_access()

Removes access to a resource or file.

- **Parameters:**
  - **subject_type** ([_AccessSubjectType_](08-enums.md#accesssubjecttype)) – The type of the subject to remove. Currently only `user`. (required)
  - **subject_id** (_str_) – The id of the subject to remove. (required)
  - **resource_type** ([_AccessResourceType_](08-enums.md#accessresourcetype)) – The type of the resource. One of: `model`, `artifact`, `resource`, `job`, `file`, `filerevision`, `tool`, `function`, `functionversion`, `tenant`, `system`, `functionauthsecret`, `authintegration`, `document`. (required)
  - **resource_id** (_str_) – The id of the resource to remove access from. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** object

### list_access()

Lists all access relationships on a single resource or file.

The caller must have **view** permission on the resource; otherwise the call returns 403. This includes `tool` and `function` resources — a tenant administrator who can grant executor access through [`update_access_for_resource_type()`](#update_access_for_resource_type) still needs view on that tool to call `list_access` on it. To list which tools or functions a user can execute, use [`list_resource_type_permissions()`](#list_resource_type_permissions) instead.

- **Parameters:**
  - **resource_type** ([_AccessResourceType_](08-enums.md#accessresourcetype)) – The type of the resource. One of: `model`, `artifact`, `resource`, `job`, `file`, `filerevision`, `tool`, `function`, `functionversion`, `tenant`, `system`, `functionauthsecret`, `authintegration`, `document`. (required)
  - **resource_id** (_str_) – The id of the resource. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[AccessRelationship](models/access.md#accessrelationship)]

### bulk_create_access()

Bulk method that shares resources with users by granting new access relationships.

- **Parameters:**
  - **access_relationship** (_List_ _[\*\*[AccessRelationship](models/access.md#accessrelationship)_ _]_) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[AccessRelationship](models/access.md#accessrelationship)]

### create_access_by_email_for_other_tenants()

Shares a resource or file across tenants by the applicable user’s email.

- **Parameters:**
  - **subject_type** ([_AccessSubjectType_](08-enums.md#accesssubjecttype)) – The type of the subject. Currently only `user`. (required)
  - **email** (_str_) – The email of the subject to create access for. (required)
  - **resource_type** ([_AccessResourceType_](08-enums.md#accessresourcetype)) – The type of the resource to create access for. One of: `model`, `artifact`, `resource`, `job`, `file`, `filerevision`, `tool`, `function`, `functionversion`, `tenant`, `system`, `functionauthsecret`, `authintegration`, `document`. (required)
  - **resource_id** (_str_) – The id of the resource to create access for. (required)
  - **access_relationship** ([_AccessRelation_](08-enums.md#accessrelation)) – The access relationship to create. One of: `viewer`, `editor`, `owner`, `administrator`, `executor`, `upstreamremoteowner`, `upstreamremoteeditowner`. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [AccessRelationship](models/access.md#accessrelationship)

### update_access_for_resource_type()

Sets a user's access across all resources of a given type.

For `tool` and `function`, this is the supported way to grant **executor** access. The caller must be a **tenant administrator**. The call **replaces** all existing access relationships of that resource type for the subject — include every tool or function ID the user should retain, not only new grants.

- **Parameters:**
  - **subject_type** ([_AccessSubjectType_](08-enums.md#accesssubjecttype)) – The type of the subject to update. Currently only `user`. (required)
  - **subject_id** (_str_) – The id of the subject to update. (required)
  - **resource_type** ([_AccessResourceType_](08-enums.md#accessresourcetype)) – The type of the resources to update. One of: `model`, `artifact`, `resource`, `job`, `file`, `filerevision`, `tool`, `function`, `functionversion`, `tenant`, `system`, `functionauthsecret`, `authintegration`, `document`. (required)
  - **update_access_relationship_list** ([_UpdateAccessRelationshipList_](models/access.md#updateaccessrelationshiplist)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[AccessRelationship](models/access.md#accessrelationship)]

### list_resource_type_permissions()

Lists every resource of a type on which a subject holds a given permission.

Use this to read a user's **executor** access to tools or functions (`resource_type` `tool` or `function`, `permission` `execute`). A tenant administrator may query another user's permissions; non-admins may only query their own.

- **Parameters:**
  - **subject_type** ([_PermissionSubjectType_](08-enums.md#permissionsubjecttype)) – The type of the subject to get permissions for. See [PermissionSubjectType](08-enums.md#permissionsubjecttype) for values. (required)
  - **subject_id** (_str_) – The id of the subject to get permissions for. (required)
  - **resource_type** ([_PermissionResourceType_](08-enums.md#permissionresourcetype)) – The type of the resources to get permissions for. See [PermissionResourceType](08-enums.md#permissionresourcetype) for values. (required)
  - **permission** ([_Permission_](08-enums.md#permission)) – The type of the permissions to list. See [Permission](08-enums.md#permission) for values. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[Permissionship](models/access.md#permissionship)]

## Control tags

A control tag is a need-to-know control assigned to users and to Resources together. A user can open a tagged Resource when they have a role on it and hold every tag the Resource carries. See [Control Tag](../../intro/key-concepts/sharing-security-access-control.md#control-tag).

### create_control_tag()

Creates a new control tag.

- **Parameters:**
  - **new_control_tag** ([_NewControlTag_](models/access.md#newcontroltag)) – The control tag to create. The `description` field has a maximum length of 255 characters. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [ControlTag](models/access.md#controltag)

### get_control_tag()

Gets a control tag by id.

- **Parameters:**
  - **control_tag_id** (_str_) – The ID of the control tag to get.. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [ControlTag](models/access.md#controltag)

### update_control_tag()

Updates an existing control tag.

- **Parameters:**
  - **update_control_tag** ([_UpdateControlTag_](models/access.md#updatecontroltag)) – The updated control tag data. The `description` field has a maximum length of 255 characters. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [ControlTag](models/access.md#controltag)

### list_control_tags()

List all control tags

- **Parameters:**
  **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[ControlTag](models/access.md#controltag)]

### get_control_tag_revision_history()

Control tag revision history.

- **Parameters:**
  - **control_tag_id** (_str_) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[ControlTagRevision](models/access.md#controltagrevision)]

### get_object_control_tags()

Get the active control tag assignments for an object

- **Parameters:**
  - **object_type** ([_ControlTaggingObjectType_](08-enums.md#controltaggingobjecttype)) – Type of object to get control tags for. One of: `model`, `artifact`, `file`, `user`, `system`, `resource`, `unknown`. (required)
  - **object_id** (_str_) – ID of the object to get control tags for.. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[ControlTag](models/access.md#controltag)]

## Control tag assignments

### add_user_control_taggings()

Assign one or more control tags to a user.

When a control tag is applied to a user, the access is propagated to related resources
(e.g., models and their child artifacts). The returned list of resource control taggings
may exceed the number of control tags assigned due to this propagation.

The calling user must be a tenant administrator of the tenant the target user belongs to;
otherwise, the operation will fail with a permission denied error.

- **Parameters:**
  - **user_id** (_str_) – Unique identifier of the user to whom control tag access will be assigned.
  - **control_tag_ids** (_Iterable_ _[\*\*str_ _]_) – Identifiers of the control tags to assign.
  - **reason** (_Optional_ _[\*\*str_ _]_) – Optional reason for assigning the control tags.

- **Return Type:** list[[UserControlTagging](models/access.md#usercontroltagging)]

### remove_user_control_taggings()

Remove (archive) one or more control tag access assignments from a user.

This method revokes a user’s access to the specified control tags. The calling user
must be a tenant administrator of the tenant the target user belongs to; otherwise, the
operation will fail with a permission denied error.

- **Parameters:**
  - **user_id** (_str_) – Unique identifier of the user whose control tag access will be removed.
  - **control_tag_ids** (_Iterable_ _[\*\*str_ _]_) – Identifiers of the control tags to revoke access from.
  - **reason** (_Optional_ _[\*\*str_ _]_) – Optional reason for removing the control tag access.

- **Return Type:** list[[UserControlTagging](models/access.md#usercontroltagging)]

### get_user_control_tags()

Retrieve the list of control tags a user has been assigned access to.

This method returns all active control tags associated with the specified user.

- **Parameters:**
  **user_id** (_str_) – Unique identifier of the user to retrieve control tags for.

- **Return Type:** list[[ControlTag](models/access.md#controltag)]

### get_user_control_tagging_history()

Gets the full history of control taggings added to and removed from a user.

- **Parameters:**
  - **user_id** (_str_) – The ID of the user to get.. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[UserControlTagging](models/access.md#usercontroltagging)]

### get_user_control_taggings()

Gets a user’s active control taggings.

- **Parameters:**
  - **user_id** (_str_) – The ID of the user to get.. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[UserControlTagging](models/access.md#usercontroltagging)]

### add_model_control_taggings()

Assign one or more control tags to a model.

When a control tag is applied to a model, the tagging is also applied to each of its
child artifacts. As a result, the returned list of resource control taggings may include
more entries than the number of control tags assigned.

The caller must have owner or administrator access to the model in order to modify
control tag assignments.

- **Parameters:**
  - **model_id** (_str_) – Unique identifier of the model to which control tags will be assigned.
  - **control_tag_ids** (_Iterable_ _[\*\*str_ _]_) – Identifiers of the control tags to assign.
  - **reason** (_Optional_ _[\*\*str_ _]_) – Optional reason for assigning the control tags.

- **Return Type:** list[[ResourceControlTagging](models/access.md#resourcecontroltagging)]

### remove_model_control_taggings()

Remove (archive) one or more control tag assignments from a model.

This method revokes control tag access from the specified model. Owner or administrator
access to the model or its parent model is required to modify control tag assignments.

- **Parameters:**
  - **model_id** (_str_) – Unique identifier of the model from which control tags will be removed.
  - **control_tag_ids** (_Iterable_ _[\*\*str_ _]_) – Identifiers of the control tags to remove.
  - **reason** (_Optional_ _[\*\*str_ _]_) – Optional reason for removing the control tag assignments.

- **Return Type:** list[[ResourceControlTagging](models/access.md#resourcecontroltagging)]

### get_model_control_tags()

Retrieve the list of control tags currently assigned to a model.

This method returns all active control tags associated with the specified model.

- **Parameters:**
  **model_id** (_str_) – Unique identifier of the model to retrieve control tags for.

- **Return Type:** list[[ControlTag](models/access.md#controltag)]

### add_artifact_control_taggings()

Assign one or more control tags to an artifact.

This method applies control tags to the specified artifact. Owner or administrator
access to the artifact’s parent model is required to modify control tag assignments.

- **Parameters:**
  - **artifact_id** (_str_) – Unique identifier of the artifact to which control tags will be assigned.
  - **control_tag_ids** (_Iterable_ _[\*\*str_ _]_) – Identifiers of the control tags to assign.
  - **reason** (_Optional_ _[\*\*str_ _]_) – Optional reason for assigning the control tags.

- **Return Type:** list[[ResourceControlTagging](models/access.md#resourcecontroltagging)]

### remove_artifact_control_taggings()

Remove (archive) one or more control tag assignments from an artifact.

This method revokes control tag access from the specified artifact. Owner or administrator
access to the artifact’s parent model is required to modify control tag assignments.

- **Parameters:**
  - **artifact_id** (_str_) – Unique identifier of the artifact from which control tags will be removed.
  - **control_tag_ids** (_Iterable_ _[\*\*str_ _]_) – Identifiers of the control tags to remove.
  - **reason** (_Optional_ _[\*\*str_ _]_) – Optional reason for removing the control tag assignments.

- **Return Type:** list[[ResourceControlTagging](models/access.md#resourcecontroltagging)]

### get_artifact_control_tags()

Retrieve the list of control tags currently assigned to an artifact.

This method returns all active control tags associated with the specified artifact.

- **Parameters:**
  **artifact_id** (_str_) – Unique identifier of the artifact to retrieve control tags for.

- **Return Type:** list[[ControlTag](models/access.md#controltag)]

### patch_artifact_control_taggings()

Adds or removes control tags on a artifact.

- **Parameters:**
  - **artifact_id** (_str_) – The ID of the artifact to get.. (required)
  - **request_body** (_List_ _[\*\*str_ _]_) – (required)
  - **patch_op** ([_PatchOp_](08-enums.md#patchop)) – The operation to perform. One of: `set`, `delete`. (required)
  - **reason** (_str_) – The reason for the change. This is an optional field.
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[ResourceControlTagging](models/access.md#resourcecontroltagging)]

### patch_file_control_taggings()

Adds or removes control tags on a file.

- **Parameters:**
  - **file_id** (_str_) – The ID of the file to get.. (required)
  - **request_body** (_List_ _[\*\*Optional_ _[\*\*str_ _]_ _]_) – (required)
  - **patch_op** ([_PatchOp_](08-enums.md#patchop)) – The operation to perform. One of: `set`, `delete`. (required)
  - **reason** (_str_) – The reason for the change. This is an optional field.
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[FileControlTagging](models/files.md#filecontroltagging)]

### patch_model_control_taggings()

Adds or removes control tags on a model.

- **Parameters:**
  - **model_id** (_str_) – The ID of the model to add or remove taggings.. (required)
  - **request_body** (_List_ _[\*\*str_ _]_) – (required)
  - **patch_op** ([_PatchOp_](08-enums.md#patchop)) – The operation to perform. One of: `set`, `delete`. (required)
  - **reason** (_str_) – The reason for the change. This is an optional field.
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[ResourceControlTagging](models/access.md#resourcecontroltagging)]

### patch_user_control_taggings()

Adds or removes control tags on a user.

- **Parameters:**
  - **user_id** (_str_) – The ID of the user to get.. (required)
  - **request_body** (_List_ _[\*\*str_ _]_) – (required)
  - **patch_op** ([_PatchOp_](08-enums.md#patchop)) – The operation to perform. One of: `set`, `delete`. (required)
  - **reason** (_str_) – The reason for the change. This is an optional field.
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[UserControlTagging](models/access.md#usercontroltagging)]

## Deprecated

### list_artifact_access()

**Deprecated.** Use [list_access](#list_access) instead.

- **Parameters:**
  - **artifact_id** (_str_) – The id of the artifact to get access for.. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[AccessRelationship](models/access.md#accessrelationship)]

### list_model_access()

**Deprecated.** Use [list_access](#list_access) instead.

- **Parameters:**
  - **model_id** (_str_) – The id of the model to list access permissions for. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[AccessRelationship](models/access.md#accessrelationship)]

### list_job_access()

**Deprecated.** Use [list_access](#list_access) instead.

- **Parameters:**
  - **job_id** (_str_) – The id of the job to list access permissions for. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[AccessRelationship](models/access.md#accessrelationship)]

### patch_artifact_access()

**Deprecated.** Use [update_access](#update_access) instead.

- **Parameters:**
  - **artifact_id** (_str_) – The id of the artifact to update access for.. (required)
  - **access_relationship** ([_AccessRelationship_](models/access.md#accessrelationship)) – (required)
  - **patch_op** ([_PatchOp_](08-enums.md#patchop)) – The operation to perform. One of: `set`, `delete`. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[AccessRelationship](models/access.md#accessrelationship)]

### patch_model_access()

**Deprecated.** Use [update_access](#update_access) instead.

- **Parameters:**
  - **model_id** (_str_) – The id of the model to update access for. (required)
  - **access_relationship** ([_AccessRelationship_](models/access.md#accessrelationship)) – (required)
  - **patch_op** ([_PatchOp_](08-enums.md#patchop)) – The operation to perform. One of: `set`, `delete`.
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[AccessRelationship](models/access.md#accessrelationship)]

### patch_job_access()

**Deprecated.** Use [update_access](#update_access) instead.

- **Parameters:**
  - **job_id** (_str_) – The id of the job to modify access permissions on (required)
  - **access_relationship** ([_AccessRelationship_](models/access.md#accessrelationship)) – (required)
  - **patch_op** ([_PatchOp_](08-enums.md#patchop)) – The operation to perform. One of: `set`, `delete`.
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[AccessRelationship](models/access.md#accessrelationship)]


---

<!-- Source: api_reference/06-agents.md -->

---
slug: /build/python/api_reference/agents
sidebar_label: "Agents, modules & tools"
---

# Agents, modules & tools

Methods for registering and managing agents, agent pools, modules, functions, and tools on the Istari Digital Platform.

All methods are available on the [`Client`](01-client.md) instance. Parameters marked **(required)** must be provided. See [Enums](08-enums.md) for valid enum values and [Pagination](01-client.md#pagination) for `page`/`size` defaults.

## Agents

### register_agent()

Registers a new agent.

- **Parameters:**
  - **new_agent** ([_NewAgent_](models/agents.md#newagent)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Agent](models/agents.md#agent)

### get_agent()

Gets an agent by id.

- **Parameters:**
  - **agent_id** (_str_) – The ID of the agent to get. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Agent](models/agents.md#agent)

### list_agents()

Lists all agents a user has access to.

- **Parameters:**
  - **agent_version** (_str_) – Filter by the agent version
  - **host_os** (_str_) – Filter by the host OS
  - **updated_since** (_datetime_) – Filter by last update time of agent
  - **module_name** (_str_) – Filter by name of module loaded on the agent
  - **module_version** (_str_) – Filter by version of module loaded on the agent
  - **status_name** ([_AgentStatusName_](08-enums.md#agentstatusname)) – Filter by the agent status name. See [AgentStatusName](08-enums.md#agentstatusname) for valid values.
  - **tenant_id** (_str_) – Filter by tenant ID. Any tenant ID, your own included, needs an administrator role:
    - On installations with [tenant management](16-identity.md#tenant-management): `tenant_admin` or the platform `admin` role for your own tenant, and the platform `admin` role for any other tenant.
    - On other installations: `customer_admin`.
  - **all_tenants** (_bool_) – Show agents across all tenants. Needs an administrator role:
    - On installations with [tenant management](16-identity.md#tenant-management): the platform `admin` role.
    - On other installations: `customer_admin`.
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageAgent](models/agents.md#pageagent)

### get_agent_display_name()

Gets an agent’s display name.

- **Parameters:**
  - **agent_id** (_str_) – The ID of the agent to get. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [AgentDisplayName](models/agents.md#agentdisplayname)

### update_agent_display_name()

Updates an agent’s display name.

- **Parameters:**
  - **agent_id** (_str_) – The ID of the agent to update. (required)
  - **new_agent_display_name** ([_NewAgentDisplayName_](models/agents.md#newagentdisplayname)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Agent](models/agents.md#agent)

### get_agent_status()

Gets an agent’s status.

- **Parameters:**
  - **agent_id** (_str_) – The ID of the agent to get. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [AgentStatus](models/agents.md#agentstatus)

### update_agent_status()

Updates an agent’s status.

- **Parameters:**
  - **agent_id** (_str_) – The ID of the agent to update. (required)
  - **new_agent_status** ([_NewAgentStatus_](models/agents.md#newagentstatus)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Agent](models/agents.md#agent)

### get_agent_available_jobs()

Gets the list of available jobs for an agent.

- **Parameters:**
  - **agent_id** (_str_) – The identifier for the agent (required)
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageJob](models/jobs.md#pagejob)

### get_agent_modules()

Gets an agent’s loaded modules.

- **Parameters:**
  - **agent_id** (_str_) – The ID of the agent to get. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [AgentModules](models/agents.md#agentmodules)

### update_agent_modules()

Updates an agent’s loaded modules.

- **Parameters:**
  - **agent_id** (_str_) – The ID of the agent to update. (required)
  - **new_agent_module_version** (_List_ _[\*\*[NewAgentModuleVersion](models/agents.md#newagentmoduleversion)_ _]_) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Agent](models/agents.md#agent)

### update_agent_information()

Updates an agent’s information.

- **Parameters:**
  - **agent_id** (_str_) – The ID of the agent to update. (required)
  - **new_agent_information** ([_NewAgentInformation_](models/agents.md#newagentinformation)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Agent](models/agents.md#agent)

### get_agent_status_retention_policy()

Gets status retention policy duration in the registry for all agents

- **Parameters:**
  **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [AgentStatusRetentionDuration](models/agents.md#agentstatusretentionduration)

### set_agent_status_retention_policy()

Sets status retention policy duration in the registry for all agents

- **Parameters:**
  - **new_agent_status_retention_duration** ([_NewAgentStatusRetentionDuration_](models/agents.md#newagentstatusretentionduration)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [AgentStatusRetentionDuration](models/agents.md#agentstatusretentionduration)

### list_agent_status_history()

Lists an agent’s status history.

- **Parameters:**
  - **agent_id** (_str_) – The ID of the agent to get. (required)
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageAgentStatus](models/agents.md#pageagentstatus)

### archive_agent()

Archives an agent by updating its archive status to Archived. Archived agents stop receiving job assignments.

- **Parameters:**
  - **agent_id** (_str_) – The ID of the agent to archive. (required)
  - **archive** ([_Archive_](models/common.md#archive)) – Optional reason payload recorded on the archive event.
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Agent](models/agents.md#agent)

### restore_agent()

Restores an archived agent by updating its archive status to Active.

- **Parameters:**
  - **agent_id** (_str_) – The ID of the agent to restore. (required)
  - **restore** ([_Restore_](models/common.md#restore)) – Optional reason payload recorded on the restore event.
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Agent](models/agents.md#agent)

### create_agent_with_key()

Provisions an agent in Identity Service mode from an ES384 public key. The agent keeps the matching private key. The caller receives `client_id`, `user_uuid`, `tenant_id`, `key_id`, and `key_name` on `AgentCredential`.

This is separate from [`client.keys`](14-keys.md), which manages the key the Python process itself uses, and from [`register_agent_public_key()`](#register_agent_public_key), which registers the RSA key used to encrypt job-scoped secrets.

See [Creating a new agent with a key](../../icbs-install/05-CLI/05-creating-a-new-agent-with-a-key.md).

- **Parameters:**
  - **new_agent_key** (`NewAgentKey`) – (required). `public_key_pem` (PEM-encoded ES384 public key) and `key_id` are required. Optional: `display_name`, `key_name`, `expires_at`.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `AgentCredential`

### register_agent_public_key()

Registers or rotates the RSA public key used to encrypt job-scoped secrets for one agent. `public_key` is a PKCS#1 PEM public key.

- **Parameters:**
  - **agent_id** (_str_) – The agent registering its key. (required)
  - **new_agent_public_key** (`NewAgentPublicKey`) – (required). `public_key`.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `AgentPublicKey`

## Agent pools

### create_agent_pool()

Creates a new agent pool.

- **Parameters:**
  - **new_agent_pool** ([_NewAgentPool_](models/agents.md#newagentpool)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [AgentPool](models/agents.md#agentpool)

### get_agent_pool()

Gets an agent pool by id.

- **Parameters:**
  - **agent_pool_id** (_str_) – The ID of the agent pool to get. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [AgentPool](models/agents.md#agentpool)

### list_agent_pools()

Lists all agent pools a user has access to.

- **Parameters:**
  - **all_users** (_bool_) – Show agent pools owned by all users (requires admin privileges)
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageAgentPool](models/agents.md#pageagentpool)

### update_agent_pool()

Updates an agent pool’s information.

- **Parameters:**
  - **agent_pool_id** (_str_) – The id of the agent pool to update (required)
  - **new_agent_pool** ([_NewAgentPool_](models/agents.md#newagentpool)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [AgentPool](models/agents.md#agentpool)

### archive_agent_pool()

Archives an agent pool. Jobs assigned to the pool are no longer dispatched until it is restored.

- **Parameters:**
  - **agent_pool_id** (_str_) – The ID of the agent pool to archive. (required)
  - **archive** ([_Archive_](models/common.md#archive)) – Optional reason payload recorded on the archive event.
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [AgentPool](models/agents.md#agentpool)

### restore_agent_pool()

Restores an archived agent pool, making it available for job dispatch again.

- **Parameters:**
  - **agent_pool_id** (_str_) – The ID of the agent pool to restore. (required)
  - **restore** ([_Restore_](models/common.md#restore)) – Optional reason payload recorded on the restore event.
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [AgentPool](models/agents.md#agentpool)

### update_agent_pool_agent()

Adds or updates an agent’s membership in an agent pool.

- **Parameters:**
  - **agent_pool_id** (_str_) – The id of the agent pool to update (required)
  - **new_agent_pool_agent_membership** ([_NewAgentPoolAgentMembership_](models/agents.md#newagentpoolagentmembership)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [AgentPool](models/agents.md#agentpool)

### update_agent_pool_user()

Adds or updates a user’s membership in an agent pool.

- **Parameters:**
  - **agent_pool_id** (_str_) – The id of the agent pool to update (required)
  - **new_agent_pool_user_membership** ([_NewAgentPoolUserMembership_](models/agents.md#newagentpoolusermembership)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [AgentPool](models/agents.md#agentpool)

### list_agent_pool_agents()

Lists agent memberships in detail for an agent pool.

- **Parameters:**
  - **agent_pool_id** (_str_) – The id of the agent pool to list agents for (required)
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageAgentPoolAgentMembershipWithAgent](models/agents.md#pageagentpoolagentmembershipwithagent)

### list_agent_pool_users()

Lists user memberships in detail for an agent pool.

- **Parameters:**
  - **agent_pool_id** (_str_) – The id of the agent pool to list users for (required)
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageAgentPoolUserMembershipWithUser](models/agents.md#pageagentpoolusermembershipwithuser)

### remove_agent_pool_agent()

Deletes an agent’s membership in an agent pool.

- **Parameters:**
  - **agent_pool_id** (_str_) – The ID of the agent pool to remove the agent from. (required)
  - **agent_id** (_str_) – The ID of the agent to delete. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [AgentPool](models/agents.md#agentpool)

### remove_agent_pool_user()

Deletes a user’s membership in an agent pool.

- **Parameters:**
  - **agent_pool_id** (_str_) – The ID of the agent pool to remove the user from. (required)
  - **user_id** (_str_) – The ID of the user to delete. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [AgentPool](models/agents.md#agentpool)

## Modules

### create_module()

Creates a new module.

- **Parameters:**
  - **new_module_manifest** ([_NewModuleManifest_](models/agents.md#newmodulemanifest)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Module](models/agents.md#module)

### get_module()

Gets a module by id

- **Parameters:**
  - **module_id** (_str_) – The id of the module to get (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Module](models/agents.md#module)

### list_modules()

Lists all modules a user has access to.

- **Parameters:**
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageModule](models/agents.md#pagemodule)

### deprecate_module()

Deprecates all versions of a module.

- **Parameters:**
  - **module_id** (_str_) – The id of the module to deprecate (required)
  - **deprecation_reason** ([_DeprecationReason_](models/agents.md#deprecationreason)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Module](models/agents.md#module)

### get_module_version()

Gets a module version by id.

- **Parameters:**
  - **module_version_id** (_str_) – The id of the module version to get (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [ModuleVersion](models/agents.md#moduleversion)

### list_module_versions()

List all module versions a user has access to.

- **Parameters:**
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageModuleVersion](models/agents.md#pagemoduleversion)

### deprecate_module_version()

Deprecates a module version.

- **Parameters:**
  - **module_version_id** (_str_) – The id of the module version to deprecate (required)
  - **deprecation_reason** ([_DeprecationReason_](models/agents.md#deprecationreason)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [ModuleVersion](models/agents.md#moduleversion)

## Functions

### get_function()

Gets a function by id.

- **Parameters:**
  - **function_id** (_str_) – ID of the function to get (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [FunctionVersion](models/agents.md#functionversion)

### get_function_schema()

Gets a function schema by id.

- **Parameters:**
  - **function_schema_id** (_str_) – ID of the function schema to get (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [FunctionSchema](models/agents.md#functionschema)

### list_functions()

Lists all functions a user has access to.

- **Parameters:**
  - **name** (_str_) – Filter functions by name
  - **module_version** (_str_) – Filter functions by module version
  - **tool** (_str_) – Filter functions by tool name
  - **tool_version** (_str_) – Filter functions by tool version
  - **operating_system** (_str_) – Filter functions by operating system
  - **input_extension** (_str_) – Filter functions by input file extension
  - **input_user_models** ([_UserModelInputs_](08-enums.md#usermodelinputs)) – Filter functions by input user models. One of: `single`, `multiple`.
  - **status** ([_UsabilityStatusParams_](08-enums.md#usabilitystatusparams)) – Filter functions by usability status. One of: `supported`, `deprecated`, `all`. Default: `supported`.
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageFunctionVersion](models/agents.md#pagefunctionversion)

## Tools and operating systems

### create_tool()

Creates a new tool.

- **Parameters:**
  - **new_tool** ([_NewTool_](models/agents.md#newtool)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Tool](models/agents.md#tool)

### get_tool()

Gets a tool by id

- **Parameters:**
  - **tool_id** (_str_) – The ID of the tool to get. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Tool](models/agents.md#tool)

### list_tools()

List all tools a user has access to

- **Parameters:**
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **include** (_List_ _[\*\*[ToolInclude](08-enums.md#toolinclude)_ _]_) – Whether to include functions in response. Values: `functions`, `function_versions`.
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageTool](models/agents.md#pagetool)

### update_tool()

Updates a tool.

- **Parameters:**
  - **tool_id** (_str_) – The ID of the tool to update. (required)
  - **update_tool** ([_UpdateTool_](models/agents.md#updatetool)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [Tool](models/agents.md#tool)

### create_tool_versions()

Creates a new tool version.

- **Parameters:**
  - **tool_id** (_str_) – The ID of the tool to add a version to. (required)
  - **new_tool_version** ([_NewToolVersion_](models/agents.md#newtoolversion)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [ToolVersion](models/agents.md#toolversion)

### get_tool_version()

Gets a tool version by id.

- **Parameters:**
  - **tool_version_id** (_str_) – The tool version ID to get (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [ToolVersion](models/agents.md#toolversion)

### list_tool_versions()

Lists all tool versions a user has access to.

- **Parameters:**
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageToolVersion](models/agents.md#pagetoolversion)

### create_author()

Creates a new author.

- **Parameters:**
  - **new_module_author** ([_NewModuleAuthor_](models/agents.md#newmoduleauthor)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [ModuleAuthor](models/agents.md#moduleauthor)

### get_author()

Gets an author by id.

- **Parameters:**
  - **author_id** (_str_) – The author ID to get. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [ModuleAuthor](models/agents.md#moduleauthor)

### list_authors()

Lists all authors a user has access to.

- **Parameters:**
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageModuleAuthor](models/agents.md#pagemoduleauthor)

### update_author()

Updates an author.

- **Parameters:**
  - **author_id** (_str_) – The author ID to update. (required)
  - **new_module_author** ([_NewModuleAuthor_](models/agents.md#newmoduleauthor)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [ModuleAuthor](models/agents.md#moduleauthor)

### create_operating_system()

Creates a new operating system.

- **Parameters:**
  - **new_operating_system** ([_NewOperatingSystem_](models/agents.md#newoperatingsystem)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [OperatingSystem](models/agents.md#operatingsystem)

### get_operating_system()

Gets an operating system by id.

- **Parameters:**
  - **operating_system_id** (_str_) – The operating system ID to get. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [OperatingSystem](models/agents.md#operatingsystem)

### list_operating_systems()

Lists all operating systems a user has access to.

- **Parameters:**
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageOperatingSystem](models/agents.md#pageoperatingsystem)

### update_operating_system()

Updates an existing operating system.

- **Parameters:**
  - **operating_system_id** (_str_) – The id of the operating system to update. (required)
  - **new_operating_system** ([_NewOperatingSystem_](models/agents.md#newoperatingsystem)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [OperatingSystem](models/agents.md#operatingsystem)


---

<!-- Source: api_reference/07-admin.md -->

---
slug: /build/python/api_reference/admin
sidebar_label: "Users, tokens & admin"
---

# Users, tokens & admin

Methods for managing users, personal access tokens, integrations, uploads, tenants, and health checks on the Istari Digital Platform.

Methods below are on the [`Client`](01-client.md) instance. `batch_resolve_users()` is the exception: it is on `V3Client`. Parameters marked **(required)** must be provided. See [Enums](08-enums.md) for valid enum values and [Pagination](01-client.md#pagination) for `page`/`size` defaults.

To manage the identity service's tenants, memberships, role grants and principal keys, use `IstariAdmin.identity`. [Identity administration](16-identity.md) documents it, and lists the deprecated v1 key methods with their replacements.

## Users

### get_user()

Retrieve a user from the registry.

This is a convenience wrapper around get*user_by_id, provided for naming consistency
with other get*\* methods (e.g., get_model, get_artifact, etc.).

- **Parameters:**
  **user_id** (_str_) – Unique identifier of the user to retrieve.

- **Return Type:** [User](models/admin.md#user)

### get_user_by_id()

Gets a user by id.

- **Parameters:**
  - **user_id** (_str_) – The id of the user. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [User](models/admin.md#user)

### get_current_user()

Gets the current user.

- **Parameters:**
  **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [User](models/admin.md#user)

### list_users()

Lists all users a user has access to.

- **Parameters:**
  - **user_state** ([_UserStateOption_](08-enums.md#userstateoption)) – Filter users by state. One of: `active`, `all`. Default: `active`.
  - **user_type** ([_UserType_](08-enums.md#usertype)) – Filter users by type. One of: `human`, `agent`, `all`. Default: `all`.
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[User](models/admin.md#user)]

### batch_resolve_users()

Resolves registry users from identity-service principal ids. Call it on `V3Client`.

- **Parameters:**
  - **batch_resolve_users_request** (`BatchResolveUsersRequest`) – (required). `principal_ids` is 1 to 100 ids. Duplicates are ignored.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `BatchResolveUsersResponse`. `users` are the registry users that resolved. `unresolved` lists requested ids the caller cannot see.

## Personal access tokens

### create_personal_access_token()

Creates a personal access token.

- **Parameters:**
  - **name** (_str_) – The name of the personal access token. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PersonalAccessToken](models/admin.md#personalaccesstoken)

### create_agent_personal_access_token()

Creates an agent personal access token.

- **Parameters:**
  - **name** (_str_) – The name of the personal access token. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PersonalAccessToken](models/admin.md#personalaccesstoken)

### list_personal_access_tokens()

Lists all personal access tokens a user has access to.

- **Parameters:**
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **sort** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PagePersonalAccessToken](models/admin.md#pagepersonalaccesstoken)

### delete_personal_access_token()

Deletes a personal access token.

- **Parameters:**
  - **pat_id** (_str_) – The personal access token id. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** object

### revoke_all_personal_access_tokens()

Revokes all personal access tokens.

- **Parameters:**
  **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** object

## Auth integrations

### create_auth_integration()

Create a new authentication integration.

This method registers an authentication integration by uploading a registration file.
The registration file typically contains OAuth credentials or other provider-specific configuration.

- **Parameters:**
  - **auth_integration_type** ([_AuthIntegrationType_](08-enums.md#authintegrationtype)) – The type of authentication provider. One of: `google_accounts`, `windchill`, `teamwork_cloud`, `dassault_3d_passport`, `ping_id`, `microsoft_entra`. (required)
  - **auth_type** ([_FunctionAuthType_](08-enums.md#functionauthtype)) – The authentication mechanism. One of: `jwt`, `token`, `basic`, `oauth1`, `oauth2`, `cas_delegated_3dx`. (required)
  - **auth_registration_path** (_PathLike_) – Filesystem path to the registration configuration file. (required)

- **Return Type:** [AuthIntegration](models/admin.md#authintegration)

### update_auth_integration()

Update an existing authentication integration.

This method updates an authentication integration's type, auth mechanism, and/or
registration file. If a new registration file is provided, its contents replace
the existing registration revision.

- **Parameters:**
  - **auth_integration_id** (_UUID_) – Identifier of the authentication integration to update. (required)
  - **auth_integration_type** ([_AuthIntegrationType_](08-enums.md#authintegrationtype) _|_ _None_) – Optional updated provider type. One of: `google_accounts`, `windchill`, `teamwork_cloud`, `dassault_3d_passport`, `ping_id`, `microsoft_entra`.
  - **function_auth_type** ([_FunctionAuthType_](08-enums.md#functionauthtype) _|_ _None_) – Optional updated authentication mechanism. One of: `jwt`, `token`, `basic`, `oauth1`, `oauth2`, `cas_delegated_3dx`.
  - **auth_registration_path** (_PathLike_ _|_ _None_) – Optional filesystem path to a new registration configuration file.

- **Return Type:** [AuthIntegration](models/admin.md#authintegration)

### get_auth_integration()

Retrieves an AuthIntegration.

- **Parameters:**
  - **auth_integration_id** (_str_) – The unique name of the AuthIntegration to update (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [AuthIntegration](models/admin.md#authintegration)

### list_auth_integrations()

Lists all AuthIntegrations a user has access to.

- **Parameters:**
  - **auth_integration_type** ([_AuthIntegrationType_](08-enums.md#authintegrationtype)) – Filter by provider type. One of: `google_accounts`, `windchill`, `teamwork_cloud`, `dassault_3d_passport`, `ping_id`, `microsoft_entra`.
  - **auth_type** ([_FunctionAuthType_](08-enums.md#functionauthtype)) – Filter by auth mechanism. One of: `jwt`, `token`, `basic`, `oauth1`, `oauth2`, `cas_delegated_3dx`.
  - **archive_status** ([_ArchiveStatus_](08-enums.md#archivestatus)) – Filter results by archive status. One of: `active`, `archived`, `all`. Default: `active`.
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageAuthIntegration](models/admin.md#pageauthintegration)

### add_function_auth_secret()

Create a new function authentication secret from a file.

This method uploads a secret from a file and registers it as a function auth secret
of the specified type. You may optionally associate it with an authentication
integration and set an expiration date.

- **Parameters:**
  - **function_auth_type** ([_FunctionAuthType_](08-enums.md#functionauthtype)) – The type of function authentication. One of: `jwt`, `token`, `basic`, `oauth1`, `oauth2`, `cas_delegated_3dx`. (required)
  - **path** (_PathLike_) – Filesystem path to the file containing the secret.
  - **auth_integration_id** (_Optional_ _[\*\*str_ _]_) – Optional identifier of the associated authentication integration.
  - **expiration** (_Optional_ _[\*\*datetime_ _]_) – Optional expiration date/time of the secret.

- **Return Type:** [FunctionAuthSecret](models/agents.md#functionauthsecret)

### fetch_function_auth_secret()

Gets a function auth secret by id.

- **Parameters:**
  - **auth_secret_id** (_str_) – The function auth secret ID to get. (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [FunctionAuthSecret](models/agents.md#functionauthsecret)

### find_function_auth_secret()

Lists all function auth secrets that a user has access to.

- **Parameters:**
  - **auth_integration_type** ([_AuthIntegrationType_](08-enums.md#authintegrationtype)) – Filter by authentication provider type. One of: `google_accounts`, `windchill`, `teamwork_cloud`, `dassault_3d_passport`, `ping_id`, `microsoft_entra`.
  - **function_auth_type** ([_FunctionAuthType_](08-enums.md#functionauthtype)) – Filter by authentication mechanism. One of: `jwt`, `token`, `basic`, `oauth1`, `oauth2`, `cas_delegated_3dx`.
  - **expiration** (_datetime_)
  - **latest** (_bool_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** List[[FunctionAuthSecret](models/agents.md#functionauthsecret)]

### get_integration_catalog()

Lists the integrations an administrator can configure.

- **Parameters:**
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** list of `IntegrationCatalogEntry`

### check_auth_integration_health()

Health-checks a stored auth integration.

- **Parameters:**
  - **auth_integration_id** (_str_) – Auth integration to check. (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `IntegrationHealthReport`

### check_auth_integration_config_health()

Health-checks a candidate configuration before it is saved. Exactly one of `oidc_provider_data` or `oauth1_provider_data` selects the standard. For OAuth 1.0a the secret is the consumer secret. When `client_secret` is omitted and `auth_integration_id` names an existing integration, the stored secret is used.

- **Parameters:**
  - **oidc_config_health_check_request** (`OidcConfigHealthCheckRequest`) – (required). Fields: `oidc_provider_data`, `oauth1_provider_data`, `client_secret`, `auth_integration_id`.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `IntegrationHealthReport`

### archive_auth_integration()

Removes an auth integration. The request is an HTTP DELETE. There is no restore method.

- **Parameters:**
  - **auth_integration_id** (_str_) – Auth integration to remove. (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** [AuthIntegration](models/admin.md#authintegration)

### get_auth_integration_control_taggings()

Returns the control tags currently on an auth integration.

- **Parameters:**
  - **auth_integration_id** (_str_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** list of `AuthIntegrationControlTagging`

### get_auth_integration_control_tagging_history()

Returns the control-tag history for an auth integration.

- **Parameters:**
  - **auth_integration_id** (_str_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** list of `AuthIntegrationControlTagging`

### patch_auth_integration_control_taggings()

Adds or removes control tags on an auth integration.

- **Parameters:**
  - **auth_integration_id** (_str_) – (required)
  - **request_body** (_list_ of _str_) – Control tag ids. (required)
  - **patch_op** ([_PatchOp_](08-enums.md#patchop)) – `set` or `delete`.
  - **reason** (_str_, _optional_)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** list of `AuthIntegrationControlTagging`

## Storage and uploads

Uploading a Resource from a filesystem path is [`add_model()`](02-files.md#add_model) on `Client`, or [`create_resource()`](../v3/v3-client.mdx#create_resource) on `V3Client`. The calls in this section are the presigned URL, multipart, and tenant-key operations on `Client`.

### generate_upload_url()

Returns a temporary upload url for token with sha

- **Parameters:**
  - **sha** (_str_) – (required)
  - **model_id** (_str_)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [TemporaryURL](models/common.md#temporaryurl)

### generate_download_url()

Returns a temporary download url for tokenized resource with SHA value

- **Parameters:**
  - **sha** (_str_) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [TemporaryURL](models/common.md#temporaryurl)

### create_multipart_upload()

Returns the metadata needed to perform a multipart upload for a given token with the SHA

- **Parameters:**
  - **create_multipart_upload_request** ([_CreateMultipartUploadRequest_](models/admin.md#createmultipartuploadrequest)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [CreateMultipartUploadResponse](models/admin.md#createmultipartuploadresponse)

### finalize_multipart_upload()

Finalize a multipart upload for a given token with the SHA

- **Parameters:**
  - **finalize_multipart_upload_request** ([_FinalizeMultipartUploadRequest_](models/admin.md#finalizemultipartuploadrequest)) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** object

### create_tenant_public_key()

Creates a tenant public key.

- **Parameters:**
  - **public_key_file** (_bytearray_) – (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [TenantPublicKey](models/admin.md#tenantpublickey)

### get_tenant_public_key()

Gets a tenant public key.

- **Parameters:**
  **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [TenantPublicKey](models/admin.md#tenantpublickey)

### list_tenants()

Lists tenants in the registry. Which tenants the caller gets depends on their role:

- On installations with [tenant management](16-identity.md#tenant-management): a Platform Administrator (role `admin`) gets every tenant, and a Tenant Administrator (role `tenant_admin`) gets only their own.
- On other installations: the caller must hold the `customer_admin` role, and gets every tenant.

The registry builds this list from your sign-in provider's organizations. On an installation with tenant management, a tenant created with [`admin.identity.tenants.create()`](16-identity.md#tenantscreate) has no organization, so it does not appear here. To list the identity service's tenants, use [`admin.identity.tenants.list()`](16-identity.md#tenantslist).

- **Parameters:**
  - **page** (_int_) – Page number
  - **size** (_int_) – Page size
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [PageTenant](models/admin.md#pagetenant)

### generate_upload_urls_bulk()

Returns a temporary upload URL for each SHA.

- **Parameters:**
  - **request_body** (_list_ of _str_) – SHA values. (required)
  - **model_id** (_str_, _optional_)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** list of [TemporaryURL](models/common.md#temporaryurl)

### update_tenant_public_key()

Replaces the tenant public key.

- **Parameters:**
  - **public_key_file** (_bytes_ or _str_ or a _(filename, bytes)_ tuple) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** [TenantPublicKey](models/admin.md#tenantpublickey)

### delete_tenant_public_key()

Deletes the tenant public key.

- **Parameters:**
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `None`

## Health and metrics

### customer_usage_metrics()

Is for customers to query their data for usage metrics.

- **Parameters:**
  - **start** (_date_) – YYYY-MM-DD (required)
  - **end** (_date_) – YYYY-MM-DD (required)
  - **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** str

### liveness_check()

Liveness probe

- **Parameters:**
  **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [HealthcheckReport](models/admin.md#healthcheckreport)

### readiness_check()

Readiness probe

- **Parameters:**
  **http_request_timeout_secs** (_int_ _,_ _optional_) – timeout setting for this request

- **Return Type:** [HealthcheckReport](models/admin.md#healthcheckreport)


---

<!-- Source: api_reference/08-enums.md -->

---
slug: /build/python/api_reference/enums
sidebar_label: "Enums"
---

# Enum reference

Many parameters accept enum values rather than arbitrary strings. The tables below list every valid value. Pass the enum member from the SDK (e.g. `JobStatusName.COMPLETED`) or the equivalent string when calling the REST API.

### AccessRelation

| Value                     | Description                                  |
| ------------------------- | -------------------------------------------- |
| `viewer`                  | Read-only access                             |
| `editor`                  | Read-write access                            |
| `owner`                   | Full ownership including sharing             |
| `administrator`           | Administrative privileges                    |
| `executor`                | Permission to execute jobs                   |
| `upstreamremoteowner`     | Owner of an upstream remote                  |
| `upstreamremoteeditowner` | Owner of an upstream remote with edit rights |

### AccessResourceType

| Value                                                                                                                                                                                                                                                        |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `model` &#124; `artifact` &#124; `resource` &#124; `job` &#124; `file` &#124; `filerevision` &#124; `tool` &#124; `function` &#124; `functionversion` &#124; `tenant` &#124; `system` &#124; `functionauthsecret` &#124; `authintegration` &#124; `document` |

### AccessSubjectType

| Value  |
| ------ |
| `user` |

### AgentStatusName

| Value                    | Description                    |
| ------------------------ | ------------------------------ |
| `Idle`                   | Agent is idle and available    |
| `ClaimingJob`            | Agent is claiming a job        |
| `ValidatingJob`          | Agent is validating a job      |
| `ExecutingJob`           | Agent is executing a job       |
| `UploadingJob`           | Agent is uploading job results |
| `ExecutionFailed`        | Job execution failed           |
| `ExecutionSuccess`       | Job execution succeeded        |
| `UpdatingAgent`          | Agent is being updated         |
| `SuccessfulAgentUpdate`  | Agent update succeeded         |
| `FailedAgentUpdate`      | Agent update failed            |
| `UpdatingModule`         | Module is being updated        |
| `SuccessfulModuleUpdate` | Module update succeeded        |
| `FailedModuleUpdate`     | Module update failed           |
| `Paused`                 | Agent is paused                |
| `Unknown`                | Status is unknown              |

### ArchiveStatus

Used for filtering list endpoints.

| Value      | Description                      |
| ---------- | -------------------------------- |
| `active`   | Only active (non-archived) items |
| `archived` | Only archived items              |
| `all`      | Both active and archived items   |

### ArchiveStatusName

| Value                      |
| -------------------------- |
| `Archived` &#124; `Active` |

### AuthIntegrationType

| Value                  | Description              |
| ---------------------- | ------------------------ |
| `google_accounts`      | Google Accounts          |
| `windchill`            | PTC Windchill            |
| `teamwork_cloud`       | Cameo/TWC Teamwork Cloud |
| `dassault_3d_passport` | Dassault 3DPassport      |
| `ping_id`              | Ping Identity            |
| `microsoft_entra`      | Microsoft Entra ID       |

### BulkSharingAccessRelation

| Value                    |
| ------------------------ |
| `viewer` &#124; `editor` |

### ControlTaggingObjectType

| Value                                                                                                    |
| -------------------------------------------------------------------------------------------------------- |
| `model` &#124; `artifact` &#124; `file` &#124; `user` &#124; `system` &#124; `resource` &#124; `unknown` |

### FilterBy

| Value            | Description                                                  |
| ---------------- | ------------------------------------------------------------ |
| `created_by_id`  | Resources created by the current user                        |
| `-created_by_id` | Resources shared with the current user (not created by them) |

### FunctionAuthType

| Value               | Description                |
| ------------------- | -------------------------- |
| `jwt`               | JSON Web Token             |
| `token`             | Static token               |
| `basic`             | HTTP Basic Auth            |
| `oauth1`            | OAuth 1.0                  |
| `oauth2`            | OAuth 2.0                  |
| `cas_delegated_3dx` | CAS-delegated 3DEXPERIENCE |

### InfosecLevelObjectType

Object types that can carry an infosec classification. Used by [`assign_infosec_level`](10-infosec.md#assign_infosec_level).

| Value               | Description          |
| ------------------- | -------------------- |
| `model`             | A model Resource     |
| `artifact`          | An artifact Resource |
| `system`            | A System             |
| `user`              | A user               |
| `connectedresource` | A connected resource |

### InfosecSchemaTypes

Packaged infosec schemas that the platform can activate.

| Value    | Description                                         |
| -------- | --------------------------------------------------- |
| `US_DOD` | United States Department of Defense classifications |
| `AUS`    | Australian Government classifications               |

### JobStatusName

| Value        | Description                            |
| ------------ | -------------------------------------- |
| `Created`    | Job has been created                   |
| `Pending`    | Job is queued and waiting for an agent |
| `Claimed`    | An agent has claimed the job           |
| `Validating` | Agent is validating the job inputs     |
| `Running`    | Job is executing                       |
| `Uploading`  | Agent is uploading results             |
| `Completed`  | Job finished successfully              |
| `Failed`     | Job execution failed                   |
| `Canceled`   | Job was canceled                       |
| `Unknown`    | Status is unknown                      |

### OS

Identifies the target operating system for job execution.

| Value                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Windows 11` &#124; `Windows 10` &#124; `Windows Server 2019` &#124; `Windows Server 2022` &#124; `Ubuntu 24.04` &#124; `Ubuntu 22.04` &#124; `Ubuntu 20.04` &#124; `RHEL 8` &#124; `RHEL 9` &#124; `RHEL 10` &#124; `macOS 14` &#124; `macOS 15` &#124; `macOS 26` |

### PatchOp

| Value    | Description    |
| -------- | -------------- |
| `set`    | Add or replace |
| `delete` | Remove         |

### Permission

| Value                                                                                                                                                                                                                                                                                                                                                                |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `member` &#124; `manage` &#124; `view` &#124; `edit` &#124; `execute` &#124; `archive` &#124; `tenant_access` &#124; `controltag_access` &#124; `controltag_manage` &#124; `infoseclevel_access` &#124; `infoseclevel_manage` &#124; `access_own_manage` &#124; `access_administrate_manage` &#124; `access_edit_manage` &#124; `access_view_manage` &#124; `access` |

### PermissionResourceType

| Value                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `model` &#124; `agent` &#124; `agentpool` &#124; `artifact` &#124; `file` &#124; `comment` &#124; `filerevision` &#124; `token` &#124; `job` &#124; `tool` &#124; `function` &#124; `functionversion` &#124; `system` &#124; `tenant` &#124; `controltag` &#124; `infoseclevel` &#124; `functionauthsecret` &#124; `upstreamremote` &#124; `authintegration` &#124; `document` &#124; `resource` &#124; `workflow_output` |

### PermissionSubjectType

| Value                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `user` &#124; `model` &#124; `agent` &#124; `agentpool` &#124; `artifact` &#124; `file` &#124; `comment` &#124; `filerevision` &#124; `token` &#124; `job` &#124; `tool` &#124; `function` &#124; `functionversion` &#124; `system` &#124; `tenant` &#124; `controltag` &#124; `infoseclevel` &#124; `functionauthsecret` &#124; `authintegration` &#124; `upstreamremote` &#124; `document` &#124; `resource` &#124; `workflow_output` |

### ResourceType

| Value                                                                                       |
| ------------------------------------------------------------------------------------------- |
| `model` &#124; `artifact` &#124; `comment` &#124; `job` &#124; `document` &#124; `resource` |

### ToolInclude

| Value               | Description                           |
| ------------------- | ------------------------------------- |
| `functions`         | Include functions in response         |
| `function_versions` | Include function versions in response |

### TrackedFileSpecifierType

| Value                    |
| ------------------------ |
| `Locked` &#124; `Latest` |

### UsabilityStatusParams

| Value                                        |
| -------------------------------------------- |
| `supported` &#124; `deprecated` &#124; `all` |

### UserModelInputs

| Value      | Description                           |
| ---------- | ------------------------------------- |
| `single`   | Function accepts a single user model  |
| `multiple` | Function accepts multiple user models |

### UserStateOption

| Value                 |
| --------------------- |
| `active` &#124; `all` |

### UserType

| Value                               |
| ----------------------------------- |
| `human` &#124; `agent` &#124; `all` |

### ChangeRequestStatus

| Value                                  |
| -------------------------------------- |
| `OPEN` &#124; `MERGED` &#124; `CLOSED` |

### ChangeRequestComponentType

| Value                                      |
| ------------------------------------------ |
| `RESOURCE` &#124; `SUBSYSTEM` &#124; `ALL` |

### ChangeRequestDiffType

| Value                                     |
| ----------------------------------------- |
| `ADDED` &#124; `REMOVED` &#124; `CHANGED` |

### ChangeRequestEventType

| Value                                                      |
| ---------------------------------------------------------- |
| `OPENED` &#124; `REOPENED` &#124; `MERGED` &#124; `CLOSED` |

### CredentialStatus

| Value                                      |
| ------------------------------------------ |
| `active` &#124; `revoked` &#124; `expired` |

### SystemWebhookEvent

| Value                                                           |
| --------------------------------------------------------------- |
| `system.snapshot.created` &#124; `system.change_request.opened` |

### WebhookTargetType

| Value                                                   |
| ------------------------------------------------------- |
| `http` &#124; `github_actions` &#124; `gitlab_pipeline` |

## V3 enums

`V3Client` filter and create calls use these values. Import them from `istari_digital_client.v3.models` when the method takes the enum class.

### ResourceTypeDto

Broad category of a Resource on `V3Client`.

| Value                 | Description                                                                 |
| --------------------- | --------------------------------------------------------------------------- |
| `model`               | A simulation or analysis model file.                                        |
| `artifact`            | A derived output produced by running a model.                               |
| `file`                | A generic file that is neither a model nor an artifact.                     |
| `connected_container` | A folder-like resource. Its revisions are manifests of what it held.        |
| `connected_resource`  | A resource whose content lives at a connected source and is observed there. |

Documents are a `Client` type ([Documents](11-documents.md)). `ResourceTypeDto` has no `document` value.


---

<!-- Source: api_reference/09-configuration.md -->

---
slug: /build/python/api_reference/configuration
---

# Configuration

The `Configuration` class holds the connection settings and runtime tuning passed to [`Client`](01-client.md) and `V3Client`: registry or gateway URL, identity service key, retries, cache, upload, logging, and proxy.

`Configuration()` reads the environment names below. Constructor arguments override them. One of `registry_url` or `digital_api_url` is required. When `s3_direct_upload_enabled` is true, `s3_bucket_name` is required.

See [Setup](../01-setup.md) for the key file and the three environment variables a script usually sets.

#### Attributes

| Name                             | Type                          | Description                                                                                                                                                                                                                                                        |
| -------------------------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `digital_api_url`                | `Optional[str]`               | Service-router gateway URL (`ISTARI_DIGITAL_API_URL`). When set, registry traffic goes to `<digital_api_url>/registry` and this wins over `registry_url`. The client reaches the identity service at `<digital_api_url>/identity`.                                 |
| `registry_url`                   | `Optional[str]`               | Direct registry URL (`ISTARI_REGISTRY_URL`). Used when `digital_api_url` is unset.                                                                                                                                                                                 |
| `registry_auth_token`            | `Optional[str]`               | Personal access token (`ISTARI_REGISTRY_AUTH_TOKEN`). Deprecated. See [Setup](../01-setup.md#personal-access-tokens).                                                                                                                                              |
| `identity_service_enabled`       | `Optional[bool]`              | Authenticate with an auto-refreshed JWT from the identity service instead of a personal access token (`ISTARI_DIGITAL_IDENTITY_SERVICE_ENABLED`). Default `None`, which lets the client choose; see [Key or personal access token](#key-or-personal-access-token). |
| `identity_service_secret_file`   | `Optional[str or Path]`       | Path to the JSON key file (`ISTARI_CLIENT_IDENTITY_SERVICE_SECRET_FILE`). Preferred when both the file and the inline secret are set.                                                                                                                              |
| `identity_service_secret`        | `Optional[str]`               | Inline key: base64 JSON `{clientId, keyId, key}` (`ISTARI_CLIENT_IDENTITY_SERVICE_SECRET`).                                                                                                                                                                        |
| `identity_url`                   | `Optional[str]`               | Direct identity service URL (`ISTARI_IDENTITY_URL`), used when `digital_api_url` is unset. With `digital_api_url` set, the client reaches the identity service through the gateway instead.                                                                        |
| `identity_api_version`           | `IdentityApiVersion` or `str` | Which identity service API the client uses (`ISTARI_IDENTITY_API_VERSION`): `"auto"` (the default), `"v1"` or `"v2"`. See [Identity API version](#identity-api-version).                                                                                           |
| `identity_service_required`      | `bool`                        | When `True`, the client must use the identity service; see [Key or personal access token](#key-or-personal-access-token). Default `False` (`ISTARI_DIGITAL_IDENTITY_SERVICE_REQUIRED`).                                                                            |
| `http_request_timeout_secs`      | `Optional[int]`               | Per-request timeout (`ISTARI_CLIENT_HTTP_REQUEST_TIMEOUT_SECS`).                                                                                                                                                                                                   |
| `retry_enabled`                  | `Optional[bool]`              | Retry failed requests. Default `True` (`ISTARI_CLIENT_RETRY_ENABLED`).                                                                                                                                                                                             |
| `retry_max_attempts`             | `Optional[int]`               | `ISTARI_CLIENT_RETRY_MAX_ATTEMPTS`.                                                                                                                                                                                                                                |
| `retry_min_interval_millis`      | `Optional[int]`               | `ISTARI_CLIENT_RETRY_MIN_INTERVAL_MILLIS`.                                                                                                                                                                                                                         |
| `retry_max_interval_millis`      | `Optional[int]`               | `ISTARI_CLIENT_RETRY_MAX_INTERVAL_MILLIS`.                                                                                                                                                                                                                         |
| `retry_jitter_enabled`           | `Optional[bool]`              | Default `True` (`ISTARI_CLIENT_RETRY_JITTER_ENABLED`).                                                                                                                                                                                                             |
| `filesystem_cache_enabled`       | `Optional[bool]`              | Default `True` (`ISTARI_CLIENT_FILESYSTEM_CACHE_ENABLED`).                                                                                                                                                                                                         |
| `filesystem_cache_root`          | `Path`                        | `ISTARI_CLIENT_FILESYSTEM_CACHE_ROOT`.                                                                                                                                                                                                                             |
| `filesystem_cache_clean_on_exit` | `Optional[bool]`              | Default `True` (`ISTARI_CLIENT_FILESYSTEM_CACHE_CLEAN_BEFORE_EXIT`).                                                                                                                                                                                               |
| `multipart_chunksize`            | `Optional[int]`               | Multipart part size in bytes. Default 128 MiB (`ISTARI_CLIENT_MULTIPART_CHUNKSIZE`).                                                                                                                                                                               |
| `multipart_threshold`            | `Optional[int]`               | Size above which an upload is multipart. Default 2 GiB (`ISTARI_CLIENT_MULTIPART_THRESHOLD`).                                                                                                                                                                      |
| `s3_direct_upload_enabled`       | `Optional[bool]`              | Upload bytes directly to S3. Default `False` (`ISTARI_CLIENT_S3_DIRECT_UPLOAD`).                                                                                                                                                                                   |
| `s3_bucket_name`                 | `Optional[str]`               | Required when direct upload is enabled (`ISTARI_CLIENT_S3_BUCKET_NAME`).                                                                                                                                                                                           |
| `log_level`                      | `Optional[str]`               | Default `INFO` (`ISTARI_CLIENT_LOG_LEVEL`).                                                                                                                                                                                                                        |
| `log_to_file`                    | `Optional[bool]`              | Default `False` (`ISTARI_CLIENT_LOG_TO_FILE`).                                                                                                                                                                                                                     |
| `log_file_path`                  | `Optional[str]`               | `ISTARI_CLIENT_LOG_FILE_PATH`.                                                                                                                                                                                                                                     |
| `proxy_url`                      | `Optional[str]`               | Forward proxy for outbound HTTP(S), for example `http://proxy.corp:8080` (`ISTARI_CLIENT_PROXY_URL`). Overrides `HTTP_PROXY`, `HTTPS_PROXY`, and `ALL_PROXY`. `NO_PROXY` still applies. SOCKS proxies are not supported.                                           |
| `ca_bundle`                      | `Optional[str]`               | PEM CA bundle for TLS verification (`ISTARI_CLIENT_CA_BUNDLE`). Overrides `REQUESTS_CA_BUNDLE` and `SSL_CERT_FILE`.                                                                                                                                                |
| `trust_env`                      | `Optional[bool]`              | When `False`, ignore proxy and CA environment variables. Explicit `proxy_url` and `ca_bundle` still apply. Default `True` (`ISTARI_CLIENT_TRUST_ENV`).                                                                                                             |
| `tags`                           | `Optional[list[str]]`         | Endpoint tags whose API hashes the client sends (for example `["Agent", "Model"]`). `None` sends every known hash. No environment variable.                                                                                                                        |
| `datetime_format`                | `str`                         | `"%Y-%m-%dT%H:%M:%S.%f%z"`. Not a constructor argument.                                                                                                                                                                                                            |
| `date_format`                    | `str`                         | `"%Y-%m-%d"`. Not a constructor argument.                                                                                                                                                                                                                          |

Two attributes also read an alias environment variable that begins with `ISTARI_CLIENT_` instead of `ISTARI_DIGITAL_`: `ISTARI_CLIENT_IDENTITY_SERVICE_ENABLED` and `ISTARI_CLIENT_IDENTITY_SERVICE_REQUIRED`. When both names are set, the `ISTARI_DIGITAL_` one wins.

:::note Differences in 13.1.x
This page describes istari-digital-client 13.2.0 and later. In 13.1.x:

- `identity_url`, `identity_api_version`, `identity_service_required` and `resolved_identity_api_version()` do not exist.
- `identity_service_enabled` defaults to `False`, and turning it on requires `digital_api_url`.

:::

#### Identity API version

The identity service has two APIs, v1 and v2. `identity_api_version` chooses which one the client uses. [`IstariAdmin.identity`](16-identity.md#requirements) needs v2.

- `"auto"`, the default, sends no request when the client is constructed. The first token fetch tries the v2 token endpoint, and settles on v1 when the identity service does not serve `/api/v2`.
- `"v1"` and `"v2"` use that API without checking.
- Any other value raises `ConfigurationError` at construction.

`Configuration.resolved_identity_api_version()` reports the version in force. Under `"auto"` it may fetch a token to settle the version, and raises `IdentityServiceError` if that fails. For a client that authenticates with a personal access token, it returns `V2` under `"auto"` without checking; `IstariAdmin.identity` still needs a key.

After construction, `identity_api_version` holds an `IdentityApiVersion` member, which compares equal to its string. Import the enum with `from istari_digital_client import IdentityApiVersion`.

#### Key or personal access token

The client authenticates with a key or a personal access token, by the first rule below that applies. A _key_ here is `identity_service_secret_file` or `identity_service_secret`, or their environment variables. A _personal access token_ is `registry_auth_token` or `ISTARI_REGISTRY_AUTH_TOKEN`.

1. `identity_service_required` is `True`: the key. Without a key, construction raises `ConfigurationError`.
2. `identity_service_enabled` is `False`: the personal access token, even when a key is configured.
3. `identity_service_enabled` is unset, and the key or a URL (`digital_api_url` or `identity_url`) is missing: the personal access token. A key without a URL logs a warning, unless the key comes only from the environment and a personal access token is passed as an argument.
4. A personal access token is passed as an argument, and the key comes only from the environment: the personal access token.
5. A key is configured: the key. This includes a key and a personal access token that both come from the environment.
6. `identity_service_enabled` is `True` with no key: the personal access token, or `ConfigurationError` when there is none.

Construction also raises `ConfigurationError` when the client would use a key that cannot be read or parsed. It does the same when `identity_service_required` or `identity_service_enabled` is `True`, the client uses the key, and no URL is set.

A `Configuration` with no key and no personal access token is created without error when neither `identity_service_required` nor `identity_service_enabled` is `True`. Creating a `Client` from it raises `ConfigurationError`.

#### Methods

| Name                              | Description                                                                                                                    |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `auth_settings`                   | Bearer auth settings dict used by the API client.                                                                              |
| `resolved_identity_api_version()` | The identity service API version in force: `IdentityApiVersion.V1` or `V2`. See [Identity API version](#identity-api-version). |

Key lifecycle calls live on [`client.keys`](14-keys.md), not on `Configuration`.


---

<!-- Source: api_reference/10-infosec.md -->

---
slug: /build/python/api_reference/infosec
sidebar_label: "Infosec levels"
sidebar_position: 5.5
---

# Infosec levels

Methods for assigning information security classifications to models, artifacts, Systems, users, and connected resources, and for configuring the platform-wide infosec schema.

All methods are available on the [`Client`](01-client.md) instance. Parameters marked **(required)** must be provided. See [Enums](08-enums.md) for valid enum values.

Infosec levels classify a Resource (or user) at one of an ordered set of levels defined by the active **infosec schema** (e.g. `US_DOD`, `AUS`). When the platform infosec setting is enabled, every Resource carries an active level, and access checks compare the caller's clearance to the Resource's classification before permissions are evaluated.

## Resource classification

### assign_infosec_level()

Assign a security classification to a model, artifact, System, user, or connected resource.

The level must come from the active platform schema; use [`list_infosec_levels`](#list_infosec_levels) to enumerate the available IDs.

- **Parameters:**
  - **subject_type** ([_InfosecLevelObjectType_](08-enums.md#infoseclevelobjecttype)) – Type of object to classify. (required)
  - **subject_id** (_str_) – ID of the object to classify. (required)
  - **assign_infosec_level** ([_AssignInfosecLevel_](#assigninfoseclevel)) – Wrapper containing the target `infosec_level_id`. (required)
  - **http_request_timeout_secs** (_int_, _optional_) – timeout setting for this request

- **Return Type:** [InfosecLevel](#infoseclevel)

### list_infosec_levels()

List all infosec levels defined by the active platform schema, in the order they appear in the schema.

- **Parameters:**
  **http_request_timeout_secs** (_int_, _optional_) – timeout setting for this request

- **Return Type:** List[[InfosecLevel](#infoseclevel)]

## Platform settings

### get_platform_infosec_settings()

Retrieve the active platform infosec settings — whether infosec enforcement is enabled, which schema is active, the maximum allowed level, and the default level applied to new Resources.

- **Parameters:**
  **http_request_timeout_secs** (_int_, _optional_) – timeout setting for this request

- **Return Type:** [PlatformInfosecSettings](#platforminfosecsettings)

### enable_platform_infosec_settings()

Set or update the platform infosec settings. Switching the schema or maximum level affects every Resource because the active classification is interpreted against the schema.

This endpoint is admin-only.

- **Parameters:**
  - **set_platform_infosec_settings** ([_SetPlatformInfosecSettings_](#setplatforminfosecsettings)) – New platform infosec configuration. (required)
  - **http_request_timeout_secs** (_int_, _optional_) – timeout setting for this request

- **Return Type:** [PlatformInfosecSettings](#platforminfosecsettings)

## Data types

### AssignInfosecLevel

Wrapper passed to [`assign_infosec_level`](#assign_infosec_level).

| Attribute          | Type  | Description                                            |
| ------------------ | ----- | ------------------------------------------------------ |
| `infosec_level_id` | _str_ | ID of an existing infosec level from the active schema |

### InfosecLevel

Returned by [`list_infosec_levels`](#list_infosec_levels) and [`assign_infosec_level`](#assign_infosec_level).

| Attribute       | Type       | Description                                            |
| --------------- | ---------- | ------------------------------------------------------ |
| `id`            | _str_      | Level identifier                                       |
| `created`       | _datetime_ | When the level was registered                          |
| `schema_id`     | _str_      | ID of the parent infosec schema                        |
| `name`          | _str_      | Display name (e.g. `Unclassified`, `Secret`)           |
| `order`         | _int_      | Position within the schema; higher values are stricter |
| `display_color` | _str_      | Hex color used by the UI                               |

### PlatformInfosecSettings

Returned by [`get_platform_infosec_settings`](#get_platform_infosec_settings) and [`enable_platform_infosec_settings`](#enable_platform_infosec_settings).

| Attribute                | Type                            | Description                                            |
| ------------------------ | ------------------------------- | ------------------------------------------------------ |
| `id`                     | _str_                           | Settings record ID                                     |
| `created`                | _datetime_                      | When the settings were last applied                    |
| `enabled`                | _bool_                          | Whether infosec enforcement is active for the platform |
| `infosec_schema`         | _InfosecSchema_                 | Active schema definition (levels and metadata)         |
| `max_level`              | [_InfosecLevel_](#infoseclevel) | Maximum level a Resource may be classified at          |
| `default_resource_level` | [_InfosecLevel_](#infoseclevel) | Level applied to a new Resource when none is specified |

### SetPlatformInfosecSettings

Body for [`enable_platform_infosec_settings`](#enable_platform_infosec_settings).

| Attribute                | Type                                                   | Description                                                   |
| ------------------------ | ------------------------------------------------------ | ------------------------------------------------------------- |
| `enabled`                | _bool_                                                 | Toggle enforcement on or off                                  |
| `infosec_schema_type`    | [_InfosecSchemaTypes_](08-enums.md#infosecschematypes) | Which packaged schema to activate (e.g. `US_DOD`, `AUS`)      |
| `max_level`              | _int_                                                  | Maximum level (`order` value) a Resource may be classified at |
| `default_resource_level` | _int_                                                  | Default level (`order` value) applied to new Resources        |


---

<!-- Source: api_reference/11-documents.md -->

---
slug: /build/python/api_reference/documents
sidebar_label: "Documents"
sidebar_position: 5.6
---

# Documents

Methods for creating and managing structured documents (e.g. requirements, design specs) attached to a System configuration.

A **document** is a versioned, ProseMirror-formatted Resource scoped to a `configuration_id`. Documents track a revision history identical to other Resources, but their content is rich text rather than a binary file. They support exporting to multiple formats (`json`, `markdown`, `docx`, `pdf`).

All methods are available on the [`Client`](01-client.md) instance. Parameters marked **(required)** must be provided. See [Pagination](01-client.md#pagination) for `page`/`size` defaults.

## Create and update

### create_document()

Create a new document on a System configuration. Pass content as a Python dict (ProseMirror JSON) or a JSON string; omit it to start with an empty document.

- **Parameters:**
  - **create_document_request** ([_CreateDocumentRequest_](#createdocumentrequest)) – Configuration ID, name, and optional content/description. (required)
  - **http_request_timeout_secs** (_int_, _optional_) – timeout setting for this request

- **Return Type:** [Document](#document)

### update_document()

Update an existing document. Provide only the fields you want to change — unspecified fields are preserved from the base revision. By default the update is based on the current revision; pass `revision_id` to base the update on a specific older revision (useful for explicit conflict detection).

- **Parameters:**
  - **document_id** (_str_) – ID of the document to update. (required)
  - **update_document_request** ([_UpdateDocumentRequest_](#updatedocumentrequest)) – Fields to change. (required)
  - **http_request_timeout_secs** (_int_, _optional_) – timeout setting for this request

- **Return Type:** [Document](#document)

## Retrieve and list

### get_document()

Retrieve a document by ID, including its current revision and ProseMirror content.

- **Parameters:**
  - **document_id** (_str_) – ID of the document to retrieve. (required)
  - **http_request_timeout_secs** (_int_, _optional_) – timeout setting for this request

- **Return Type:** [Document](#document)

### get_document_by_revision_id()

Retrieve the document state captured by a specific file revision.

- **Parameters:**
  - **revision_id** (_str_) – File revision ID to retrieve the document at. (required)
  - **http_request_timeout_secs** (_int_, _optional_) – timeout setting for this request

- **Return Type:** [Document](#document)

### list_documents()

List documents the caller has access to, optionally filtered by configuration, system, archive status, or a substring of the name.

- **Parameters:**
  - **page** (_int_) – Page number.
  - **size** (_int_) – Page size.
  - **filter_by** ([_FilterBy_](08-enums.md#filterby)) – Filter by ownership: `created_by_id` (yours) or `-created_by_id` (shared with you).
  - **archive_status** ([_ArchiveStatus_](08-enums.md#archivestatus)) – Filter by archive state. One of: `active`, `archived`, `all`.
  - **configuration_id** (_str_) – Restrict to documents on a specific configuration.
  - **system_id** (_str_) – Restrict to documents across all configurations on a System.
  - **search** (_str_) – Case-insensitive substring match on document name.
  - **sort** (_str_) – Sort expression accepted by the registry.
  - **http_request_timeout_secs** (_int_, _optional_) – timeout setting for this request

- **Return Type:** [PageDocumentListItem](#pagedocumentlistitem)

### list_configuration_documents()

List documents attached to a single configuration.

- **Parameters:**
  - **configuration_id** (_str_) – ID of the configuration to list documents for. (required)
  - **page** (_int_) – Page number.
  - **size** (_int_) – Page size.
  - **archive_status** ([_ArchiveStatus_](08-enums.md#archivestatus)) – Filter by archive state.
  - **sort** (_str_) – Sort expression accepted by the registry.
  - **http_request_timeout_secs** (_int_, _optional_) – timeout setting for this request

- **Return Type:** [PageDocumentListItem](#pagedocumentlistitem)

## Archive

### archive_document()

Archive a document. Archived documents are excluded from default list queries unless `archive_status="archived"` or `archive_status="all"` is passed.

- **Parameters:**
  - **document_id** (_str_) – ID of the document to archive. (required)
  - **archive** (_Archive_, _optional_) – Optional reason payload recorded on the archive event.
  - **http_request_timeout_secs** (_int_, _optional_) – timeout setting for this request

- **Return Type:** [Document](#document)

## Export

### export_document()

Export the current document (or a specified revision/snapshot) to one of the supported output formats. Resource links inside the document are resolved against the snapshot or revision context, when supplied.

- **Parameters:**
  - **document_id** (_str_) – ID of the document to export. (required)
  - **output_format** (_str_) – Output format: `json`, `markdown`, `docx`, or `pdf`.
  - **snapshot_id** (_str_) – Optional snapshot ID for a point-in-time export. Resource links resolve against the snapshot.
  - **revision_id** (_str_) – Optional file revision ID to export a specific older version of the document. If both `revision_id` and `snapshot_id` are passed, `snapshot_id` wins.
  - **http_request_timeout_secs** (_int_, _optional_) – timeout setting for this request

- **Return Type:** _object_ (export payload; format depends on `output_format`)

## Data types

### CreateDocumentRequest

Body for [`create_document`](#create_document).

| Attribute          | Type                  | Description                                                                     |
| ------------------ | --------------------- | ------------------------------------------------------------------------------- |
| `configuration_id` | _str_                 | Configuration the document lives on                                             |
| `name`             | _str_                 | Document name (e.g. `"Requirements"`)                                           |
| `content`          | _dict \| str \| None_ | ProseMirror content as a Python dict or JSON string; omit for an empty document |
| `description`      | _str \| None_         | Optional description                                                            |

### UpdateDocumentRequest

Body for [`update_document`](#update_document). At least one of `content`, `name`, or `description` is required.

| Attribute     | Type                  | Description                                                                                                 |
| ------------- | --------------------- | ----------------------------------------------------------------------------------------------------------- |
| `content`     | _dict \| str \| None_ | New ProseMirror content; omit to leave unchanged                                                            |
| `name`        | _str \| None_         | New document name; omit to leave unchanged                                                                  |
| `description` | _str \| None_         | New description; omit to leave unchanged                                                                    |
| `revision_id` | _str \| None_         | Base revision for the update; defaults to the current revision. Pass an older revision to detect conflicts. |

### Document

Returned by `create_document`, `get_document*`, `update_document`, and `archive_document`. See [Files, models & artifacts data types](models/files.md#filerevision) for the shared `revision`/`content_token` shape; document-specific attributes mirror the create/update request fields plus the standard archive metadata.

### PageDocumentListItem

Standard pagination wrapper around lightweight `DocumentListItem` rows; see [Common data types](models/common.md) for the page shape.


---

<!-- Source: api_reference/12-change-requests.md -->

---
slug: /build/python/api_reference/change-requests
sidebar_label: "Change requests"
---

# Change requests

Open, review, merge, and close change requests on a System. The walkthrough is [Branching and change requests](../04-branching.md). Status values are [`ChangeRequestStatus`](08-enums.md#changerequeststatus): `OPEN`, `MERGED`, `CLOSED`.

All methods are on the [`Client`](01-client.md). `MERGED` is produced only by [`merge_change_request()`](#merge_change_request). [`update_change_request()`](#update_change_request) accepts `OPEN` or `CLOSED`.

`update_change_request` is a full replacement of the mutable fields. Omitting `title` or `description` clears that field to null, so send the current values back when you are only changing the status.

## Lifecycle

### create_change_request()

Opens a change request from a source branch into a target branch.

- **Parameters:**
  - **system_id** (_str_) – System id. (required)
  - **change_request_create_request** (`ChangeRequestCreateRequest`) – (required). `source_tag_id` and `target_tag_id` are required. `title` and `description` are optional.
  - **http_request_timeout_secs** (_int_, _optional_) – Timeout for this request.

- **Return Type:** `ChangeRequestResponseModel` — call `.actual_instance` for the open change request (`change_request_id`, `status`, `title`, `description`).

### get_change_request()

Returns one change request.

- **Parameters:**
  - **system_id** (_str_) – System id. (required)
  - **change_request_id** (_str_) – Change request id. (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `ChangeRequestResponseModel`

### list_change_requests()

Lists change requests on a System.

- **Parameters:**
  - **system_id** (_str_) – System id. (required)
  - **status** ([_ChangeRequestStatus_](08-enums.md#changerequeststatus), _optional_) – Filter by `OPEN`, `MERGED`, or `CLOSED`.
  - **source_tag_id** (_str_, _optional_) – Filter by source branch id.
  - **target_tag_id** (_str_, _optional_) – Filter by target branch id.
  - **created_by_id** (_str_, _optional_)
  - **page** (_int_, _optional_) – Page number, minimum 1.
  - **size** (_int_, _optional_) – Page size, 1–100. Default 10.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `PageChangeRequestResponseModel`

### update_change_request()

Replaces the mutable fields of a change request. Use `status="CLOSED"` to close an open request, and `status="OPEN"` to reopen a closed one. Setting `status` to the current value leaves the status unchanged. `MERGED` is rejected — merge with [`merge_change_request()`](#merge_change_request).

`title` and `description` are replaced by the values you send. Omit either one and that field is cleared.

- **Parameters:**
  - **system_id** (_str_) – System id. (required)
  - **change_request_id** (_str_) – Change request id. (required)
  - **change_request_update_request** (`ChangeRequestUpdateRequest`) – (required). `status` is required (`OPEN` or `CLOSED`). `title`, `description`, and `comment` are optional.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `ChangeRequestResponseModel`

### merge_change_request()

Merges an open change request into its target branch.

- **Parameters:**
  - **system_id** (_str_) – System id. (required)
  - **change_request_id** (_str_) – Change request id. (required)
  - **change_request_merge_request** (`ChangeRequestMergeRequest`) – (required). Optional `comment`.
  - **check_only** (_bool_, _optional_) – Run the staleness check and do not merge.
  - **x_head_pair_token** (_str_, _optional_) – `head_pair_token` from a prior [`change_request_changes()`](#change_request_changes) page.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `ChangeRequestResponseModel` — `.actual_instance.status` is `MERGED` after a merge.

### list_change_request_events()

Lists the event history of a change request. Event types are [`ChangeRequestEventType`](08-enums.md#changerequesteventtype): `OPENED`, `REOPENED`, `MERGED`, `CLOSED`.

- **Parameters:**
  - **system_id** (_str_) – System id. (required)
  - **change_request_id** (_str_) – Change request id. (required)
  - **page** (_int_, _optional_)
  - **size** (_int_, _optional_) – 1–100. Default 10.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `PageChangeRequestEvent`

## Diff

### change_request_change_summary()

Returns row counts for the diff between the change request's two branch heads: `added_count`, `removed_count`, and `changed_count`, summed across resources and subsystems.

- **Parameters:**
  - **system_id** (_str_) – System id. (required)
  - **change_request_id** (_str_) – Change request id. (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `ChangeRequestSummary`

### change_request_changes()

Returns one page of the diff. Each item's `.actual_instance` is a resource diff or a subsystem diff.

The page includes `next_cursor`, `has_more`, and `head_pair_token`. The token pins the source and target snapshots this page was computed from. Pass it back as `x_head_pair_token` on the next page, and pass `next_cursor` as `cursor`.

- **Parameters:**
  - **system_id** (_str_) – System id. (required)
  - **change_request_id** (_str_) – Change request id. (required)
  - **component_type** ([_ChangeRequestComponentType_](08-enums.md#changerequestcomponenttype), _optional_) – `RESOURCE`, `SUBSYSTEM`, or `ALL`.
  - **change_types** (_list_ of [_ChangeRequestDiffType_](08-enums.md#changerequestdifftype), _optional_) – `ADDED`, `REMOVED`, `CHANGED`.
  - **search** (_str_, _optional_) – Name filter.
  - **cursor** (_str_, _optional_) – `next_cursor` from the previous page.
  - **limit** (_int_, _optional_) – Page size, maximum 100.
  - **allow_head_refresh** (_bool_, _optional_)
  - **x_head_pair_token** (_str_, _optional_) – `head_pair_token` from the previous page.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `ChangeRequestDiffPage`

Comparing two snapshots, or a branch head against live tracked state, uses [`compare_snapshots()`](04-systems.md#compare_snapshots) and [`compare_tag_to_live()`](04-systems.md#compare_tag_to_live). Those calls share the same component and change-type filters.


---

<!-- Source: api_reference/13-credentials.md -->

---
slug: /build/python/api_reference/credentials
sidebar_label: "Credentials"
---

# Credentials

Store a secret the platform can hand to a job, complete a browser link against an auth integration, or create an org-owned service connection. The sealed secret is not returned on [`StoredCredential`](#storedcredential). Status values are [`CredentialStatus`](08-enums.md#credentialstatus): `active`, `revoked`, `expired`.

Jobs that need a stored credential pass it as `auth_bindings` on [`add_job()`](03-jobs.md#add_job). See [Connected resources](../05-connected-resources.md).

All methods are on the [`Client`](01-client.md).

## Stored secrets

### list_credentials()

Lists credentials visible to the caller. The secret value is not included.

- **Parameters:**
  - **auth_integration_id** (_str_, _optional_) – Only credentials for this auth integration.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** list of `StoredCredential`

### create_credential()

Stores a credential from a secret you supply. The platform seals `secret_value`; it is absent from the returned object.

- **Parameters:**
  - **new_stored_credential** (`NewStoredCredential`) – (required). `name`, `auth_type` ([`FunctionAuthType`](08-enums.md#functionauthtype)), and `secret_value` are required. Optional: `auth_integration_id`, `account_identity`, `org_owned`.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `StoredCredential`

### update_credential()

Renames a stored credential. This call changes the label only.

- **Parameters:**
  - **credential_id** (_str_) – Credential to update. (required)
  - **credential_update** (`CredentialUpdate`) – (required). `name`.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `StoredCredential`

### delete_credential()

Disconnects a credential.

- **Parameters:**
  - **credential_id** (_str_) – Credential to delete. (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `None`

### validate_credential()

Probes whether a stored credential is still live.

- **Parameters:**
  - **credential_id** (_str_) – Credential to probe. (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `CredentialValidation`

## Browser link and service connections

### get_credential_authorize_url()

Builds the provider URL that starts a browser link.

- **Parameters:**
  - **auth_integration_id** (_str_) – Auth integration to link against. (required)
  - **redirect_uri** (_str_) – Where the provider returns the browser. (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `AuthorizeUrl` — includes the opaque `handle` that [`link_credential()`](#link_credential) expects.

### link_credential()

Completes a browser link after the provider redirects back.

- **Parameters:**
  - **new_credential_link** (`NewCredentialLink`) – (required). `handle` is the session id from `AuthorizeUrl`. `code` and `state` are the values the provider returned. Optional: `name`, `org_owned`, `reconnect_credential_id`.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `StoredCredential`

### create_service_connection()

Creates an org-owned service connection with no browser authorization. For OAuth 1.0a two-legged mode, requests sign with the integration's consumer key and secret and act as the service identity.

- **Parameters:**
  - **new_service_connection** (`NewServiceConnection`) – (required). `auth_integration_id` is required. `name` is optional.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `StoredCredential`

## Control tags

### get_credential_control_taggings()

Returns the control tags currently on a credential.

- **Parameters:**
  - **credential_id** (_str_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** list of `StoredCredentialControlTagging`

### get_credential_control_tagging_history()

Returns the control-tag history for a credential.

- **Parameters:**
  - **credential_id** (_str_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** list of `StoredCredentialControlTagging`

### patch_credential_control_taggings()

Adds or removes control tags on a credential.

- **Parameters:**
  - **credential_id** (_str_) – (required)
  - **request_body** (_list_ of _str_) – Control tag ids. (required)
  - **patch_op** ([_PatchOp_](08-enums.md#patchop)) – `set` or `delete`. The parameter description marks this required even though the client defaults it to `None`.
  - **reason** (_str_, _optional_)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** list of `StoredCredentialControlTagging`

## StoredCredential

A named credential held for a user or an org. `owner_user_id` is null for an org-owned credential. Fields: `id`, `created`, `created_by_id`, `name`, `auth_type`, `status`, `tenant_id`, `owner_user_id`, `auth_integration_id`, `account_identity`, `control_tags`.


---

<!-- Source: api_reference/14-keys.md -->

---
slug: /build/python/api_reference/keys
sidebar_label: "Keys"
---

# Keys

`client.keys` creates, lists, and revokes the **Key** a Python script uses to sign in. The same object exists on [`Client`](01-client.md) and on `V3Client`. You always call it as `client.keys.some_method()`, for example `client.keys.list()`.

Most scripts never need this page. Download a key once from the web app (**avatar → Developer Settings → Generate Key**) and follow [Setup](../01-setup.md). Which change matches a script that still uses a personal access token is on [Move a Python script from a PAT to a key](../move-from-pat-to-key.md). Come here when you want to do that from code: turn a personal access token into a key file, add another key, or revoke one.

:::note From 13.2.0
From istari-digital-client 13.2.0, these methods are deprecated. [`IstariAdmin.identity.keys`](16-identity.md#keys) replaces the key-management methods. The personal access token (PAT) exchange has no replacement, because the identity service's v2 API has no exchange. Version 13.2.0 also adds an `api_version` argument to each method. [Deprecated v1 key methods](16-identity.md#deprecated-v1-key-methods) describes how the methods behave now and when they warn.
:::

The same job on the command line is [`stari key exchange`](../../icbs-install/05-CLI/04-exchanging-pat-for-key.md). Creating an agent that signs in with its own key is a different call, [`create_agent_with_key()`](06-agents.md#create_agent_with_key).

## Which call to use

| You want to                                                                | Call                                                                |
| -------------------------------------------------------------------------- | ------------------------------------------------------------------- |
| Turn the personal access token in your `Configuration` into a new key file | [`generate_keypair_and_exchange()`](#generate_keypair_and_exchange) |
| Do that exchange with a keypair you already created                        | [`exchange_pat()`](#exchange_pat)                                   |
| Add a new key while you are already signed in with a key                   | [`generate_keypair_and_register()`](#generate_keypair_and_register) |
| Register a keypair you already created                                     | [`register()`](#register)                                           |
| See the keys on your account                                               | [`list()`](#list)                                                   |
| Look up one key, or revoke it                                              | [`get()`](#get), [`revoke()`](#revoke)                              |

`list` and `get` return names and ids only. The private key is never sent back. Save it from the result of an exchange or a register call, or you cannot sign in with that key later.

## What you need first

**Exchanging a personal access token** (`generate_keypair_and_exchange`, `exchange_pat`) needs the API URL from **Developer Settings → Endpoints** as `digital_api_url`. The token is `registry_auth_token` on the same `Configuration`, or the `pat=` argument. Identity Service mode can stay off for this step. Personal access tokens are [deprecated](../01-setup.md#personal-access-tokens); the point of the exchange is to stop using one.

**Listing, registering, and revoking** need a client that is already signed in with a key: `identity_service_enabled=True` and `identity_service_secret_file` (or `identity_service_secret`), as in [Setup](../01-setup.md#initialize-the-client).

## Replace a personal access token

```python
from istari_digital_client import Client, Configuration

client = Client(Configuration(
    digital_api_url="https://api.your-instance.istari.app",
    registry_auth_token="your-personal-access-token",
))

result = client.keys.generate_keypair_and_exchange(name="laptop")
result.write_credentials_json("/absolute/path/to/key.json")
```

`write_credentials_json` writes the private key as JSON and restricts the file to the current user. Keep that file out of git. The next script signs in with it:

```python
client = Client(Configuration(
    digital_api_url="https://api.your-instance.istari.app",
    identity_service_secret_file="/absolute/path/to/key.json",
    identity_service_enabled=True,
))
```

`result.to_identity_service_secret()` returns the same credential as one base64 string, for `identity_service_secret=` when you store it in a secret manager instead of a file.

## Arguments that show up everywhere

- **kind** — `PrincipalKind.USER` (the default, a person) or `PrincipalKind.AGENT`. Import it with `from istari_digital_client import PrincipalKind`.
- **principal_id** — whose keys you mean. `"me"` is the signed-in user, and it is the default. For an agent, pass that agent's id. An agent cannot list, register, or revoke its own keys; an administrator does that and passes the agent's id.
- **name** — a label such as `"laptop"`. Leave it out and the platform uses the key id as the label.
- **pat** — the personal access token to exchange. Leave it out to use `registry_auth_token` from `Configuration`.
- **retry_policy** — leave it out. The client uses the retry settings on `Configuration`.
- **api_version** — leave it out. It takes `"auto"` (the default), `"v1"` or `"v2"`; [Deprecated v1 key methods](16-identity.md#deprecated-v1-key-methods) describes how each value routes.

## Exchange a personal access token

### generate_keypair_and_exchange()

Creates a new P-384 keypair and exchanges your personal access token for it, in one call. This is the call in the example above.

- **Parameters:**
  - **pat** (_str_, _optional_) — Token to exchange. Defaults to `registry_auth_token`.
  - **kind** (`PrincipalKind`) — `USER` by default. `AGENT` exchanges an agent's token; an administrator runs that.
  - **key_id** (_str_, _optional_) — Id to assign. A random id is chosen when you leave this out.
  - **name** (_str_, _optional_) — Label. Blank becomes the key id.
  - **retry_policy** (`RetryPolicy`, _optional_)
  - **api_version** (`IdentityApiVersion` or _str_, _optional_) — `"auto"` by default. See [Arguments that show up everywhere](#arguments-that-show-up-everywhere).

- **Return Type:** `ExchangePatResult`. Call `write_credentials_json(path)` or `to_identity_service_secret()` before you discard it. Also includes `client_id`, `key_id`, `tenant_id`, `user_uuid`, and `name`.

### exchange_pat()

Same exchange, using a P-384 keypair you already hold in a `GeneratedClientCredentials` object. Reach for [`generate_keypair_and_exchange()`](#generate_keypair_and_exchange) when you do not have one yet.

- **Parameters:**
  - **credentials** (`GeneratedClientCredentials`) — The keypair. The public key is registered; the private key stays on the result. (required)
  - **pat** (_str_, _optional_)
  - **kind** (`PrincipalKind`) — Default `USER`.
  - **validate_public_key** (_bool_) — Default `True`. Checks that the public key is P-384 before sending it.
  - **name** (_str_, _optional_)
  - **retry_policy** (`RetryPolicy`, _optional_)
  - **api_version** (`IdentityApiVersion` or _str_, _optional_) — `"auto"` by default. See [Arguments that show up everywhere](#arguments-that-show-up-everywhere).

- **Return Type:** `ExchangePatResult`

## Add, list, and revoke keys

These calls run only after the client is signed in with a key.

### generate_keypair_and_register()

Creates a P-384 keypair and registers it for someone who already has an account. With no arguments, that someone is you.

- **Parameters:**
  - **principal_id** (_str_, _optional_) — Defaults to your own id. Pass an agent's id, together with `kind=PrincipalKind.AGENT`, when an administrator is creating a key for that agent.
  - **kind** (`PrincipalKind`) — Default `USER`.
  - **key_id** (_str_, _optional_) — Random when omitted.
  - **name** (_str_, _optional_)
  - **retry_policy** (`RetryPolicy`, _optional_)
  - **api_version** (`IdentityApiVersion` or _str_, _optional_) — `"auto"` by default. See [Arguments that show up everywhere](#arguments-that-show-up-everywhere).

- **Return Type:** `RegisterKeyResult`. `metadata` describes the key (`key_id`, `name`, `algorithm`, `created_at`, `expires_at`). `write_credentials_json(path)` saves the private key.

### register()

Registers a P-384 public key from a `GeneratedClientCredentials` object you already have.

- **Parameters:**
  - **credentials** (`GeneratedClientCredentials`) — (required). Only the public key and key id are sent.
  - **principal_id** (_str_) — Default `"me"`.
  - **kind** (`PrincipalKind`) — Default `USER`.
  - **validate_public_key** (_bool_) — Default `True`.
  - **name** (_str_, _optional_)
  - **username** (_str_, _optional_) — Used when an administrator registers the first key for an agent that does not exist yet.
  - **display_name** (_str_, _optional_) — Display name for that new agent.
  - **retry_policy** (`RetryPolicy`, _optional_)
  - **api_version** (`IdentityApiVersion` or _str_, _optional_) — `"auto"` by default. See [Arguments that show up everywhere](#arguments-that-show-up-everywhere).

- **Return Type:** `KeyMetadata`

### list()

Lists keys for the signed-in user, or for the agent id you pass. Each entry is metadata: `key_id`, `name`, `algorithm`, `created_at`, and `expires_at` when the key expires.

- **Parameters:**
  - **principal_id** (_str_) — Default `"me"`.
  - **kind** (`PrincipalKind`) — Default `USER`.
  - **retry_policy** (`RetryPolicy`, _optional_)
  - **api_version** (`IdentityApiVersion` or _str_, _optional_) — `"auto"` by default. See [Arguments that show up everywhere](#arguments-that-show-up-everywhere).

- **Return Type:** `PrincipalKeys`. The keys are on `.keys`.

### get()

Returns the same metadata for one key.

- **Parameters:**
  - **key_id** (_str_) — (required)
  - **principal_id** (_str_) — Default `"me"`.
  - **kind** (`PrincipalKind`) — Default `USER`.
  - **retry_policy** (`RetryPolicy`, _optional_)
  - **api_version** (`IdentityApiVersion` or _str_, _optional_) — `"auto"` by default. See [Arguments that show up everywhere](#arguments-that-show-up-everywhere).

- **Return Type:** `KeyMetadata`

### revoke()

Deletes one key. A script still holding that key file can no longer sign in with it.

- **Parameters:**
  - **key_id** (_str_) — (required)
  - **principal_id** (_str_) — Default `"me"`.
  - **kind** (`PrincipalKind`) — Default `USER`.
  - **retry_policy** (`RetryPolicy`, _optional_)
  - **api_version** (`IdentityApiVersion` or _str_, _optional_) — `"auto"` by default. See [Arguments that show up everywhere](#arguments-that-show-up-everywhere).

- **Return Type:** `None`

### client_id

A property, read as `client.keys.client_id` (no parentheses). It is the Identity Service client id of the key this process is signed in with, and it requires Identity Service mode. `list()` and `get()` already default to this caller, so you only need the value when another API asks for your id.


---

<!-- Source: api_reference/15-webhooks.md -->

---
slug: /build/python/api_reference/webhooks
sidebar_label: "System webhooks"
---

# System webhooks

Register an HTTPS or pipeline target that the platform calls when a System event happens. Methods are on the [`Client`](01-client.md). The Python names are the generated operation ids.

Event values ([`SystemWebhookEvent`](08-enums.md#systemwebhookevent)):

- `system.snapshot.created`
- `system.change_request.opened`

Target values ([`WebhookTargetType`](08-enums.md#webhooktargettype)): `http`, `github_actions`, `gitlab_pipeline`.

`signing_secret` is present on the create response only. Later reads return `credential_masked` (the last four characters).

### create_webhook_api_v2_systems_system_id_webhooks_post()

Creates a webhook on a System.

- **Parameters:**
  - **system_id** (_str_) – (required)
  - **new_system_webhook** (`NewSystemWebhook`) – (required). `name`, `target_type`, `target_config`, and `event_types` are required. `credential` is optional.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `SystemWebhook`

### list_webhooks_api_v2_systems_system_id_webhooks_get()

Lists webhooks on a System.

- **Parameters:**
  - **system_id** (_str_) – (required)
  - **page** (_int_, _optional_)
  - **size** (_int_, _optional_) – 1–100. Default 10.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `PageSystemWebhook`

### get_webhook_api_v2_systems_system_id_webhooks_webhook_id_get()

Returns one webhook.

- **Parameters:**
  - **system_id** (_str_) – (required)
  - **webhook_id** (_str_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `SystemWebhook`

### update_webhook_api_v2_systems_system_id_webhooks_webhook_id_patch()

Patches a webhook. Every field on `UpdateSystemWebhook` is optional: `name`, `target_config`, `event_types`, `credential`, `enabled`. The model distinguishes an omitted field from an explicit null, so you can clear `credential` by sending null.

- **Parameters:**
  - **system_id** (_str_) – (required)
  - **webhook_id** (_str_) – (required)
  - **update_system_webhook** (`UpdateSystemWebhook`) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `SystemWebhook`

### delete_webhook_api_v2_systems_system_id_webhooks_webhook_id_delete()

Deletes a webhook.

- **Parameters:**
  - **system_id** (_str_) – (required)
  - **webhook_id** (_str_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `None`

### list_webhook_deliveries_api_v2_systems_system_id_webhooks_webhook_id_deliveries_get()

Lists delivery attempts for one webhook.

- **Parameters:**
  - **system_id** (_str_) – (required)
  - **webhook_id** (_str_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** list of `SystemWebhookDelivery`


---

<!-- Source: api_reference/16-identity.md -->

---
slug: /build/python/api_reference/identity
sidebar_label: "Identity administration"
---

# Identity administration

Manage the identity service from Python: its tenants, who belongs to each, the people, agents and Istari services that sign in (its _principals_), their keys and their roles. You can also request tokens from the identity service.

These methods are on the `identity` attribute of an `IstariAdmin` instance. They are grouped by subject: `admin.identity.tenants`, `admin.identity.memberships`, `admin.identity.principals`, `admin.identity.keys`, `admin.identity.roles` and `admin.identity.oauth`. Keyword-only parameters are marked **(keyword)**.

The web app says _suspend_ and _reactivate_ where these methods say `deactivate()` and `activate()`.

:::warning
`admin.identity` needs istari-digital-client 13.2.0 or later. `IstariAdmin` is in beta: its methods may change between releases without a deprecation period.
:::

## Requirements

The identity service has two APIs, v1 and v2. `admin.identity` uses v2. [Setup](../01-setup.md) covers installing the SDK and creating a key. Set these on the [`Configuration`](09-configuration.md):

- **A key.** Set `identity_service_secret_file` or `identity_service_secret`.
- **A URL.** Set `digital_api_url`, the gateway. To reach the services directly instead, set both `identity_url` and `registry_url`.
- **The v2 API.** Leave `identity_api_version` at its default, `"auto"`, or set it to `"v2"`. `admin.identity` is unavailable under `"v1"`, and under `"auto"` when the identity service does not serve v2.

When any of these is missing, the first call on `admin.identity` raises `ConfigurationError` instead of calling a v2 method. A client configured with a key can still end up using a personal access token, and then raises the same error; [Key or personal access token](09-configuration.md#key-or-personal-access-token) lists the settings that cause this. Under `"auto"`, the check may first fetch a token to learn which API the identity service serves. If that fetch fails, it raises `IdentityServiceError`.

Most methods that change something also need a Platform Administrator or a Tenant Administrator (see [Who may call](#who-may-call)). Only people can hold those roles, so run administration scripts with a person's key. A caller without the role is refused; see [Errors](#errors).

```python
from istari_digital_client import Configuration, IstariAdmin

admin = IstariAdmin(Configuration(
    digital_api_url="https://your-instance.istari.digital",
    identity_service_secret_file="/path/to/your/key.json",
))

# A tenant the chart's Zitadel import created; see tenants.create() for a new one
tenant = admin.identity.tenants.get("your-tenant-id")
person = admin.identity.principals.humans.create(email="ada@example.com", tenant_id=tenant.id)
admin.identity.roles.grant_tenant_role(tenant.id, role="tenant_admin", principal_id=person.principal_id)
```

Get a tenant's id from [`tenants.list()`](#tenantslist).

## Tenant management

On an installation with [tenant management](../../intro/terminology.md#tenant-management), the registry reads people and roles from the identity service instead of your sign-in provider. Other pages of this SDK reference say where the registry then behaves differently. The glossary entry describes how to tell from the web app whether your installation has tenant management. For example, Platform Administrators on such an installation have a [Platform Admin Console](../../users/admin-guide/console.md) with a **Tenants** page.

On an installation without tenant management, the registry takes roles from your sign-in provider, so role grants made here do not change what people may do in the registry.

:::note How tenant management is turned on
With tenant management, the registry authenticates callers through the identity service. Your IT administrator turns it on with the Helm values `identity.enabled`, which deploys the identity service, and `identity.clientIntegration.enabled`, which makes the registry and the web app authenticate through it. [API Gateway](../../icbs-install/03-control-plane/10-identity-service/03-API-Gateway.md) lists the other settings these values need.
:::

## Who may call

Two roles let a caller administer identities. Only people can hold them; agents cannot.

| Role                   | Role id        | Scope      | Administers                                           |
| ---------------------- | -------------- | ---------- | ----------------------------------------------------- |
| Platform Administrator | `admin`        | Platform   | Every tenant, principal and grant on the installation |
| Tenant Administrator   | `tenant_admin` | One tenant | That tenant, its members and the grants held in it    |

Where a method is restricted, its description says who may call it.

When the caller is not a Platform Administrator, the identity service refuses these calls against a Platform Administrator with 403 `target_is_platform_admin`:

- deactivating or activating a Platform Administrator
- revoking a Platform Administrator's membership or role grants

Your IT administrator [creates the installation's first Platform Administrator](../../icbs-install/03-control-plane/10-identity-service/05-Create-the-First-Platform-Administrator.md).

## Errors

The SDK raises its usual exceptions, which you can import from `istari_digital_client`:

| Status | Exception               |
| ------ | ----------------------- |
| 400    | `BadRequestError`       |
| 403    | `PermissionDeniedError` |
| 404    | `NotFoundError`         |
| 409    | `ConflictError`         |

Each method below lists its refusals by error code. A refusal is a 409 unless its entry names another status. To read the code, parse the exception's `response`, which holds the JSON body as a string: `json.loads(e.response)["error"]`.

Two refusals depend on what the caller may see:

- A caller who may not see a tenant or principal gets `NotFoundError`, as if it did not exist.
- A caller who may see it but may not perform the operation gets `PermissionDeniedError`. So does a caller whose own principal is deactivated.

## Paging

Methods that return `Page` read their results one page at a time:

- Iterating a `Page` fetches every page in turn.
- `.items` holds the current page only.
- `take(n)` stops after `n` items.

`limit` sets the page size. The server may use a smaller one.

## Tenants

`admin.identity.tenants`

### tenants.list()

List the tenants the caller may see. A Platform Administrator sees every tenant. Anyone else sees the tenants they administer or belong to.

- **Return Type:** List[[Tenant](#tenant)]

### tenants.get()

Read one tenant.

- **Parameters:**
  **tenant_id** (_str_) – The tenant's id. (required)

- **Return Type:** [Tenant](#tenant)

### tenants.create()

Create a tenant. Only a Platform Administrator may call it.

- The slug cannot be changed later, because issued tokens carry it.
- A new tenant has no organization in your sign-in provider, and needs none. For now, though, pre-registering people in it with [`principals.humans.create()`](#principalshumanscreate) is refused with `tenant_not_mapped`; your IT administrator adds its people instead ([Adding people to a tenant](../../icbs-install/03-control-plane/10-identity-service/02-Register-Clients-and-Tenants.md#creating-a-tenant-by-hand)).

- **Parameters:**
  - **slug** (_str_) – Unique, permanent handle for the tenant: 1 to 63 lowercase letters, digits and single hyphens, starting and ending with a letter or digit. (required, keyword)
  - **display_name** (_str_, _optional_) – Name shown to people. (keyword)
  - **description** (_str_, _optional_) – Free-text description. (keyword)

- **Return Type:** [Tenant](#tenant)

- **Refusals:**
  - `tenant_exists` – a tenant already has this slug.

### tenants.update()

Change a tenant's display name or description. A Platform Administrator, or a Tenant Administrator of this tenant, may call it.

- **Parameters:**
  - **tenant_id** (_str_) – The tenant's id. (required)
  - **display_name** (_str_, _optional_) – New display name. (keyword)
  - **description** (_str_, _optional_) – New description. (keyword)

- **Return Type:** [Tenant](#tenant)

### tenants.deactivate()

Take a tenant out of service. Only a Platform Administrator may call it.

Every member of the tenant is deactivated. By default, every role grant held in the tenant is revoked too, and so are the members' memberships and other role grants. [When a principal loses its membership](#when-a-principal-loses-its-membership) lists what is revoked.

When this tenant was the [default tenant](../../users/admin-guide/tenants.md#make-a-tenant-the-default), the oldest other active tenant becomes the default. `default_reassigned_to` names it.

- **Parameters:**
  **tenant_id** (_str_) – The tenant's id. (required)

- **Return Type:** [TenantDeactivation](#tenantdeactivation)

- **Refusals:**
  - `last_active_tenant` – this is the only active tenant. Activate another tenant first.
  - `last_administrator` – no active human Platform Administrator would remain.

### tenants.activate()

Return a deactivated tenant to service. Only a Platform Administrator may call it.

Activating a tenant only returns it to service. It does not restore revoked memberships or grants, reactivate any principal, or make the tenant the default again.

- **Parameters:**
  **tenant_id** (_str_) – The tenant's id. (required)

- **Return Type:** [Tenant](#tenant)

### tenants.set_default()

Make this tenant the [default tenant](../../users/admin-guide/tenants.md#make-a-tenant-the-default). The tenant that was the default loses the designation. Only a Platform Administrator may call it.

- **Parameters:**
  **tenant_id** (_str_) – The tenant's id. (required)

- **Return Type:** [Tenant](#tenant)

- **Refusals:**
  - `inactive_tenant` – the tenant is deactivated. Activate it first.

## Memberships

`admin.identity.memberships`

A membership places a principal in a tenant. A principal can hold one granted membership at a time.

### When a principal loses its membership

A person or agent left with no granted membership in an active tenant is deactivated. That happens when you revoke its membership, or deactivate its tenant.

What else is revoked depends on the call. "By default" means unless your IT administrator has turned this off; see the note below the table.

| Revoked                                                         | [`memberships.revoke()`](#membershipsrevoke) | [`tenants.deactivate()`](#tenantsdeactivate) |
| --------------------------------------------------------------- | -------------------------------------------- | -------------------------------------------- |
| Its membership in this tenant                                   | Always                                       | By default                                   |
| Its role grants in this tenant                                  | Always                                       | By default                                   |
| Its other role grants, including platform roles such as `admin` | By default                                   | By default                                   |

Activating the principal or the tenant again restores none of these.

:::note Identity service setting
The identity service setting `ISTARI_DIGITAL_IDENTITY_SERVICE_TENANT_DEACTIVATION_REVOCATION_CASCADE` controls the "by default" revocations. It defaults to `true`. Set to `false`, it keeps them in place for both calls, despite its name. It is listed in the identity service's [Configuration Reference](../../icbs-install/03-control-plane/10-identity-service/07-Configuration-Reference.md).
:::

### Move a principal to another tenant

A principal can hold only one granted membership, so moving it takes these steps:

1. Revoke its membership in the old tenant with [`memberships.revoke()`](#membershipsrevoke). This deactivates the principal and revokes its role grants, as the table above describes.
2. Grant it a membership in the new tenant with [`memberships.grant()`](#membershipsgrant).
3. Reactivate it with [`principals.activate()`](#principalsactivate).
4. If it held roles, grant them again, with [`roles.grant_tenant_role()`](#rolesgrant_tenant_role) or [`roles.grant_principal_role()`](#rolesgrant_principal_role).

### memberships.list()

Page through a tenant's members of every kind. Each record includes the member's principal. A caller who is a member of the tenant but does not administer it sees only its people.

- **Parameters:**
  - **tenant_id** (_str_) – The tenant's id. (required)
  - **limit** (_int_, _optional_) – Page size. (keyword)

- **Return Type:** Page[[Membership](#membership)]

### memberships.list_humans()

Page through a tenant's people.

- **Parameters:**
  - **tenant_id** (_str_) – The tenant's id. (required)
  - **limit** (_int_, _optional_) – Page size. (keyword)

- **Return Type:** Page[[Membership](#membership)]

### memberships.list_agents()

Page through a tenant's agents.

- **Parameters:**
  - **tenant_id** (_str_) – The tenant's id. (required)
  - **limit** (_int_, _optional_) – Page size. (keyword)

- **Return Type:** Page[[Membership](#membership)]

### memberships.list_for_principal()

List one principal's memberships, all in a single page.

- **Parameters:**
  **principal_id** (_str_, _optional_) – The principal's id, or `"me"` for the caller. Default: `"me"`.

- **Return Type:** Page[[Membership](#membership)]

### memberships.grant()

Grant a principal a membership in a tenant. A Platform Administrator, or a Tenant Administrator of the tenant, may call it, and the caller must be a person. If the principal already holds this membership, the existing record is returned.

- **Parameters:**
  - **tenant_id** (_str_) – The tenant's id. (required)
  - **principal_id** (_str_, _optional_) – The principal to add. (keyword)
  - **email** (_str_, _optional_) – The email address of an existing person to add. (keyword)

  Pass exactly one of `principal_id` and `email`. Passing neither or both raises `ValueError`. To add someone who has no principal yet, pre-register them with [`principals.humans.create()`](#principalshumanscreate).

- **Return Type:** [Membership](#membership)

- **Refusals:**
  - `membership_limit` – the principal already holds a granted membership in another tenant. See [Move a principal to another tenant](#move-a-principal-to-another-tenant).
  - `tenant_deactivated` – the tenant is deactivated.

### memberships.revoke()

End a principal's membership in a tenant. A Platform Administrator, or a Tenant Administrator of the tenant, may call it, and the caller must be a person.

The method returns the membership record, now with status `revoked`. Revoking also deactivates the principal and revokes role grants; see [When a principal loses its membership](#when-a-principal-loses-its-membership).

- **Parameters:**
  - **tenant_id** (_str_) – The tenant's id. (required)
  - **principal_id** (_str_) – The member's id. (required)

- **Return Type:** [Membership](#membership)

- **Refusals:**
  - `self_revocation` – the caller is revoking their own membership.
  - 403 `target_is_platform_admin` – the member is a Platform Administrator and the caller is not.
  - `last_administrator` – no active human Platform Administrator would remain.

## Principals

`admin.identity.principals`

A principal is anything that signs in to the identity service:

- a person (`human`)
- an agent (`agent`)
- one of Istari's own components (`platform_service`)

Methods that can return any kind return a [Principal](#principal) wrapper.

### principals.list()

Page through the principals of every kind that the caller may see.

A tenant member with no administrator role sees only their own tenant's people, and only by passing `kind="human"` or calling [`principals.humans.list()`](#principalshumanslist). Without that filter, their page is empty.

- **Parameters:**
  - **tenant_id** (_str_, _optional_) – Only principals in this tenant. (keyword)
  - **kind** (_str_, _optional_) – One of `human`, `agent`, `platform_service`. (keyword)
  - **limit** (_int_, _optional_) – Page size. (keyword)

- **Return Type:** Page[[Principal](#principal)]

### principals.get()

Read one principal of any kind.

- **Parameters:**
  **principal_id** (_str_) – The principal's id. (required)

- **Return Type:** [Principal](#principal)

### principals.me()

Read the caller's own principal.

- **Return Type:** [Principal](#principal)

### principals.resolve()

Read many principals in one request. Ids that do not exist, or that the caller may not see, are left out of the result rather than refused.

- **Parameters:**
  **ids** (_List[str]_) – Principal ids. (required)

- **Return Type:** [PrincipalBatch](#principalbatch)

### principals.deactivate()

Take a principal of any kind out of service. A Platform Administrator, or a Tenant Administrator of the principal's tenant, may call it.

Its memberships and role grants are kept, so activating it restores its access.

- **Parameters:**
  **principal_id** (_str_) – The principal's id. (required)

- **Return Type:** [Principal](#principal)

- **Refusals:**
  - `last_administrator` – no active human Platform Administrator would remain.
  - 403 `target_is_platform_admin` – the principal is a Platform Administrator and the caller is not.

### principals.activate()

Return a deactivated principal to service, with the grants it kept. A Platform Administrator, or a Tenant Administrator of the principal's tenant, may call it.

- **Parameters:**
  **principal_id** (_str_) – The principal's id. (required)

- **Return Type:** [Principal](#principal)

- **Refusals:**
  - `no_granted_membership` – the principal holds no granted membership. Grant it one first with [`memberships.grant()`](#membershipsgrant).
  - 403 `target_is_platform_admin` – the principal is a Platform Administrator and the caller is not.

## People

`admin.identity.principals.humans`

### principals.humans.list()

Page through people.

- **Parameters:**
  - **tenant_id** (_str_, _optional_) – Only people in this tenant. (keyword)
  - **limit** (_int_, _optional_) – Page size. (keyword)
  - Filters, each keyword and optional, passed to the identity service unchanged:
    - **email** (_str_)
    - **upstream_provider** (_str_)
    - **upstream_user_id** (_str_)
    - **email_verified** (_bool_)
    - **pre_registered** (_bool_) – `True` for people who have never signed in.
    - **active** (_bool_)
    - **role** (_str_) – Holders of this role id.
    - **role_scope** (_str_) – `platform` or `tenant`.
    - **created_before**, **created_after** (_str_) – RFC 3339 timestamps.

- **Return Type:** Page[[Principal](#principal)]

### principals.humans.get()

Read one person. A principal of another kind is not found.

- **Parameters:**
  **principal_id** (_str_) – The person's principal id. (required)

- **Return Type:** [Human](#human)

### principals.humans.create()

Pre-register a person by email into a tenant, before their first sign-in. A Platform Administrator, or a Tenant Administrator of the tenant, may call it.

This call sends no invitation and creates no account in your sign-in provider. The person needs an account there that your IT administrator has set up. If that account's verified email address matches, the person's first sign-in with it claims the pre-registered record.

- **Parameters:**
  - **email** (_str_) – The person's email address. (required, keyword)
  - **tenant_id** (_str_) – The tenant to place them in. A deactivated or unknown tenant raises `NotFoundError`. (required, keyword)
  - **display_name** (_str_, _optional_) – Name shown to people. When omitted, it is the given and family names joined. (keyword)
  - **given_name** (_str_, _optional_) – Given name. (keyword)
  - **family_name** (_str_, _optional_) – Family name. (keyword)

- **Return Type:** [Human](#human)

- **Refusals:**
  - `email_taken` – another person already has this email address.
  - `tenant_not_mapped` – the tenant has no organization in your sign-in provider, as a tenant created with [`tenants.create()`](#tenantscreate) does not. For now, ask your IT administrator to add the person ([Adding people to a tenant](../../icbs-install/03-control-plane/10-identity-service/02-Register-Clients-and-Tenants.md#creating-a-tenant-by-hand)).

### principals.humans.update()

Change the email address of a person who has not signed in yet. A Platform Administrator, or a Tenant Administrator of the person's tenant, may call it.

- **Parameters:**
  - **principal_id** (_str_) – The person's principal id. (required)
  - **email** (_str_) – The new email address. (required, keyword)

- **Return Type:** [Human](#human)

- **Refusals:**
  - `already_signed_in` – the person has signed in, so the address can no longer change.
  - `email_taken` – another person already has this email address.

### principals.humans.deactivate()

Take a person out of service. This is the same operation as [`principals.deactivate()`](#principalsdeactivate).

- **Parameters:**
  **principal_id** (_str_) – The person's principal id. (required)

- **Return Type:** [Human](#human)

## Agents

`admin.identity.principals.agents`

An agent has two ids. Reading, updating and deactivating it take its `principal_id`. Its `client_id` is the name it signs in as, and goes into its key file.

For an agent that runs in your own tenant, such as a build server, use the registry's [`create_agent_with_key()`](06-agents.md#create_agent_with_key) instead. It creates the agent's principal and the registry's user record for it in one step. [`principals.agents.create()`](#principalsagentscreate) creates only the principal, and the registry adds the user record when the agent first signs in. Use it to place an agent in another tenant.

### principals.agents.list()

Page through agents.

- **Parameters:**
  - **tenant_id** (_str_, _optional_) – Only agents in this tenant. (keyword)
  - **limit** (_int_, _optional_) – Page size. (keyword)
  - Filters, each keyword and optional, passed to the identity service unchanged:
    - **client_id** (_str_)
    - **username** (_str_)
    - **created_by** (_str_) – The creator's principal id.
    - **active** (_bool_)
    - **role** (_str_) – Holders of this role id.
    - **role_scope** (_str_) – `platform` or `tenant`.
    - **created_before**, **created_after** (_str_) – RFC 3339 timestamps.

- **Return Type:** Page[[Principal](#principal)]

### principals.agents.get()

Read one agent. A principal of another kind is not found.

- **Parameters:**
  **principal_id** (_str_) – The agent's principal id. (required)

- **Return Type:** [Agent](#agent)

### principals.agents.create()

Create an agent and register its first key. A Platform Administrator, or a Tenant Administrator of the tenant, may call it. The person who calls it is recorded as the agent's creator.

- **Parameters:**
  - **client_id** (_str_) – The client id the agent authenticates as. (required, keyword)
  - **key** (_dict_ or _CreateAgentKeyRequest_) – The first key: `key_id` (required), exactly one of `public_key_pem` or `public_key_jwk`, and optionally `name` and `expires_at`. (required, keyword)
  - **tenant_id** (_str_, _optional_) – The tenant to place the agent in. (keyword)
  - **display_name** (_str_, _optional_) – Name shown to people. (keyword)

  The SDK also accepts `username` and `created_by`. Leave both unset: the identity service refuses a request from your script that sets either, with 400 `invalid_request`.

- **Return Type:** [CreatedAgent](#createdagent)

- **Refusals:**
  - `agent_exists` – an agent already has this client id.

`generate_client_keypair()` makes the key pair, and `write_credentials_json()` saves the key file the agent signs in with.

```python
from istari_digital_client import generate_client_keypair

# An agent placed in another tenant
credentials = generate_client_keypair(client_id="partner-sync")
agent = admin.identity.principals.agents.create(
    client_id=credentials.client_id,
    key={"key_id": credentials.key_id, "public_key_pem": credentials.public_key_pem},
    tenant_id=other_tenant.id,
)
credentials.write_credentials_json("partner-sync-key.json")
```

### principals.agents.update()

Change an agent's display name, the only field that can be edited. A Platform Administrator, or a Tenant Administrator of the agent's tenant, may call it.

- **Parameters:**
  - **principal_id** (_str_) – The agent's principal id. (required)
  - **display_name** (_str_) – The new display name. (required, keyword)

  The SDK also accepts `username`. Leave it unset: the identity service refuses a request that sets it, with 400 `invalid_request`.

- **Return Type:** [Agent](#agent)

### principals.agents.deactivate()

Take an agent out of service. This is the same operation as [`principals.deactivate()`](#principalsdeactivate).

- **Parameters:**
  **principal_id** (_str_) – The agent's principal id. (required)

- **Return Type:** [Agent](#agent)

## Keys

`admin.identity.keys`

Who may manage keys:

- A person may manage their own keys.
- A Platform Administrator, or a Tenant Administrator of the principal's tenant, may manage another principal's keys.
- While an agent is in its creator's tenant, the creator may list, read and revoke the agent's keys.
- An agent calling any key method gets `PermissionDeniedError`.

### keys.list()

List a principal's registered keys.

- **Parameters:**
  **principal_id** (_str_, _optional_) – The principal's id, or `"me"` for the caller. Default: `"me"`.

- **Return Type:** [PrincipalKeys](#principalkeys)

### keys.get()

Read one key's metadata.

- **Parameters:**
  - **principal_id** (_str_) – The principal's id. (required)
  - **key_id** (_str_) – The key's id. (required)

- **Return Type:** [KeyMeta](#keymeta)

### keys.register()

Register the public half of a key pair you already hold. Only the public key is sent.

- **Parameters:**
  - **principal_id** (_str_) – The principal's id. (required)
  - **credentials** ([_GeneratedClientCredentials_](#generatedclientcredentials)) – The key pair, for example from `generate_client_keypair()`. (required)
  - **name** (_str_, _optional_) – A label for the key. (keyword)
  - **expires_at** (_str_, _optional_) – When the key expires, as an RFC 3339 timestamp. (keyword)

- **Return Type:** [KeyMeta](#keymeta)

- **Refusals:**
  - `not_signed_in` – the person has not signed in for the first time yet.
  - `duplicate_key_id` – the principal already has a key with this id.

### keys.generate_and_register()

Generate a key pair, register its public half, and return both the credentials and the key's metadata. Save the credentials: the private key exists only in the returned object.

- **Parameters:**
  - **principal_id** (_str_) – The principal's id, or `"me"`. (required)
  - **client_id** (_str_, _optional_) – The client id written into the credentials. Defaults to `principal_id`. For an agent, pass the agent's `client_id`, as the example below does. Required when `principal_id` is `"me"`; `keys.list("me").client_id` gives the caller's. (keyword)
  - **key_id** (_str_, _optional_) – Defaults to a random id. (keyword)
  - **name** (_str_, _optional_) – A label for the key. (keyword)

- **Return Type:** tuple[[GeneratedClientCredentials](#generatedclientcredentials), [KeyMeta](#keymeta)]

- **Refusals:** as for [`keys.register()`](#keysregister).

```python
agent = admin.identity.principals.agents.get("agent-principal-id")
credentials, key = admin.identity.keys.generate_and_register(
    agent.principal_id, client_id=agent.client_id, name="build-server"
)
credentials.write_credentials_json("agent-key.json")
```

### keys.revoke()

Revoke a key.

- **Parameters:**
  - **principal_id** (_str_) – The principal's id. (required)
  - **key_id** (_str_) – The key's id. (required, keyword)

- **Return Type:** None

## Roles

`admin.identity.roles`

Who may grant and revoke roles:

- Only a person may grant or revoke a role.
- A platform-scoped role, such as `admin`: only a Platform Administrator.
- A tenant-scoped role, such as `tenant_admin`: a Platform Administrator, or a Tenant Administrator of that tenant.
- No caller may revoke their own `admin` or `tenant_admin` grant.

The `role` parameters below take a role id. [`roles.list()`](#roleslist) returns the full catalog.

### roles.list()

List the role catalog, all in a single page. Every authenticated, active caller may read it.

- **Return Type:** Page[[Role](#role)]

### roles.holders()

Page through the principals holding a role.

- **Parameters:**
  - **role** (_str_) – The role id. (required)
  - **tenant_id** (_str_, _optional_) – Only grants held in this tenant. This names the tenant the role is held in, not the holder's own tenant. (keyword)
  - **limit** (_int_, _optional_) – Page size. (keyword)

- **Return Type:** Page[[Principal](#principal)]

### roles.list_tenant_roles()

Page through the role grants held in a tenant. A member of the tenant who does not administer it may not list them.

- **Parameters:**
  - **tenant_id** (_str_) – The tenant's id. (required)
  - **limit** (_int_, _optional_) – Page size. (keyword)

- **Return Type:** Page[[RoleAssignment](#roleassignment)]

### roles.grant_tenant_role()

Grant a tenant-scoped role in a tenant. If the principal already holds the role there, the existing grant is returned. For a platform-scoped role, use [`roles.grant_principal_role()`](#rolesgrant_principal_role).

- **Parameters:**
  - **tenant_id** (_str_) – The tenant's id. (required)
  - **role** (_str_) – The role id, for example `tenant_admin`. (required, keyword)
  - **principal_id** (_str_) – The principal receiving the role. (required, keyword)

- **Return Type:** [RoleAssignment](#roleassignment)

- **Refusals:**
  - `inactive_tenant` – the tenant is deactivated.
  - `principal_deactivated` – the principal is deactivated. Activate it first.

### roles.revoke_tenant_role()

Revoke a tenant-scoped grant.

- **Parameters:**
  - **tenant_id** (_str_) – The tenant's id. (required)
  - **role** (_str_) – The role id. (required, keyword)
  - **principal_id** (_str_) – The holder's id. (required, keyword)

- **Return Type:** None

- **Refusals:**
  - 400 `scope_mismatch` – the role is platform-scoped. Use [`roles.revoke_principal_role()`](#rolesrevoke_principal_role).
  - `self_role_revocation` – the caller is revoking their own `tenant_admin` grant.
  - 403 `target_is_platform_admin` – the holder is a Platform Administrator and the caller is not.

### roles.list_principal_roles()

List one principal's role grants, all in a single page. This method does not accept `"me"`; pass `principals.me().actual_instance.principal_id` (see [`principals.me()`](#principalsme)).

- **Parameters:**
  **principal_id** (_str_) – The principal's id. (required)

- **Return Type:** Page[[RoleAssignment](#roleassignment)]

### roles.grant_principal_role()

Grant a role to a principal: a platform-scoped role such as `admin`, or a tenant-scoped role in one tenant. If the principal already holds the role, the existing grant is returned.

- **Parameters:**
  - **principal_id** (_str_) – The principal's id. (required)
  - **role** (_str_) – The role id. (required, keyword)
  - **tenant_id** (_str_, _optional_) – The tenant a tenant-scoped role applies in. Omit it for a platform-scoped role. (keyword)

- **Return Type:** [RoleAssignment](#roleassignment)

- **Refusals:**
  - `inactive_tenant` – the tenant is deactivated.
  - `principal_deactivated` – the principal is deactivated. Activate it first.

### roles.revoke_principal_role()

Revoke one of a principal's grants. The grant is marked revoked, not deleted.

- **Parameters:**
  - **principal_id** (_str_) – The principal's id. (required)
  - **role** (_str_) – The role id. (required, keyword)
  - **tenant_id** (_str_, _optional_) – The tenant of a tenant-scoped grant. Omit it for a platform-scoped grant. (keyword)

- **Return Type:** None

- **Refusals:**
  - `last_administrator` – no active human Platform Administrator would remain.
  - `self_role_revocation` – the caller is revoking their own `admin` or `tenant_admin` grant.
  - 403 `target_is_platform_admin` – the principal is a Platform Administrator and the caller is not.

## OAuth

`admin.identity.oauth`

### oauth.issue_token()

Request a v2 token from the identity service. The client fetches and refreshes its own tokens, so most scripts never call this.

Each grant type does one job:

- `client_credentials` authenticates a principal with a client assertion signed by its registered key.
- `authorization_code` completes a browser sign-in. The SDK has no method for the redirect that starts one.
- `refresh_token` renews a token.

- **Parameters:**
  - **grant_type** (_str_) – One of the grant types above. Default: `client_credentials`. (keyword)
  - **client_assertion** (_str_, _optional_) – For `client_credentials`: a JWT signed with the principal's registered key. Its issuer and subject are the client id, and its audience is the token endpoint. (keyword)
  - **client_assertion_type** (_str_) – Default: `urn:ietf:params:oauth:client-assertion-type:jwt-bearer`. (keyword)
  - **code** (_str_, _optional_) – For `authorization_code`: the code from the callback redirect. (keyword)
  - **redirect_uri** (_str_, _optional_) – For `authorization_code`: the same redirect URI the sign-in started with. (keyword)
  - **refresh_token** (_str_, _optional_) – For `refresh_token`. (keyword)

- **Return Type:** [Token](#token)

### oauth.introspect()

Report whether a token is active, and whom it was issued to. Only Istari's own platform services may call it; a script's call is refused. An invalid token returns `active=False` rather than an error.

- **Parameters:**
  - **token** (_str_) – The token to introspect. (required)
  - **client_assertion** (_str_) – The platform service's client assertion. Its audience is the identity service base URL, not the introspection endpoint. (required, keyword)
  - **client_assertion_type** (_str_) – Default: `urn:ietf:params:oauth:client-assertion-type:jwt-bearer`. (keyword)

- **Return Type:** [Introspection](#introspection)

## Deprecated v1 key methods

The SDK's key methods written for the identity service's v1 API are deprecated, like the v1 key routes themselves. They still work whatever `identity_api_version` the `Configuration` sets, and are scheduled for removal with no date set.

| Deprecated                                                              | Replacement                                                                                                   |
| ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| `admin.keys.register()`, `register_key()`                               | `admin.identity.keys.register()`                                                                              |
| `admin.keys.generate_and_register()`, `generate_keypair_and_register()` | `admin.identity.keys.generate_and_register()`                                                                 |
| `admin.keys.list()`, `list_keys()`                                      | `admin.identity.keys.list()`                                                                                  |
| `admin.keys.get()`, `get_key()`                                         | `admin.identity.keys.get()`                                                                                   |
| `admin.keys.revoke()`, `revoke_key()`                                   | `admin.identity.keys.revoke()`                                                                                |
| `exchange_pat()`, `generate_keypair_and_exchange()`                     | None: v2 has no personal access token exchange. Download a key from the web app; see [Setup](../01-setup.md). |

`admin.keys.generate_keypair()` sends no request and is not deprecated.

The deprecated methods appear in up to three places, which share the routing and warnings below:

- `admin.keys` on `IstariAdmin`, named in the table's first column.
- `client.keys` on `Client` and `V3Client`. [Keys](14-keys.md) documents its methods and parameters.
- The functions in `istari_digital_client.identity.v1`, such as `register_key()` and `exchange_pat()`.

### How the deprecated methods route

You do not need to set `identity_api_version`, or the methods' own `api_version` argument, to use these methods. In this section, `"auto"`, `"v1"` and `"v2"` are values of the `api_version` argument. It takes `"auto"` (the default, which `None` also means), `"v1"` or `"v2"`, as a string or an `IdentityApiVersion` member. Any other value raises `ConfigurationError`.

**PAT exchange** authenticates with the personal access token itself, and ignores `identity_api_version` and its environment variable, `ISTARI_IDENTITY_API_VERSION`. It uses the v1 route under `"auto"` and `"v1"`. Under `"v2"` it raises `ConfigurationError` before any request.

**Key management** under `"auto"` uses the API that its identity service client resolves to. For `client.keys`, that client is built from the `Configuration`. For `admin.keys` and the `istari_digital_client.identity.v1` functions, it is the identity service client you pass as their `ir_client` argument.

- **On v1**, the call uses the v1 routes.
- **On v2**, the call first looks up the principal id, unless it is `"me"`, so that ids that worked against v1 keep working. It looks for an agent with that `client_id`, or a person with that `upstream_user_id`. The result picks the route:

  | Principal id                                                             | Route                                        |
  | ------------------------------------------------------------------------ | -------------------------------------------- |
  | `"me"`                                                                   | v2 key routes                                |
  | An id the lookup resolves to one principal                               | v2 key routes                                |
  | A hyphenated UUID that matches no principal                              | v2 key routes, taking it as the principal id |
  | Any other id that matches no principal                                   | v1 routes, with the id unchanged             |
  | An id that matches several principals                                    | v1 routes, with the id unchanged             |
  | An id whose lookup is refused with 403                                   | v1 routes, with the id unchanged             |
  | An id that matches a person's `upstream_user_id` but not their client id | v1 routes, with the id unchanged             |
  | An id whose lookup fails any other way                                   | `KeyRegistrationError`, not retried on v1    |
  | Any id, when a v2 key route answers 404                                  | `KeyRegistrationError`, not retried on v1    |

- **Calls v2 cannot express** go to v1: a register call with `username` or `display_name`, and `"me"` with `kind=AGENT`. `kind` is the deprecated methods' principal-kind argument. `client.keys` rejects the second case with `ValueError`.

Results have the v1 types, whichever route serves the call.

The explicit values override this:

- **`"v1"`** always uses the v1 routes.
- **`"v2"`** never falls back to v1:
  - A call v2 cannot express raises `ConfigurationError` before any request.
  - An id that is not a UUID and matches no principal the caller may see raises `KeyRegistrationError` with code `principal_not_found`. So does an id that matches a person's `upstream_user_id` but not their client id.
  - An id that matches several principals raises `KeyRegistrationError` with code `principal_ambiguous`.

Two warnings tell you that a call used v1:

- **`DeprecationWarning`**: the first time each method reaches a v1 route in a process. It names the method's replacement, if it has one.
- **A `logging` warning**: under `"auto"` with v2 in force, on every call that v2 cannot express.

An unknown `kind` raises an error before any request:

- the key-management methods raise `KeyRegistrationError`
- PAT exchange raises `ExchangePatError`, or `ConfigurationError` under `"v2"`

To handle a `ConfigurationError` from `client.keys` or the `istari_digital_client.identity.v1` functions, catch `ValueError`. They raise the `ConfigurationError` defined in `istari_digital_client.legacy.configuration`, which `except istari_digital_client.ConfigurationError` does not catch. Both classes subclass `ValueError`.

## Data types

The types below are in `istari_digital_client.identity.v2.models`. Timestamps are RFC 3339 strings unless the type is _datetime_.

### Tenant

Returned by the [tenant methods](#tenants).

| Attribute      | Type       | Description                                              |
| -------------- | ---------- | -------------------------------------------------------- |
| `id`           | _str_      | Tenant id                                                |
| `slug`         | _str_      | Permanent handle                                         |
| `display_name` | _str_      | Name shown to people                                     |
| `description`  | _str_      | Free-text description                                    |
| `active`       | _bool_     | Whether the tenant is in service                         |
| `is_default`   | _bool_     | Whether this is the default tenant                       |
| `member_count` | _int_      | People with a granted membership; agents are not counted |
| `created_at`   | _datetime_ | When the tenant was created                              |
| `updated_at`   | _datetime_ | When the tenant was last changed                         |

### TenantDeactivation

Returned by [`tenants.deactivate()`](#tenantsdeactivate). Every [Tenant](#tenant) attribute, plus:

| Attribute               | Type          | Description                                                                 |
| ----------------------- | ------------- | --------------------------------------------------------------------------- |
| `default_reassigned_to` | _str_ or None | The tenant that became the default, when this tenant was the default before |

### Membership

Returned by the [membership methods](#memberships).

| Attribute      | Type                    | Description                            |
| -------------- | ----------------------- | -------------------------------------- |
| `tenant_id`    | _str_                   | The tenant                             |
| `principal_id` | _str_                   | The member                             |
| `principal`    | [Principal](#principal) | The member's principal record          |
| `status`       | _str_                   | `granted` or `revoked`                 |
| `granted_at`   | _str_                   | When the membership was granted        |
| `revoked_at`   | _str_ or None           | When it was revoked; `None` if granted |

### Principal

A wrapper over one [Human](#human), [Agent](#agent) or [PlatformService](#platformservice). The wrapper has no record fields of its own: read them from `actual_instance`, for example `principal.actual_instance.kind`.

Every kind of record, read through `actual_instance`, has these attributes:

| Attribute          | Type                                            | Description                                 |
| ------------------ | ----------------------------------------------- | ------------------------------------------- |
| `principal_id`     | _str_                                           | Principal id                                |
| `kind`             | _str_                                           | `human`, `agent` or `platform_service`      |
| `active`           | _bool_                                          | Whether the principal is in service         |
| `tenancy`          | List[[TenancyEntry](#tenancyentry)] or None     | The tenant the principal belongs to, if any |
| `role_assignments` | List[[RoleAssignment](#roleassignment)] or None | The principal's role grants                 |
| `created_at`       | _str_                                           | When the principal was created              |
| `updated_at`       | _str_                                           | When the principal was last changed         |

### Human

A person. Every attribute common to [Principal](#principal) records, plus:

| Attribute            | Type               | Description                                                       |
| -------------------- | ------------------ | ----------------------------------------------------------------- |
| `email`              | _str_              | Email address                                                     |
| `email_verified`     | _bool_             | Whether the sign-in provider has verified the address             |
| `display_name`       | _str_              | Name shown to people                                              |
| `upstream_provider`  | _str_              | The sign-in provider                                              |
| `upstream_tenant_id` | _str_              | The id of the person's organization at the sign-in provider       |
| `upstream_user_id`   | _str_              | The person's id at the sign-in provider; empty until they sign in |
| `last_login_at`      | _datetime_ or None | Last sign-in; `None` until the first                              |

### Agent

An agent. Every attribute common to [Principal](#principal) records, plus:

| Attribute      | Type          | Description                                        |
| -------------- | ------------- | -------------------------------------------------- |
| `client_id`    | _str_         | The client id the agent authenticates as           |
| `username`     | _str_         | Username                                           |
| `display_name` | _str_         | Name shown to people                               |
| `created_by`   | _str_ or None | The creator's principal id; `None` if not recorded |

### CreatedAgent

Returned by [`principals.agents.create()`](#principalsagentscreate). Every [Agent](#agent) attribute, plus:

| Attribute | Type                | Description                      |
| --------- | ------------------- | -------------------------------- |
| `key`     | [KeyMeta](#keymeta) | The key registered for the agent |

### PlatformService

One of Istari's own components, such as the registry. Every attribute common to [Principal](#principal) records, plus `client_id`, `client_type`, `component` and `redirect_uris`.

### TenancyEntry

| Attribute     | Type  | Description       |
| ------------- | ----- | ----------------- |
| `tenant_id`   | _str_ | The tenant's id   |
| `tenant_slug` | _str_ | The tenant's slug |

### PrincipalBatch

Returned by [`principals.resolve()`](#principalsresolve).

| Attribute | Type                          | Description                                    |
| --------- | ----------------------------- | ---------------------------------------------- |
| `items`   | List[[Principal](#principal)] | The principals found and visible to the caller |

### Role

Returned by [`roles.list()`](#roleslist).

| Attribute      | Type      | Description                                |
| -------------- | --------- | ------------------------------------------ |
| `id`           | _str_     | Role id, such as `admin` or `tenant_admin` |
| `display_name` | _str_     | Name shown to people                       |
| `description`  | _str_     | What the role allows                       |
| `scope`        | _str_     | `platform` or `tenant`                     |
| `holder_kinds` | List[str] | The principal kinds that may hold the role |

### RoleAssignment

One role grant.

| Attribute      | Type          | Description                                                                                     |
| -------------- | ------------- | ----------------------------------------------------------------------------------------------- |
| `principal_id` | _str_         | The holder                                                                                      |
| `role_id`      | _str_         | The role                                                                                        |
| `scope`        | _str_         | `platform` or `tenant`                                                                          |
| `tenant_id`    | _str_ or None | The tenant of a tenant-scoped grant                                                             |
| `source`       | _str_         | `native` if granted in the identity service, `imported` if brought in from the sign-in provider |
| `granted_at`   | _str_         | When the role was granted                                                                       |

### KeyMeta

A registered key's metadata. The identity service never returns key material.

| Attribute    | Type  | Description                 |
| ------------ | ----- | --------------------------- |
| `key_id`     | _str_ | Key id                      |
| `name`       | _str_ | Label                       |
| `algorithm`  | _str_ | Signing algorithm           |
| `created_at` | _str_ | When the key was registered |
| `expires_at` | _str_ | When the key expires        |

### PrincipalKeys

Returned by [`keys.list()`](#keyslist).

| Attribute      | Type                      | Description                     |
| -------------- | ------------------------- | ------------------------------- |
| `principal_id` | _str_                     | The principal                   |
| `client_id`    | _str_                     | The principal's client id       |
| `tenant_id`    | _str_                     | The principal's tenant          |
| `active`       | _bool_                    | Whether the principal is active |
| `keys`         | List[[KeyMeta](#keymeta)] | The registered keys             |

### GeneratedClientCredentials

A generated key pair, from `istari_digital_client.GeneratedClientCredentials`. The private key is left out of `repr()` and string output.

| Attribute         | Type  | Description                    |
| ----------------- | ----- | ------------------------------ |
| `client_id`       | _str_ | The client id the key signs as |
| `key_id`          | _str_ | Key id                         |
| `public_key_pem`  | _str_ | Public key, PEM-encoded        |
| `private_key_pem` | _str_ | Private key, PEM-encoded       |

`write_credentials_json(path)` writes the credentials as a key file that `identity_service_secret_file` accepts.

### Token

Returned by [`oauth.issue_token()`](#oauthissue_token).

| Attribute       | Type          | Description                                           |
| --------------- | ------------- | ----------------------------------------------------- |
| `access_token`  | _str_         | The identity service JWT                              |
| `token_type`    | _str_         | Token type                                            |
| `expires_in`    | _int_         | Seconds until `access_token` expires                  |
| `refresh_token` | _str_ or None | Present when a session backs the sign-in              |
| `id_token`      | _str_ or None | The same JWT as `access_token`; browser sign-ins only |

### Introspection

Returned by [`oauth.introspect()`](#oauthintrospect).

| Attribute        | Type              | Description                                           |
| ---------------- | ----------------- | ----------------------------------------------------- |
| `active`         | _bool_            | Whether the token is valid                            |
| `principal_id`   | _str_ or None     | The token's principal                                 |
| `principal_kind` | _str_ or None     | The principal's kind                                  |
| `client_id`      | _str_ or None     | The OAuth client the token was issued to              |
| `tenant_id`      | _str_ or None     | The acting tenant; absent on a platform-service token |
| `tenant_slug`    | _str_ or None     | The acting tenant's slug                              |
| `tenant_roles`   | List[str] or None | Roles held in the acting tenant                       |
| `platform_roles` | List[str] or None | Platform-scoped roles                                 |


---

<!-- Source: api_reference/models/access.md -->

---
slug: /build/python/api_reference/models/access
sidebar_label: "Access control"
---

# Access control

Data types for permissions, access relationships, and control tags.

:::info
All data types support standard serialization methods (`to_json`, `from_json`, `to_dict`, `from_dict`, `to_str`) which are omitted from the tables below.
:::

## AccessRelation

PUBLIC: Relation types that can be assigned between a subject and a resource by a user of Istari.

**Attributes:**

| Name                    | Type | Description |
| ----------------------- | ---- | ----------- |
| VIEWER                  | —    |             |
| EDITOR                  | —    |             |
| OWNER                   | —    |             |
| ADMINISTRATOR           | —    |             |
| EXECUTOR                | —    |             |
| UPSTREAMREMOTEOWNER     | —    |             |
| UPSTREAMREMOTEEDITOWNER | —    |             |

## AccessRelationship

PUBLIC: An access relationship that can be viewed/modified by a user of Istari.

**Attributes:**

| Name          | Type                                      | Description |
| ------------- | ----------------------------------------- | ----------- |
| subject_type  | [AccessSubjectType](#accesssubjecttype)   |             |
| subject_id    | str                                       |             |
| relation      | [AccessRelation](#accessrelation)         |             |
| resource_type | [AccessResourceType](#accessresourcetype) |             |
| resource_id   | str                                       |             |
| subject_info  | Optional[[SubjectInfo](#subjectinfo) ]    |             |

## AccessResourceType

Public: permission resource types that can the the target of API / UI user role assignments.

**Attributes:**

| Name               | Type | Description |
| ------------------ | ---- | ----------- |
| MODEL              | —    |             |
| ARTIFACT           | —    |             |
| RESOURCE           | —    |             |
| JOB                | —    |             |
| FILE               | —    |             |
| FILEREVISION       | —    |             |
| TOOL               | —    |             |
| FUNCTION           | —    |             |
| FUNCTIONVERSION    | —    |             |
| TENANT             | —    |             |
| SYSTEM             | —    |             |
| FUNCTIONAUTHSECRET | —    |             |
| AUTHINTEGRATION    | —    |             |
| DOCUMENT           | —    |             |

## AccessSubjectType

Public: permission subject types that can be the subject of access role assignment in UI / API.

**Attributes:**

| Name | Type | Description |
| ---- | ---- | ----------- |
| USER | —    |             |

## Permission

Permission types defined in permissions schema.

**Attributes:**

| Name                       | Type | Description |
| -------------------------- | ---- | ----------- |
| MEMBER                     | —    |             |
| MANAGE                     | —    |             |
| VIEW                       | —    |             |
| EDIT                       | —    |             |
| EXECUTE                    | —    |             |
| ARCHIVE                    | —    |             |
| TENANT_ACCESS              | —    |             |
| CONTROLTAG_ACCESS          | —    |             |
| CONTROLTAG_MANAGE          | —    |             |
| INFOSECLEVEL_ACCESS        | —    |             |
| INFOSECLEVEL_MANAGE        | —    |             |
| ACCESS_OWN_MANAGE          | —    |             |
| ACCESS_ADMINISTRATE_MANAGE | —    |             |
| ACCESS_EDIT_MANAGE         | —    |             |
| ACCESS_VIEW_MANAGE         | —    |             |
| ACCESS                     | —    |             |

## PermissionResourceType

INTERNAL: Resource types that can have permissions assigned to them.

**Attributes:**

| Name               | Type | Description |
| ------------------ | ---- | ----------- |
| MODEL              | —    |             |
| AGENT              | —    |             |
| AGENTPOOL          | —    |             |
| ARTIFACT           | —    |             |
| FILE               | —    |             |
| COMMENT            | —    |             |
| FILEREVISION       | —    |             |
| TOKEN              | —    |             |
| JOB                | —    |             |
| TOOL               | —    |             |
| FUNCTION           | —    |             |
| FUNCTIONVERSION    | —    |             |
| SYSTEM             | —    |             |
| TENANT             | —    |             |
| CONTROLTAG         | —    |             |
| INFOSECLEVEL       | —    |             |
| FUNCTIONAUTHSECRET | —    |             |
| UPSTREAMREMOTE     | —    |             |
| AUTHINTEGRATION    | —    |             |
| DOCUMENT           | —    |             |
| RESOURCE           | —    |             |
| WORKFLOW_OUTPUT    | —    |             |

## PermissionSubjectType

INTERNAL: Subject types that can have permissions assigned to them.

**Attributes:**

| Name               | Type | Description |
| ------------------ | ---- | ----------- |
| USER               | —    |             |
| MODEL              | —    |             |
| AGENT              | —    |             |
| AGENTPOOL          | —    |             |
| ARTIFACT           | —    |             |
| FILE               | —    |             |
| COMMENT            | —    |             |
| FILEREVISION       | —    |             |
| TOKEN              | —    |             |
| JOB                | —    |             |
| TOOL               | —    |             |
| FUNCTION           | —    |             |
| FUNCTIONVERSION    | —    |             |
| SYSTEM             | —    |             |
| TENANT             | —    |             |
| CONTROLTAG         | —    |             |
| INFOSECLEVEL       | —    |             |
| FUNCTIONAUTHSECRET | —    |             |
| AUTHINTEGRATION    | —    |             |
| UPSTREAMREMOTE     | —    |             |
| DOCUMENT           | —    |             |
| RESOURCE           | —    |             |
| WORKFLOW_OUTPUT    | —    |             |

## Permissionship

**Attributes:**

| Name          | Type                                              | Description |
| ------------- | ------------------------------------------------- | ----------- |
| subject_type  | [PermissionSubjectType](#permissionsubjecttype)   |             |
| subject_id    | str                                               |             |
| permission    | [Permission](#permission)                         |             |
| resource_type | [PermissionResourceType](#permissionresourcetype) |             |
| resource_id   | str                                               |             |

## ControlTag

A control (essentially a tag) that is assigned to resource, files, and users. To have access to a resource or file that has one or more controls assigned, the user must have been assigned all the controls applied to the item.

**Attributes:**

| Name                 | Type                                                          | Description |
| -------------------- | ------------------------------------------------------------- | ----------- |
| id                   | str                                                           |             |
| created              | datetime.datetime                                             |             |
| created_by_id        | str                                                           |             |
| name                 | str                                                           |             |
| status               | [ControlTagStatus](#controltagstatus)                         |             |
| description          | Optional[str]                                                 |             |
| display_color        | Optional[str]                                                 |             |
| upstream_remote_info | Optional[[UpstreamRemoteInfo](systems.md#upstreamremoteinfo)] |             |

## ControlTagRevision

A control (essentially a tag) that is assigned to resource, files, and users. To have access to a resource or file that has one or more controls assigned, the user must have been assigned all the controls applied to the item.

**Attributes:**

| Name           | Type                                  | Description |
| -------------- | ------------------------------------- | ----------- |
| id             | str                                   |             |
| created        | datetime.datetime                     |             |
| created_by_id  | str                                   |             |
| control_tag_id | str                                   |             |
| name           | str                                   |             |
| status         | [ControlTagStatus](#controltagstatus) |             |
| description    | Optional[str]                         |             |
| display_color  | Optional[str]                         |             |

## ControlTagStatus

**Attributes:**

| Name     | Type | Description |
| -------- | ---- | ----------- |
| ARCHIVED | —    |             |
| ACTIVE   | —    |             |

## ControlTaggingObjectType

**Attributes:**

| Name     | Type | Description |
| -------- | ---- | ----------- |
| MODEL    | —    |             |
| ARTIFACT | —    |             |
| FILE     | —    |             |
| USER     | —    |             |
| SYSTEM   | —    |             |
| RESOURCE | —    |             |
| UNKNOWN  | —    |             |

## ControlTaggingStatus

**Attributes:**

| Name     | Type | Description |
| -------- | ---- | ----------- |
| ARCHIVED | —    |             |
| ACTIVE   | —    |             |

## NewControlTag

Add a new control with optional description and display color.

**Attributes:**

| Name          | Type                                                                       | Description |
| ------------- | -------------------------------------------------------------------------- | ----------- |
| name          | str                                                                        |             |
| description   | Optional[Annotated[str, Field(min_length=0, strict=True, max_length=255)]] |             |
| display_color | Optional[str]                                                              |             |

## UpdateControlTag

Update an existing control.

**Attributes:**

| Name          | Type                                                                       | Description |
| ------------- | -------------------------------------------------------------------------- | ----------- |
| id            | str                                                                        |             |
| name          | Optional[str]                                                              |             |
| description   | Optional[Annotated[str, Field(min_length=0, strict=True, max_length=255)]] |             |
| status        | Optional[[ControlTagStatus](#controltagstatus)]                            |             |
| display_color | Optional[str]                                                              |             |

## BulkSharingAccessRelation

Access relation types for resource bulk sharing operations. This enum contains only the access relations needed for bulk sharing to avoid circular import issues with the permission module.

**Attributes:**

| Name   | Type | Description |
| ------ | ---- | ----------- |
| VIEWER | —    |             |
| EDITOR | —    |             |

## UpdateAccessRelationship

**Attributes:**

| Name     | Type                              | Description |
| -------- | --------------------------------- | ----------- |
| relation | [AccessRelation](#accessrelation) |             |

## UpdateAccessRelationshipList

**Attributes:**

| Name      | Type                                                                        | Description |
| --------- | --------------------------------------------------------------------------- | ----------- |
| resources | List[[UpdateAccessRelationshipListItem](#updateaccessrelationshiplistitem)] |             |

## UpdateAccessRelationshipListItem

**Attributes:**

| Name        | Type                              | Description |
| ----------- | --------------------------------- | ----------- |
| relation    | [AccessRelation](#accessrelation) |             |
| resource_id | str                               |             |

## ResourceControlTagging

A control assignment on a resource.

**Attributes:**

| Name                       | Type                                                            | Description |
| -------------------------- | --------------------------------------------------------------- | ----------- |
| id                         | str                                                             |             |
| created                    | datetime.datetime                                               |             |
| created_by_id              | str                                                             |             |
| control_tag                | [ControlTag](#controltag)                                       |             |
| status                     | [ControlTaggingStatus](#controltaggingstatus)                   |             |
| reason                     | Optional[str]                                                   |             |
| object_type                | [ControlTaggingObjectType](#controltaggingobjecttype)           |             |
| object_id                  | str                                                             |             |
| inherited_from_object_id   | Optional[str]                                                   |             |
| inherited_from_object_type | Optional[[ControlTaggingObjectType](#controltaggingobjecttype)] |             |

## UserControlTagging

A control assignment to a user.

**Attributes:**

| Name          | Type                                          | Description |
| ------------- | --------------------------------------------- | ----------- |
| id            | str                                           |             |
| created       | datetime.datetime                             |             |
| created_by_id | str                                           |             |
| control_tag   | [ControlTag](#controltag)                     |             |
| status        | [ControlTaggingStatus](#controltaggingstatus) |             |
| reason        | Optional[str]                                 |             |
| user_id       | str                                           |             |

## SubjectInfo

**Attributes:**

| Name              | Type           | Description |
| ----------------- | -------------- | ----------- |
| username          | Optional[str]  |             |
| email             | Optional[str]  |             |
| cross_tenant_user | Optional[bool] |             |


---

<!-- Source: api_reference/models/admin.md -->

---
slug: /build/python/api_reference/models/admin
sidebar_label: "Users, tokens & admin"
---

# Users, tokens & admin

Data types for users, tokens, integrations, tenants, uploads, and health checks.

:::info
All data types support standard serialization methods (`to_json`, `from_json`, `to_dict`, `from_dict`, `to_str`) which are omitted from the tables below.
:::

## User

User Dataclass that combines info from UserEntity and UserInfo.

On installations with [tenant management](../16-identity.md#tenant-management), `user_name`, `display_name` and `email` come from the identity service rather than Zitadel.

**Attributes:**

| Name                   | Type                                               | Description |
| ---------------------- | -------------------------------------------------- | ----------- |
| id                     | str                                                |             |
| created                | datetime.datetime                                  |             |
| provider_name          | str                                                |             |
| provider_user_id       | str                                                |             |
| user_type              | [UserType](#usertype)                              |             |
| personal_access_tokens | List[[PersonalAccessToken](#personalaccesstoken)]  |             |
| provider_user_state    | Optional[[UserState](#userstate)]                  |             |
| user_name              | Optional[str]                                      |             |
| display_name           | Optional[str]                                      |             |
| first_name             | Optional[str]                                      |             |
| last_name              | Optional[str]                                      |             |
| email                  | Optional[str]                                      |             |
| machine_name           | Optional[str]                                      |             |
| machine_description    | Optional[str]                                      |             |
| control_tags           | Optional[List[[ControlTag](access.md#controltag)]] |             |
| provider_tenant_id     | Optional[str]                                      |             |
| tenant_id              | Optional[str]                                      |             |

## UserType

**Attributes:**

| Name  | Type | Description |
| ----- | ---- | ----------- |
| HUMAN | —    |             |
| AGENT | —    |             |
| ALL   | —    |             |

## UserState

Enum of all the possible states of a user account (from Zitadel).

On installations with [tenant management](../16-identity.md#tenant-management), only `USER_STATE_ACTIVE` and `USER_STATE_INACTIVE` occur. They show whether the person's [principal](../16-identity.md#principals) is active. On other installations, the state is the Zitadel account state, and any value below can occur.

**Attributes:**

| Name                   | Type | Description |
| ---------------------- | ---- | ----------- |
| USER_STATE_ACTIVE      | —    |             |
| USER_STATE_INACTIVE    | —    |             |
| USER_STATE_DELETED     | —    |             |
| USER_STATE_LOCKED      | —    |             |
| USER_STATE_SUSPEND     | —    |             |
| USER_STATE_INITIAL     | —    |             |
| USER_STATE_UNSPECIFIED | —    |             |

## UserStateOption

Enum for user state options.

**Attributes:**

| Name   | Type | Description |
| ------ | ---- | ----------- |
| ACTIVE | —    |             |
| ALL    | —    |             |

## ZitadelUserState

Enum of all the possible states of a user account (from Zitadel).

**Attributes:**

| Name                   | Type | Description |
| ---------------------- | ---- | ----------- |
| USER_STATE_ACTIVE      | —    |             |
| USER_STATE_INACTIVE    | —    |             |
| USER_STATE_DELETED     | —    |             |
| USER_STATE_LOCKED      | —    |             |
| USER_STATE_SUSPEND     | —    |             |
| USER_STATE_INITIAL     | —    |             |
| USER_STATE_UNSPECIFIED | —    |             |

## PersonalAccessToken

Class representing a personal access token object. This class is used to store information about personal access tokens, such as the token ID and the token name. Attributes ———- machine_user_id (str): The machine user ID. token (str): The token. token_id (str): The token ID. name (str): The token name. user_type (enum): The type of the user whose permissions the token grants. created_by_id (UUID): The user mapping ID of the user who created the token.

**Attributes:**

| Name            | Type                                                        | Description |
| --------------- | ----------------------------------------------------------- | ----------- |
| id              | str                                                         |             |
| created         | datetime.datetime                                           |             |
| machine_user_id | str                                                         |             |
| token           | str                                                         |             |
| token_id        | str                                                         |             |
| name            | str                                                         |             |
| user_type       | [PersonalAccessTokenUserType](#personalaccesstokenusertype) |             |
| created_by_id   | str                                                         |             |

## PersonalAccessTokenUserType

**Attributes:**

| Name  | Type | Description |
| ----- | ---- | ----------- |
| HUMAN | —    |             |
| AGENT | —    |             |

## Token

Represents a cryptographic token used for verifying the integrity of binary content.

**Attributes:**

| Name          | Type              | Description |
| ------------- | ----------------- | ----------- |
| id            | str               |             |
| created       | datetime.datetime |             |
| sha           | str               |             |
| salt          | str               |             |
| created_by_id | Optional[str]     |             |

**Methods:**

| Name               | Description                                                        |
| ------------------ | ------------------------------------------------------------------ |
| from_storage_token | Create a `Token` instance from a core `istari_digital_core.Token`. |
| compare_token      | Verify the integrity of a token against a given binary payload.    |
| from_bytes         | Create a token from a byte string and an optional salt.            |

## TokenWithProperties

`Token` is a subclass of `Base` and represents a token used to store file information.

**Attributes:**

| Name                | Type                                                | Description |
| ------------------- | --------------------------------------------------- | ----------- |
| id                  | str                                                 |             |
| created             | datetime.datetime                                   |             |
| sha                 | str                                                 |             |
| salt                | str                                                 |             |
| name                | str                                                 |             |
| extension           | str                                                 |             |
| size                | int                                                 |             |
| description         | Optional[str]                                       |             |
| mime                | Optional[str]                                       |             |
| version_name        | Optional[str]                                       |             |
| external_identifier | Optional[str]                                       |             |
| display_name        | Optional[str]                                       |             |
| object_store_sha    | Optional[[ObjectStoreSha](files.md#objectstoresha)] |             |

## AuthIntegration

A class representing an Auth Integration.

**Attributes:**

| Name                   | Type                                                           | Description |
| ---------------------- | -------------------------------------------------------------- | ----------- |
| id                     | str                                                            |             |
| created                | datetime.datetime                                              |             |
| file                   | [File](files.md#file)                                          |             |
| comments               | List[[Comment](files.md#comment)]                              |             |
| archive_status_history | List[[ResourceArchiveStatus](common.md#resourcearchivestatus)] |             |
| created_by_id          | str                                                            |             |
| auth_integration_type  | [AuthIntegrationType](#authintegrationtype)                    |             |
| auth_type              | [FunctionAuthType](agents.md#functionauthtype)                 |             |
| app_integration_id     | Optional[str]                                                  |             |

## AuthIntegrationType

**Attributes:**

| Name                 | Type | Description |
| -------------------- | ---- | ----------- |
| GOOGLE_ACCOUNTS      | —    |             |
| WINDCHILL            | —    |             |
| TEAMWORK_CLOUD       | —    |             |
| DASSAULT_3D_PASSPORT | —    |             |
| PING_ID              | —    |             |
| MICROSOFT_ENTRA      | —    |             |

## AuthIntegrationUpdate

A class representing a New Auth Integration.

**Attributes:**

| Name                  | Type                                                     | Description |
| --------------------- | -------------------------------------------------------- | ----------- |
| auth_integration_type | Optional[[AuthIntegrationType](#authintegrationtype)]    |             |
| auth_type             | Optional[[FunctionAuthType](agents.md#functionauthtype)] |             |
| revision              | Optional[[FileRevision](files.md#filerevision)]          |             |

## DataIntegration

A class representing a Foreign Data Host.

**Attributes:**

| Name                 | Type                                                | Description |
| -------------------- | --------------------------------------------------- | ----------- |
| id                   | str                                                 |             |
| created              | datetime.datetime                                   |             |
| created_by_id        | str                                                 |             |
| name                 | str                                                 |             |
| integration_type     | [IntegrationType](#integrationtype)                 |             |
| tenant_id            | Optional[str]                                       |             |
| auth_integration_ids | Optional[List[[AuthIntegration](#authintegration)]] |             |

## IntegrationType

**Attributes:**

| Name                   | Type | Description |
| ---------------------- | ---- | ----------- |
| GOOGLE_DRIVE           | —    |             |
| TEAMWORK_CLOUD         | —    |             |
| WINDCHILL              | —    |             |
| DASSAULT_3D_EXPERIENCE | —    |             |
| MICROSOFT_365          | —    |             |

## NewAuthIntegration

A class representing a New Auth Integration.

**Attributes:**

| Name                  | Type                                           | Description |
| --------------------- | ---------------------------------------------- | ----------- |
| auth_integration_type | [AuthIntegrationType](#authintegrationtype)    |             |
| auth_type             | [FunctionAuthType](agents.md#functionauthtype) |             |
| revision              | [FileRevision](files.md#filerevision)          |             |
| app_integration_id    | Optional[str]                                  |             |

## NewDataIntegration

**Attributes:**

| Name             | Type                                | Description |
| ---------------- | ----------------------------------- | ----------- |
| name             | str                                 |             |
| integration_type | [IntegrationType](#integrationtype) |             |

## TenantPublicKey

Class representing a tenant public key object. This class is used to store information about tenant public keys. Attributes ———- tenant_id (UUID): The tenant id. public_key (str): The public key.

**Attributes:**

| Name          | Type              | Description |
| ------------- | ----------------- | ----------- |
| id            | str               |             |
| created       | datetime.datetime |             |
| created_by_id | str               |             |
| tenant_id     | str               |             |
| public_key    | str               |             |

## Tenant

Class representing a tenant object. This class is used to store information about tenants, combining what’s stored in the registry and what’s stored in the authn provider. Attributes ———- provider_tenant_id (str): The provider’s tenant id. provider_name (str): The provider’s name/type (e.g. Zitadel or Okta). name (str): The tenant name (comes from ProviderTenant object). state (str): The tenant state (comes from ProviderTenant object). primary_domain (str): The primary domain used by the tenant (comes from ProviderTenant object). object_store_id (UUID): The object store id associated with the tenant. If None the default object store is used.

On installations with [tenant management](../16-identity.md#tenant-management), the identity service owns tenants and their names; manage them with [`admin.identity.tenants`](../16-identity.md#tenants). The registry's copy differs:

- A tenant deactivated with [`tenants.deactivate()`](../16-identity.md#tenantsdeactivate) still reads as active.
- `name` is the sign-in provider organization's name.
- A single-tenant read leaves `primary_domain` empty.

The identity service's own tenant records, from [`admin.identity.tenants.list()`](../16-identity.md#tenantslist), have the current name and state.

**Attributes:**

| Name               | Type              | Description |
| ------------------ | ----------------- | ----------- |
| id                 | str               |             |
| created            | datetime.datetime |             |
| provider_tenant_id | str               |             |
| provider_name      | str               |             |
| state              | Optional[str]     |             |
| primary_domain     | Optional[str]     |             |
| object_store_id    | Optional[str]     |             |
| name               | Optional[str]     |             |
| label              | Optional[str]     |             |

## Product

Represents a derived output (Product) generated from a file revision.

**Attributes:**

| Name                    | Type          | Description |
| ----------------------- | ------------- | ----------- |
| revision_id             | str           |             |
| file_id                 | Optional[str] |             |
| resource_type           | Optional[str] |             |
| resource_id             | Optional[str] |             |
| relationship_identifier | Optional[str] |             |

## CreateMultipartUploadRequest

**Attributes:**

| Name      | Type | Description |
| --------- | ---- | ----------- |
| sha       | str  |             |
| num_parts | int  |             |

## CreateMultipartUploadResponse

**Attributes:**

| Name        | Type                                              | Description |
| ----------- | ------------------------------------------------- | ----------- |
| upload_id   | str                                               |             |
| upload_urls | Dict[str, [TemporaryURL](common.md#temporaryurl)] |             |

## FinalizeMultipartUploadRequest

**Attributes:**

| Name            | Type                                                            | Description |
| --------------- | --------------------------------------------------------------- | ----------- |
| action          | [FinalizeMultipartUploadAction](#finalizemultipartuploadaction) |             |
| sha             | str                                                             |             |
| upload_id       | str                                                             |             |
| completed_parts | Optional[List[[CompletedPartTypeDef](#completedparttypedef)]]   |             |

## FinalizeMultipartUploadAction

**Attributes:**

| Name     | Type | Description |
| -------- | ---- | ----------- |
| CANCEL   | —    |             |
| COMPLETE | —    |             |

## CompletedPartTypeDef

**Attributes:**

| Name                | Type          | Description |
| ------------------- | ------------- | ----------- |
| e_tag               | Optional[str] |             |
| checksum_crc32      | Optional[str] |             |
| checksum_crc32_c    | Optional[str] |             |
| checksum_crc64_nvme | Optional[str] |             |
| checksum_sha1       | Optional[str] |             |
| checksum_sha256     | Optional[str] |             |
| part_number         | Optional[int] |             |

## HealthcheckReport

**Attributes:**

| Name    | Type                              | Description |
| ------- | --------------------------------- | ----------- |
| healthy | bool                              |             |
| checks  | List[[CheckResult](#checkresult)] |             |

## CheckResult

**Attributes:**

| Name    | Type          | Description |
| ------- | ------------- | ----------- |
| name    | str           |             |
| passed  | bool          |             |
| details | Optional[str] |             |

## PagePersonalAccessToken

**Attributes:**

| Name  | Type                                              | Description |
| ----- | ------------------------------------------------- | ----------- |
| items | List[[PersonalAccessToken](#personalaccesstoken)] |             |
| total | Optional[int]                                     |             |
| page  | Optional[int]                                     |             |
| size  | Optional[int]                                     |             |
| pages | Optional[int]                                     |             |

## PageAuthIntegration

**Attributes:**

| Name  | Type                                      | Description |
| ----- | ----------------------------------------- | ----------- |
| items | List[[AuthIntegration](#authintegration)] |             |
| total | Optional[int]                             |             |
| page  | Optional[int]                             |             |
| size  | Optional[int]                             |             |
| pages | Optional[int]                             |             |

## PageDataIntegration

**Attributes:**

| Name  | Type                                      | Description |
| ----- | ----------------------------------------- | ----------- |
| items | List[[DataIntegration](#dataintegration)] |             |
| total | Optional[int]                             |             |
| page  | Optional[int]                             |             |
| size  | Optional[int]                             |             |
| pages | Optional[int]                             |             |

## PageTenant

**Attributes:**

| Name  | Type                    | Description |
| ----- | ----------------------- | ----------- |
| items | List[[Tenant](#tenant)] |             |
| total | Optional[int]           |             |
| page  | Optional[int]           |             |
| size  | Optional[int]           |             |
| pages | Optional[int]           |             |


---

<!-- Source: api_reference/models/agents.md -->

---
slug: /build/python/api_reference/models/agents
sidebar_label: "Agents & modules"
---

# Agents & modules

Data types for agents, agent pools, modules, functions, tools, and operating systems.

:::info
All data types support standard serialization methods (`to_json`, `from_json`, `to_dict`, `from_dict`, `to_str`) which are omitted from the tables below.
:::

## Agent

**Attributes:**

| Name                 | Type                                                  | Description |
| -------------------- | ----------------------------------------------------- | ----------- |
| id                   | str                                                   |             |
| created              | datetime.datetime                                     |             |
| display_name_history | Optional[List[[AgentDisplayName](#agentdisplayname)]] |             |
| information_history  | Optional[List[[AgentInformation](#agentinformation)]] |             |
| status_history       | Optional[List[[AgentStatus](#agentstatus)]]           |             |
| modules_history      | Optional[List[[AgentModules](#agentmodules)]]         |             |
| created_by_id        | Optional[str]                                         |             |

## AgentDisplayName

**Attributes:**

| Name          | Type              | Description |
| ------------- | ----------------- | ----------- |
| id            | str               |             |
| created       | datetime.datetime |             |
| agent_id      | str               |             |
| display_name  | str               |             |
| created_by_id | Optional[str]     |             |

## AgentInformation

**Attributes:**

| Name          | Type              | Description |
| ------------- | ----------------- | ----------- |
| id            | str               |             |
| created       | datetime.datetime |             |
| agent_id      | str               |             |
| agent_version | str               |             |
| host_os       | str               |             |
| tenant_id     | Optional[str]     |             |
| created_by_id | Optional[str]     |             |

## AgentModuleVersion

**Attributes:**

| Name              | Type              | Description |
| ----------------- | ----------------- | ----------- |
| id                | str               |             |
| created           | datetime.datetime |             |
| agent_modules_id  | str               |             |
| module_version_id | str               |             |
| module_name       | str               |             |
| module_version    | str               |             |
| created_by_id     | Optional[str]     |             |

## AgentModules

**Attributes:**

| Name            | Type                                            | Description |
| --------------- | ----------------------------------------------- | ----------- |
| id              | str                                             |             |
| created         | datetime.datetime                               |             |
| agent_id        | str                                             |             |
| module_versions | List[[AgentModuleVersion](#agentmoduleversion)] |             |
| created_by_id   | Optional[str]                                   |             |

## AgentPool

**Attributes:**

| Name              | Type                                                        | Description |
| ----------------- | ----------------------------------------------------------- | ----------- |
| id                | str                                                         |             |
| created           | datetime.datetime                                           |             |
| created_by_id     | str                                                         |             |
| name              | str                                                         |             |
| description       | Optional[str]                                               |             |
| agent_memberships | List[[AgentPoolAgentMembership](#agentpoolagentmembership)] |             |
| user_memberships  | List[[AgentPoolUserMembership](#agentpoolusermembership)]   |             |

## AgentPoolAgentMembership

**Attributes:**

| Name          | Type              | Description |
| ------------- | ----------------- | ----------- |
| id            | str               |             |
| created       | datetime.datetime |             |
| created_by_id | str               |             |
| agent_id      | str               |             |
| agent_pool_id | str               |             |

## AgentPoolAgentMembershipWithAgent

**Attributes:**

| Name          | Type              | Description |
| ------------- | ----------------- | ----------- |
| id            | str               |             |
| created       | datetime.datetime |             |
| created_by_id | str               |             |
| agent_id      | str               |             |
| agent_pool_id | str               |             |
| agent         | [Agent](#agent)   |             |

## AgentPoolUserMembership

**Attributes:**

| Name          | Type              | Description |
| ------------- | ----------------- | ----------- |
| id            | str               |             |
| created       | datetime.datetime |             |
| created_by_id | str               |             |
| user_id       | str               |             |
| agent_pool_id | str               |             |

## AgentPoolUserMembershipWithUser

**Attributes:**

| Name          | Type                  | Description |
| ------------- | --------------------- | ----------- |
| id            | str                   |             |
| created       | datetime.datetime     |             |
| created_by_id | str                   |             |
| user_id       | str                   |             |
| agent_pool_id | str                   |             |
| user          | [User](admin.md#user) |             |

## AgentStatus

**Attributes:**

| Name          | Type                                | Description |
| ------------- | ----------------------------------- | ----------- |
| id            | str                                 |             |
| created       | datetime.datetime                   |             |
| agent_id      | str                                 |             |
| name          | [AgentStatusName](#agentstatusname) |             |
| created_by_id | Optional[str]                       |             |
| message       | Optional[str]                       |             |

## AgentStatusName

**Attributes:**

| Name                   | Type | Description |
| ---------------------- | ---- | ----------- |
| IDLE                   | —    |             |
| CLAIMINGJOB            | —    |             |
| VALIDATINGJOB          | —    |             |
| EXECUTINGJOB           | —    |             |
| UPLOADINGJOB           | —    |             |
| EXECUTIONFAILED        | —    |             |
| EXECUTIONSUCCESS       | —    |             |
| UPDATINGAGENT          | —    |             |
| SUCCESSFULAGENTUPDATE  | —    |             |
| FAILEDAGENTUPDATE      | —    |             |
| UPDATINGMODULE         | —    |             |
| SUCCESSFULMODULEUPDATE | —    |             |
| FAILEDMODULEUPDATE     | —    |             |
| PAUSED                 | —    |             |
| UNKNOWN                | —    |             |

## AgentStatusRetentionDuration

**Attributes:**

| Name           | Type              | Description |
| -------------- | ----------------- | ----------- |
| id             | str               |             |
| created        | datetime.datetime |             |
| retention_days | Optional[int]     |             |
| created_by_id  | Optional[str]     |             |

## NewAgent

**Attributes:**

| Name          | Type | Description |
| ------------- | ---- | ----------- |
| agent_version | str  |             |
| host_os       | str  |             |

## NewAgentDisplayName

**Attributes:**

| Name         | Type | Description |
| ------------ | ---- | ----------- |
| display_name | str  |             |

## NewAgentInformation

**Attributes:**

| Name          | Type | Description |
| ------------- | ---- | ----------- |
| agent_version | str  |             |
| host_os       | str  |             |

## NewAgentModuleVersion

**Attributes:**

| Name           | Type | Description |
| -------------- | ---- | ----------- |
| module_name    | str  |             |
| module_version | str  |             |

## NewAgentPool

**Attributes:**

| Name        | Type          | Description |
| ----------- | ------------- | ----------- |
| name        | str           |             |
| description | Optional[str] |             |

## NewAgentPoolAgentMembership

**Attributes:**

| Name     | Type | Description |
| -------- | ---- | ----------- |
| agent_id | str  |             |

## NewAgentPoolUserMembership

**Attributes:**

| Name    | Type | Description |
| ------- | ---- | ----------- |
| user_id | str  |             |

## NewAgentStatus

**Attributes:**

| Name | Type                                | Description |
| ---- | ----------------------------------- | ----------- |
| name | [AgentStatusName](#agentstatusname) |             |

## NewAgentStatusRetentionDuration

**Attributes:**

| Name           | Type | Description |
| -------------- | ---- | ----------- |
| retention_days | int  |             |

## Module

**Attributes:**

| Name            | Type                                            | Description |
| --------------- | ----------------------------------------------- | ----------- |
| id              | str                                             |             |
| created         | datetime.datetime                               |             |
| name            | str                                             |             |
| module_type     | [ModuleType](#moduletype)                       |             |
| internal        | bool                                            |             |
| tool            | Optional[str]                                   |             |
| module_versions | Optional[List[[ModuleVersion](#moduleversion)]] |             |
| functions       | Optional[List[[Function](#function)]]           |             |

## ModuleAuthor

**Attributes:**

| Name    | Type              | Description |
| ------- | ----------------- | ----------- |
| id      | str               |             |
| created | datetime.datetime |             |
| name    | str               |             |
| email   | str               |             |

## ModuleAuthorManifest

**Attributes:**

| Name  | Type | Description |
| ----- | ---- | ----------- |
| name  | str  |             |
| email | str  |             |

## ModuleType

**Attributes:**

| Name           | Type | Description |
| -------------- | ---- | ----------- |
| FUNCTION       | —    |             |
| AUTHENTICATION | —    |             |

## ModuleVersion

**Attributes:**

| Name                | Type                                                           | Description |
| ------------------- | -------------------------------------------------------------- | ----------- |
| id                  | str                                                            |             |
| created             | datetime.datetime                                              |             |
| module_version      | str                                                            |             |
| check_sum           | str                                                            |             |
| agent_version       | str                                                            |             |
| module_id           | str                                                            |             |
| status              | [ModuleVersionStatus](#moduleversionstatus)                    |             |
| module_display_name | Optional[str]                                                  |             |
| tool_display_name   | Optional[str]                                                  |             |
| tool_versions       | Optional[List[str]]                                            |             |
| operating_systems   | Optional[List[str]]                                            |             |
| authors             | Optional[List[[ModuleAuthor](#moduleauthor)]]                  |             |
| functions           | Optional[Dict[str, List[[FunctionVersion](#functionversion)]]] |             |

## ModuleVersionStatus

**Attributes:**

| Name              | Type                                                 | Description |
| ----------------- | ---------------------------------------------------- | ----------- |
| id                | str                                                  |             |
| created           | datetime.datetime                                    |             |
| created_by_id     | str                                                  |             |
| name              | [UsabilityStatusName](common.md#usabilitystatusname) |             |
| reason            | Optional[str]                                        |             |
| module_version_id | str                                                  |             |

## NewModuleAuthor

**Attributes:**

| Name  | Type | Description |
| ----- | ---- | ----------- |
| name  | str  |             |
| email | str  |             |

## NewModuleManifest

**Attributes:**

| Name                | Type                                                         | Description |
| ------------------- | ------------------------------------------------------------ | ----------- |
| module_name         | str                                                          |             |
| module_version      | str                                                          |             |
| module_type         | [ModuleType](#moduletype)                                    |             |
| module_checksum     | str                                                          |             |
| internal            | bool                                                         |             |
| operating_systems   | List[str]                                                    |             |
| agent_version       | str                                                          |             |
| authors             | List[[ModuleAuthorManifest](#moduleauthormanifest)]          |             |
| functions           | Dict[str, List[[NewFunctionManifest](#newfunctionmanifest)]] |             |
| module_display_name | Optional[str]                                                |             |
| tool_display_name   | Optional[str]                                                |             |
| tool                | Optional[str]                                                |             |
| tool_versions       | Optional[List[str]]                                          |             |

## Function

**Attributes:**

| Name              | Type                                                | Description |
| ----------------- | --------------------------------------------------- | ----------- |
| id                | str                                                 |             |
| created           | datetime.datetime                                   |             |
| name              | str                                                 |             |
| module_name       | str                                                 |             |
| tool_name         | Optional[str]                                       |             |
| function_versions | Optional[List[[FunctionVersion](#functionversion)]] |             |

## FunctionAuthSecret

Represents a function authentication secret backed by a file.

**Attributes:**

| Name                   | Type                                                           | Description |
| ---------------------- | -------------------------------------------------------------- | ----------- |
| id                     | str                                                            |             |
| created                | datetime.datetime                                              |             |
| file                   | [File](files.md#file)                                          |             |
| comments               | List[[Comment](files.md#comment)]                              |             |
| archive_status_history | List[[ResourceArchiveStatus](common.md#resourcearchivestatus)] |             |
| created_by_id          | str                                                            |             |
| function_auth_type     | [FunctionAuthType](#functionauthtype)                          |             |
| sha                    | Optional[str]                                                  |             |
| salt                   | Optional[str]                                                  |             |
| auth_integration_id    | Optional[str]                                                  |             |
| expiration             | Optional[datetime.datetime]                                    |             |

**Methods:**

| Name                       | Description                                                            |
| -------------------------- | ---------------------------------------------------------------------- |
| update_properties          | Update one or more metadata fields on the underlying file.             |
| update_description         | Update the file’s description.                                         |
| update_display_name        | Update the file’s display name.                                        |
| update_external_identifier | Update the file’s external identifier.                                 |
| update_version_name        | Update the file’s version name.                                        |
| read_bytes                 | Read and return the raw byte contents of the associated file revision. |
| read_text                  | Read the contents as decoded text.                                     |
| copy_to                    | Copy the contents to a local file.                                     |
| read_json                  | Parse the contents as JSON.                                            |
| cleanup_cache              | Clean up cached files if they exist.                                   |
| get_cache_stats            | Get filesystem cache statistics.                                       |

## FunctionAuthType

**Attributes:**

| Name              | Type | Description |
| ----------------- | ---- | ----------- |
| JWT               | —    |             |
| TOKEN             | —    |             |
| BASIC             | —    |             |
| OAUTH1            | —    |             |
| OAUTH2            | —    |             |
| CAS_DELEGATED_3DX | —    |             |

## FunctionSchema

**Attributes:**

| Name    | Type                                          | Description |
| ------- | --------------------------------------------- | ----------- |
| id      | str                                           |             |
| created | datetime.datetime                             |             |
| inputs  | Optional[List[[InputSchema](#inputschema)]]   |             |
| outputs | Optional[List[[OutputSchema](#outputschema)]] |             |

## FunctionStatus

**Attributes:**

| Name          | Type                                                 | Description |
| ------------- | ---------------------------------------------------- | ----------- |
| id            | str                                                  |             |
| created       | datetime.datetime                                    |             |
| created_by_id | str                                                  |             |
| name          | [UsabilityStatusName](common.md#usabilitystatusname) |             |
| reason        | Optional[str]                                        |             |
| function_id   | str                                                  |             |

## FunctionVersion

**Attributes:**

| Name              | Type                                                | Description |
| ----------------- | --------------------------------------------------- | ----------- |
| id                | str                                                 |             |
| created           | datetime.datetime                                   |             |
| name              | str                                                 |             |
| version           | str                                                 |             |
| module_name       | str                                                 |             |
| module_version    | str                                                 |             |
| entrypoint        | str                                                 |             |
| function_schema   | Optional[str]                                       |             |
| run_command       | str                                                 |             |
| created_by_id     | str                                                 |             |
| status            | [FunctionStatus](#functionstatus)                   |             |
| tool_name         | Optional[str]                                       |             |
| tool_display_name | Optional[str]                                       |             |
| tool_versions     | Optional[List[[ToolVersion](#toolversion)]]         |             |
| operating_systems | Optional[List[[OperatingSystem](#operatingsystem)]] |             |

## NewFunctionAuthSecret

**Attributes:**

| Name                | Type                                  | Description |
| ------------------- | ------------------------------------- | ----------- |
| revision            | [FileRevision](files.md#filerevision) |             |
| function_auth_type  | [FunctionAuthType](#functionauthtype) |             |
| auth_integration_id | Optional[str]                         |             |
| sha                 | Optional[str]                         |             |
| salt                | Optional[str]                         |             |
| expiration          | Optional[datetime.datetime]           |             |

## NewFunctionManifest

**Attributes:**

| Name              | Type                                                    | Description |
| ----------------- | ------------------------------------------------------- | ----------- |
| entrypoint        | str                                                     |             |
| run_command       | str                                                     |             |
| function_schema   | [NewFunctionSchemaManifest](#newfunctionschemamanifest) |             |
| operating_systems | Optional[List[str]]                                     |             |
| tool_versions     | Optional[List[str]]                                     |             |

## NewFunctionSchemaManifest

**Attributes:**

| Name    | Type                                                                   | Description |
| ------- | ---------------------------------------------------------------------- | ----------- |
| inputs  | Optional[Dict[str, [NewInputSchemaManifest](#newinputschemamanifest)]] |             |
| outputs | Optional[List[[NewOutputSchemaManifest](#newoutputschemamanifest)]]    |             |

## NewInputSchemaManifest

**Attributes:**

| Name             | Type                | Description |
| ---------------- | ------------------- | ----------- |
| type             | str                 |             |
| validation_types | Optional[List[str]] |             |
| optional         | Optional[bool]      |             |

## NewOutputSchemaManifest

**Attributes:**

| Name       | Type          | Description |
| ---------- | ------------- | ----------- |
| name       | str           |             |
| type       | str           |             |
| required   | bool          |             |
| upload_as  | Optional[str] |             |
| version_of | Optional[str] |             |

## InputSchema

**Attributes:**

| Name             | Type                    | Description |
| ---------------- | ----------------------- | ----------- |
| id               | str                     |             |
| created          | datetime.datetime       |             |
| key              | str                     |             |
| type             | [InputType](#inputtype) |             |
| validation_types | Optional[List[str]]     |             |
| optional         | Optional[bool]          |             |

## InputType

**Attributes:**

| Name       | Type | Description |
| ---------- | ---- | ----------- |
| PARAMETER  | —    |             |
| USER_MODEL | —    |             |
| USER_LINK  | —    |             |
| AUTH_INFO  | —    |             |

## OutputSchema

**Attributes:**

| Name       | Type                                    | Description |
| ---------- | --------------------------------------- | ----------- |
| id         | str                                     |             |
| created    | datetime.datetime                       |             |
| name       | str                                     |             |
| type       | [OutputType](#outputtype)               |             |
| required   | bool                                    |             |
| upload_as  | Optional[[UploadAs](files.md#uploadas)] |             |
| version_of | Optional[str]                           |             |

## OutputType

**Attributes:**

| Name      | Type | Description |
| --------- | ---- | ----------- |
| DIRECTORY | —    |             |
| FILE      | —    |             |

##

## Properties

Class for holding file properties.

**Attributes:**

| Name   | Type                                          | Description |
| ------ | --------------------------------------------- | ----------- |
| native | istari_digital_core.[Properties](#properties) |             |

## Tool

**Attributes:**

| Name          | Type                                        | Description |
| ------------- | ------------------------------------------- | ----------- |
| id            | str                                         |             |
| created       | datetime.datetime                           |             |
| name          | str                                         |             |
| functions     | Optional[List[[Function](#function)]]       |             |
| tool_versions | Optional[List[[ToolVersion](#toolversion)]] |             |

## ToolInclude

**Attributes:**

| Name              | Type | Description |
| ----------------- | ---- | ----------- |
| FUNCTIONS         | —    |             |
| FUNCTION_VERSIONS | —    |             |

## ToolVersion

**Attributes:**

| Name         | Type              | Description |
| ------------ | ----------------- | ----------- |
| id           | str               |             |
| created      | datetime.datetime |             |
| tool_version | str               |             |

## NewTool

**Attributes:**

| Name          | Type                                              | Description |
| ------------- | ------------------------------------------------- | ----------- |
| name          | str                                               |             |
| tool_versions | Optional[List[[NewToolVersion](#newtoolversion)]] |             |

## NewToolVersion

**Attributes:**

| Name         | Type | Description |
| ------------ | ---- | ----------- |
| tool_version | str  |             |

## UpdateTool

**Attributes:**

| Name | Type | Description |
| ---- | ---- | ----------- |
| name | str  |             |

## DeprecationReason

**Attributes:**

| Name   | Type | Description |
| ------ | ---- | ----------- |
| reason | str  |             |

## NewOperatingSystem

**Attributes:**

| Name | Type | Description |
| ---- | ---- | ----------- |
| name | str  |             |

## OperatingSystem

**Attributes:**

| Name    | Type              | Description |
| ------- | ----------------- | ----------- |
| id      | str               |             |
| created | datetime.datetime |             |
| name    | str               |             |

## OS

**Attributes:**

| Name                | Type | Description |
| ------------------- | ---- | ----------- |
| WINDOWS_11          | —    |             |
| WINDOWS_10          | —    |             |
| WINDOWS_SERVER_2019 | —    |             |
| WINDOWS_SERVER_2022 | —    |             |
| UBUNTU_24_DOT_04    | —    |             |
| UBUNTU_22_DOT_04    | —    |             |
| UBUNTU_20_DOT_04    | —    |             |
| RHEL_8              | —    |             |
| RHEL_9              | —    |             |

## PageAgent

**Attributes:**

| Name  | Type                  | Description |
| ----- | --------------------- | ----------- |
| items | List[[Agent](#agent)] |             |
| total | Optional[int]         |             |
| page  | Optional[int]         |             |
| size  | Optional[int]         |             |
| pages | Optional[int]         |             |

## PageAgentPool

**Attributes:**

| Name  | Type                          | Description |
| ----- | ----------------------------- | ----------- |
| items | List[[AgentPool](#agentpool)] |             |
| total | Optional[int]                 |             |
| page  | Optional[int]                 |             |
| size  | Optional[int]                 |             |
| pages | Optional[int]                 |             |

## PageAgentPoolAgentMembershipWithAgent

**Attributes:**

| Name  | Type                                                                          | Description |
| ----- | ----------------------------------------------------------------------------- | ----------- |
| items | List[[AgentPoolAgentMembershipWithAgent](#agentpoolagentmembershipwithagent)] |             |
| total | Optional[int]                                                                 |             |
| page  | Optional[int]                                                                 |             |
| size  | Optional[int]                                                                 |             |
| pages | Optional[int]                                                                 |             |

## PageAgentPoolUserMembershipWithUser

**Attributes:**

| Name  | Type                                                                      | Description |
| ----- | ------------------------------------------------------------------------- | ----------- |
| items | List[[AgentPoolUserMembershipWithUser](#agentpoolusermembershipwithuser)] |             |
| total | Optional[int]                                                             |             |
| page  | Optional[int]                                                             |             |
| size  | Optional[int]                                                             |             |
| pages | Optional[int]                                                             |             |

## PageAgentStatus

**Attributes:**

| Name  | Type                              | Description |
| ----- | --------------------------------- | ----------- |
| items | List[[AgentStatus](#agentstatus)] |             |
| total | Optional[int]                     |             |
| page  | Optional[int]                     |             |
| size  | Optional[int]                     |             |
| pages | Optional[int]                     |             |

## PageFunction

**Attributes:**

| Name  | Type                        | Description |
| ----- | --------------------------- | ----------- |
| items | List[[Function](#function)] |             |
| total | Optional[int]               |             |
| page  | Optional[int]               |             |
| size  | Optional[int]               |             |
| pages | Optional[int]               |             |

## PageFunctionVersion

**Attributes:**

| Name  | Type                                      | Description |
| ----- | ----------------------------------------- | ----------- |
| items | List[[FunctionVersion](#functionversion)] |             |
| total | Optional[int]                             |             |
| page  | Optional[int]                             |             |
| size  | Optional[int]                             |             |
| pages | Optional[int]                             |             |

## PageModule

**Attributes:**

| Name  | Type                    | Description |
| ----- | ----------------------- | ----------- |
| items | List[[Module](#module)] |             |
| total | Optional[int]           |             |
| page  | Optional[int]           |             |
| size  | Optional[int]           |             |
| pages | Optional[int]           |             |

## PageModuleAuthor

**Attributes:**

| Name  | Type                                | Description |
| ----- | ----------------------------------- | ----------- |
| items | List[[ModuleAuthor](#moduleauthor)] |             |
| total | Optional[int]                       |             |
| page  | Optional[int]                       |             |
| size  | Optional[int]                       |             |
| pages | Optional[int]                       |             |

## PageModuleVersion

**Attributes:**

| Name  | Type                                  | Description |
| ----- | ------------------------------------- | ----------- |
| items | List[[ModuleVersion](#moduleversion)] |             |
| total | Optional[int]                         |             |
| page  | Optional[int]                         |             |
| size  | Optional[int]                         |             |
| pages | Optional[int]                         |             |

## PageOperatingSystem

**Attributes:**

| Name  | Type                                      | Description |
| ----- | ----------------------------------------- | ----------- |
| items | List[[OperatingSystem](#operatingsystem)] |             |
| total | Optional[int]                             |             |
| page  | Optional[int]                             |             |
| size  | Optional[int]                             |             |
| pages | Optional[int]                             |             |

## PageTool

**Attributes:**

| Name  | Type                | Description |
| ----- | ------------------- | ----------- |
| items | List[[Tool](#tool)] |             |
| total | Optional[int]       |             |
| page  | Optional[int]       |             |
| size  | Optional[int]       |             |
| pages | Optional[int]       |             |

## PageToolVersion

**Attributes:**

| Name  | Type                              | Description |
| ----- | --------------------------------- | ----------- |
| items | List[[ToolVersion](#toolversion)] |             |
| total | Optional[int]                     |             |
| page  | Optional[int]                     |             |
| size  | Optional[int]                     |             |
| pages | Optional[int]                     |             |


---

<!-- Source: api_reference/models/common.md -->

---
slug: /build/python/api_reference/models/common
sidebar_label: "Common types"
---

# Common types

Shared data types used across the SDK: archiving, pagination, filtering, and validation.

:::info
All data types support standard serialization methods (`to_json`, `from_json`, `to_dict`, `from_dict`, `to_str`) which are omitted from the tables below.
:::

## Archive

**Attributes:**

| Name   | Type | Description |
| ------ | ---- | ----------- |
| reason | str  |             |

## ArchiveStatus

Enum for archive status.

**Attributes:**

| Name     | Type | Description |
| -------- | ---- | ----------- |
| ARCHIVED | —    |             |
| ACTIVE   | —    |             |
| ALL      | —    |             |

## ArchiveStatusName

**Attributes:**

| Name     | Type | Description |
| -------- | ---- | ----------- |
| ARCHIVED | —    |             |
| ACTIVE   | —    |             |

## ResourceArchiveStatus

**Attributes:**

| Name          | Type                                    | Description |
| ------------- | --------------------------------------- | ----------- |
| id            | str                                     |             |
| created       | datetime.datetime                       |             |
| name          | [ArchiveStatusName](#archivestatusname) |             |
| reason        | Optional[str]                           |             |
| created_by_id | Optional[str]                           |             |
| resource_id   | str                                     |             |

## Restore

**Attributes:**

| Name   | Type | Description |
| ------ | ---- | ----------- |
| reason | str  |             |

## Pageable

A generic paginated response model for handling lists of items.

**Attributes:**

| Name  | Type          | Description |
| ----- | ------------- | ----------- |
| items | List[T]       |             |
| total | Optional[int] |             |
| page  | Optional[int] |             |
| size  | Optional[int] |             |
| pages | Optional[int] |             |

**Methods:**

| Name       | Description                                              |
| ---------- | -------------------------------------------------------- |
| iter_pages | Iterate over all pages using the configured list method. |
| iter_items | Iterate over all items across all pages.                 |

## FilterBy

Enum for filtering entities based on different criteria.

**Attributes:**

| Name                | Type | Description |
| ------------------- | ---- | ----------- |
| MINUS_CREATED_BY_ID | —    |             |
| CREATED_BY_ID       | —    |             |

## PatchOp

**Attributes:**

| Name   | Type | Description |
| ------ | ---- | ----------- |
| SET    | —    |             |
| DELETE | —    |             |

##

## Readable

Abstract base class for objects that expose readable file-like content.

**Methods:**

| Name            | Description                          |
| --------------- | ------------------------------------ |
| read_bytes      | Read the contents as raw bytes.      |
| read_text       | Read the contents as decoded text.   |
| copy_to         | Copy the contents to a local file.   |
| read_json       | Parse the contents as JSON.          |
| cleanup_cache   | Clean up cached files if they exist. |
| get_cache_stats | Get filesystem cache statistics.     |

## Shareable

Helper class that provides a standard way to create an ABC using

**Methods:**

| Name                   | Description                                              |
| ---------------------- | -------------------------------------------------------- |
| create_access          | Create a new access relationship for a subject by ID.    |
| create_access_by_email | Create a new access relationship for a subject by email. |
| update_access          | Update an existing access relationship for a subject.    |
| remove_access          | Remove an existing access relationship.                  |
| list_access            | List all access relationships for this resource.         |

## Archivable

Abstract mixin class for archivable and restorable resources.

**Methods:**

| Name    | Description                                                                        |
| ------- | ---------------------------------------------------------------------------------- |
| archive | Archive the current item using the client’s archive method for this resource type. |
| restore | Restore the current item using the client’s restore method for this resource type. |

## ClientHaving

Mixin for models that require access to a ClientApi instance.

## ResourceType

Enum for resource types.

**Attributes:**

| Name     | Type | Description |
| -------- | ---- | ----------- |
| MODEL    | —    |             |
| ARTIFACT | —    |             |
| COMMENT  | —    |             |
| JOB      | —    |             |

## UsabilityStatusName

**Attributes:**

| Name       | Type | Description |
| ---------- | ---- | ----------- |
| SUPPORTED  | —    |             |
| DEPRECATED | —    |             |

## UsabilityStatusParams

**Attributes:**

| Name       | Type | Description |
| ---------- | ---- | ----------- |
| SUPPORTED  | —    |             |
| DEPRECATED | —    |             |
| ALL        | —    |             |

## TemporaryURL

Data transfer object for holding signed temporary urls and their expiry date times.

**Attributes:**

| Name    | Type                        | Description |
| ------- | --------------------------- | ----------- |
| url     | str                         |             |
| expires | Optional[datetime.datetime] |             |

## HTTPValidationError

**Attributes:**

| Name   | Type                                                | Description |
| ------ | --------------------------------------------------- | ----------- |
| detail | Optional[List[[ValidationError](#validationerror)]] |             |

## ValidationError

**Attributes:**

| Name | Type                                                      | Description |
| ---- | --------------------------------------------------------- | ----------- |
| loc  | List[[ValidationErrorLocInner](#validationerrorlocinner)] |             |
| msg  | str                                                       |             |
| type | str                                                       |             |

## ValidationErrorLocInner

**Attributes:**

| Name                     | Type                      | Description |
| ------------------------ | ------------------------- | ----------- |
| anyof_schema_1_validator | Optional[str]             |             |
| anyof_schema_2_validator | Optional[int]             |             |
| actual_instance          | Optional[Union[int, str]] |             |
| any_of_schemas           | Set[str]                  |             |

**Methods:**

| Name                                | Description |
| ----------------------------------- | ----------- |
| actual_instance_must_validate_anyof |             |

## UserModelInputs

**Attributes:**

| Name     | Type | Description |
| -------- | ---- | ----------- |
| SINGLE   | —    |             |
| MULTIPLE | —    |             |


---

<!-- Source: api_reference/models/files.md -->

---
slug: /build/python/api_reference/models/files
sidebar_label: "Files, models & artifacts"
---

# Files, models & artifacts

Data types for files, models, artifacts, comments, revisions, and search results.

:::info
All data types support standard serialization methods (`to_json`, `from_json`, `to_dict`, `from_dict`, `to_str`) which are omitted from the tables below.
:::

## File

Represents a file and its associated metadata, revisions, and archive status.

**Attributes:**

| Name                   | Type                                                          | Description |
| ---------------------- | ------------------------------------------------------------- | ----------- |
| id                     | str                                                           |             |
| created                | datetime.datetime                                             |             |
| revisions              | List[[FileRevision](#filerevision)]                           |             |
| archive_status_history | List[[FileArchiveStatus](#filearchivestatus)]                 |             |
| resource_id            | Optional[str]                                                 |             |
| resource_type          | Optional[str]                                                 |             |
| created_by_id          | Optional[str]                                                 |             |
| control_tags           | Optional[List[[ControlTag](access.md#controltag)]]            |             |
| updated                | Optional[datetime.datetime]                                   |             |
| upstream_remote_info   | Optional[[UpstreamRemoteInfo](systems.md#upstreamremoteinfo)] |             |

**Methods:**

| Name                       | Description                                                                        |
| -------------------------- | ---------------------------------------------------------------------------------- |
| update_properties          | Update one or more metadata properties for the latest file revision.               |
| update_description         | Update the file’s description.                                                     |
| update_display_name        | Update the file’s display name.                                                    |
| update_external_identifier | Update the file’s external identifier.                                             |
| update_version_name        | Update the file’s version name.                                                    |
| read_bytes                 | Read and return the raw byte contents of the associated file revision.             |
| read_text                  | Read the contents as decoded text.                                                 |
| copy_to                    | Copy the contents to a local file.                                                 |
| read_json                  | Parse the contents as JSON.                                                        |
| cleanup_cache              | Clean up cached files if they exist.                                               |
| get_cache_stats            | Get filesystem cache statistics.                                                   |
| create_access              | Create a new access relationship for a subject by ID.                              |
| create_access_by_email     | Create a new access relationship for a subject by email.                           |
| update_access              | Update an existing access relationship for a subject.                              |
| remove_access              | Remove an existing access relationship.                                            |
| list_access                | List all access relationships for this resource.                                   |
| archive                    | Archive the current item using the client’s archive method for this resource type. |
| restore                    | Restore the current item using the client’s restore method for this resource type. |

## FileRevision

Represents a single revision of a file.

**Attributes:**

| Name                   | Type                                                          | Description |
| ---------------------- | ------------------------------------------------------------- | ----------- |
| id                     | str                                                           |             |
| created                | datetime.datetime                                             |             |
| file_id                | Optional[str]                                                 |             |
| content_token          | [Token](admin.md#token)                                       |             |
| properties_token       | [Token](admin.md#token)                                       |             |
| archive_status_history | List[[FileRevisionArchiveStatus](#filerevisionarchivestatus)] |             |
| name                   | Optional[str]                                                 |             |
| stem                   | Optional[str]                                                 |             |
| suffix                 | Optional[str]                                                 |             |
| extension              | Optional[str]                                                 |             |
| description            | Optional[str]                                                 |             |
| size                   | Optional[int]                                                 |             |
| mime                   | Optional[str]                                                 |             |
| version_name           | Optional[str]                                                 |             |
| external_identifier    | Optional[str]                                                 |             |
| display_name           | Optional[str]                                                 |             |
| sources                | Optional[List[[Source](#source)]]                             |             |
| products               | Optional[List[[Product](admin.md#product)]]                   |             |
| created_by_id          | Optional[str]                                                 |             |
| updated                | Optional[datetime.datetime]                                   |             |

**Methods:**

| Name                  | Description                                                                        |
| --------------------- | ---------------------------------------------------------------------------------- |
| source_revision_ids   | Return a list of revision IDs from the sources associated with this revision.      |
| source_product_ids    | Return a list of revision IDs from the products associated with this revision.     |
| read_bytes            | Read and return the raw file content for this revision.                            |
| from_storage_revision | Create a `FileRevision` from a core storage-layer revision.                        |
| read_text             | Read the contents as decoded text.                                                 |
| copy_to               | Copy the contents to a local file.                                                 |
| read_json             | Parse the contents as JSON.                                                        |
| cleanup_cache         | Clean up cached files if they exist.                                               |
| get_cache_stats       | Get filesystem cache statistics.                                                   |
| archive               | Archive the current item using the client’s archive method for this resource type. |
| restore               | Restore the current item using the client’s restore method for this resource type. |

## FileArchiveStatus

**Attributes:**

| Name          | Type                                             | Description |
| ------------- | ------------------------------------------------ | ----------- |
| id            | str                                              |             |
| created       | datetime.datetime                                |             |
| name          | [ArchiveStatusName](common.md#archivestatusname) |             |
| reason        | Optional[str]                                    |             |
| created_by_id | Optional[str]                                    |             |
| file_id       | str                                              |             |

## FileCollection

A class representing a group of files, their resolvers, and their snapshot history.

**Attributes:**

| Name             | Type              | Description |
| ---------------- | ----------------- | ----------- |
| id               | str               |             |
| created          | datetime.datetime |             |
| created_by_id    | str               |             |
| resolver_set_ids | List[str]         |             |

## FileControlTagging

A control assignment to a file.

**Attributes:**

| Name                         | Type                                                   | Description |
| ---------------------------- | ------------------------------------------------------ | ----------- |
| id                           | str                                                    |             |
| created                      | datetime.datetime                                      |             |
| created_by_id                | str                                                    |             |
| control_tag                  | [ControlTag](access.md#controltag)                     |             |
| status                       | [ControlTaggingStatus](access.md#controltaggingstatus) |             |
| reason                       | Optional[str]                                          |             |
| inherited_from_resource_id   | Optional[str]                                          |             |
| inherited_from_resource_type | Optional[str]                                          |             |
| file_id                      | str                                                    |             |

## FileHaving

Mixin for objects that contain a `file` and expose file revision behavior.

**Methods:**

| Name                       | Description                                                            |
| -------------------------- | ---------------------------------------------------------------------- |
| update_properties          | Update one or more metadata fields on the underlying file.             |
| update_description         | Update the file’s description.                                         |
| update_display_name        | Update the file’s display name.                                        |
| update_external_identifier | Update the file’s external identifier.                                 |
| update_version_name        | Update the file’s version name.                                        |
| read_bytes                 | Read and return the raw byte contents of the associated file revision. |
| read_text                  | Read the contents as decoded text.                                     |
| copy_to                    | Copy the contents to a local file.                                     |
| read_json                  | Parse the contents as JSON.                                            |
| cleanup_cache              | Clean up cached files if they exist.                                   |
| get_cache_stats            | Get filesystem cache statistics.                                       |

## FileRevisionArchiveStatus

**Attributes:**

| Name             | Type                                             | Description |
| ---------------- | ------------------------------------------------ | ----------- |
| id               | str                                              |             |
| created          | datetime.datetime                                |             |
| name             | [ArchiveStatusName](common.md#archivestatusname) |             |
| reason           | Optional[str]                                    |             |
| created_by_id    | Optional[str]                                    |             |
| file_revision_id | str                                              |             |

## FileRevisionHaving

Mixin for objects that expose a `FileRevision` and delegate common behaviors to it.

**Methods:**

| Name            | Description                                                            |
| --------------- | ---------------------------------------------------------------------- |
| read_bytes      | Read and return the raw byte contents of the associated file revision. |
| read_text       | Read the contents as decoded text.                                     |
| copy_to         | Copy the contents to a local file.                                     |
| read_json       | Parse the contents as JSON.                                            |
| cleanup_cache   | Clean up cached files if they exist.                                   |
| get_cache_stats | Get filesystem cache statistics.                                       |

## Artifact

Represents an artifact with associated file, model, and metadata.

**Attributes:**

| Name                   | Type                                                           | Description |
| ---------------------- | -------------------------------------------------------------- | ----------- |
| id                     | str                                                            |             |
| created                | datetime.datetime                                              |             |
| file                   | [File](#file)                                                  |             |
| comments               | List[[Comment](#comment)]                                      |             |
| archive_status_history | List[[ResourceArchiveStatus](common.md#resourcearchivestatus)] |             |
| created_by_id          | str                                                            |             |
| model_id               | Optional[str]                                                  |             |
| control_tags           | Optional[List[[ControlTag](access.md#controltag)]]             |             |

**Methods:**

| Name                       | Description                                                                        |
| -------------------------- | ---------------------------------------------------------------------------------- |
| update_properties          | Update one or more metadata fields on the underlying file.                         |
| update_description         | Update the file’s description.                                                     |
| update_display_name        | Update the file’s display name.                                                    |
| update_external_identifier | Update the file’s external identifier.                                             |
| update_version_name        | Update the file’s version name.                                                    |
| read_bytes                 | Read and return the raw byte contents of the associated file revision.             |
| read_text                  | Read the contents as decoded text.                                                 |
| copy_to                    | Copy the contents to a local file.                                                 |
| read_json                  | Parse the contents as JSON.                                                        |
| cleanup_cache              | Clean up cached files if they exist.                                               |
| get_cache_stats            | Get filesystem cache statistics.                                                   |
| create_access              | Create a new access relationship for a subject by ID.                              |
| create_access_by_email     | Create a new access relationship for a subject by email.                           |
| update_access              | Update an existing access relationship for a subject.                              |
| remove_access              | Remove an existing access relationship.                                            |
| list_access                | List all access relationships for this resource.                                   |
| archive                    | Archive the current item using the client’s archive method for this resource type. |
| restore                    | Restore the current item using the client’s restore method for this resource type. |

## Model

Represents a model resource that includes associated files, artifacts, jobs, and metadata.

**Attributes:**

| Name                   | Type                                                           | Description |
| ---------------------- | -------------------------------------------------------------- | ----------- |
| id                     | str                                                            |             |
| created                | datetime.datetime                                              |             |
| file                   | [File](#file)                                                  |             |
| comments               | List[[Comment](#comment)]                                      |             |
| archive_status_history | List[[ResourceArchiveStatus](common.md#resourcearchivestatus)] |             |
| created_by_id          | str                                                            |             |
| artifacts              | List[[Artifact](#artifact)]                                    |             |
| jobs                   | Optional[List[[Job](jobs.md#job)]]                             |             |
| control_tags           | Optional[List[[ControlTag](access.md#controltag)]]             |             |

**Methods:**

| Name                       | Description                                                                        |
| -------------------------- | ---------------------------------------------------------------------------------- |
| add_job                    | Add a job associated with this model.                                              |
| update_properties          | Update one or more metadata fields on the underlying file.                         |
| update_description         | Update the file’s description.                                                     |
| update_display_name        | Update the file’s display name.                                                    |
| update_external_identifier | Update the file’s external identifier.                                             |
| update_version_name        | Update the file’s version name.                                                    |
| read_bytes                 | Read and return the raw byte contents of the associated file revision.             |
| read_text                  | Read the contents as decoded text.                                                 |
| copy_to                    | Copy the contents to a local file.                                                 |
| read_json                  | Parse the contents as JSON.                                                        |
| cleanup_cache              | Clean up cached files if they exist.                                               |
| get_cache_stats            | Get filesystem cache statistics.                                                   |
| create_access              | Create a new access relationship for a subject by ID.                              |
| create_access_by_email     | Create a new access relationship for a subject by email.                           |
| update_access              | Update an existing access relationship for a subject.                              |
| remove_access              | Remove an existing access relationship.                                            |
| list_access                | List all access relationships for this resource.                                   |
| archive                    | Archive the current item using the client’s archive method for this resource type. |
| restore                    | Restore the current item using the client’s restore method for this resource type. |

## ModelListItem

Model class representing a simplified summary of a Model.

**Attributes:**

| Name           | Type                | Description |
| -------------- | ------------------- | ----------- |
| id             | str                 |             |
| created        | datetime.datetime   |             |
| file           | [File](#file)       |             |
| archive_status | str                 |             |
| created_by_id  | str                 |             |
| comment_ids    | Optional[List[str]] |             |
| artifact_ids   | Optional[List[str]] |             |
| job_ids        | Optional[List[str]] |             |

**Methods:**

| Name                       | Description                                                            |
| -------------------------- | ---------------------------------------------------------------------- |
| update_properties          | Update one or more metadata fields on the underlying file.             |
| update_description         | Update the file’s description.                                         |
| update_display_name        | Update the file’s display name.                                        |
| update_external_identifier | Update the file’s external identifier.                                 |
| update_version_name        | Update the file’s version name.                                        |
| read_bytes                 | Read and return the raw byte contents of the associated file revision. |
| read_text                  | Read the contents as decoded text.                                     |
| copy_to                    | Copy the contents to a local file.                                     |
| read_json                  | Parse the contents as JSON.                                            |
| cleanup_cache              | Clean up cached files if they exist.                                   |
| get_cache_stats            | Get filesystem cache statistics.                                       |

## Comment

Represents a comment associated with a file and a parent resource.

**Attributes:**

| Name                   | Type                                                           | Description |
| ---------------------- | -------------------------------------------------------------- | ----------- |
| id                     | str                                                            |             |
| created                | datetime.datetime                                              |             |
| file                   | [File](#file)                                                  |             |
| comments               | List[[Comment](#comment)]                                      |             |
| archive_status_history | List[[ResourceArchiveStatus](common.md#resourcearchivestatus)] |             |
| created_by_id          | str                                                            |             |
| resource_id            | Optional[str]                                                  |             |
| resource_type          | Optional[str]                                                  |             |

**Methods:**

| Name                       | Description                                                                        |
| -------------------------- | ---------------------------------------------------------------------------------- |
| update_properties          | Update one or more metadata fields on the underlying file.                         |
| update_description         | Update the file’s description.                                                     |
| update_display_name        | Update the file’s display name.                                                    |
| update_external_identifier | Update the file’s external identifier.                                             |
| update_version_name        | Update the file’s version name.                                                    |
| read_bytes                 | Read and return the raw byte contents of the associated file revision.             |
| read_text                  | Read the contents as decoded text.                                                 |
| copy_to                    | Copy the contents to a local file.                                                 |
| read_json                  | Parse the contents as JSON.                                                        |
| cleanup_cache              | Clean up cached files if they exist.                                               |
| get_cache_stats            | Get filesystem cache statistics.                                                   |
| archive                    | Archive the current item using the client’s archive method for this resource type. |
| restore                    | Restore the current item using the client’s restore method for this resource type. |

## Source

Represents an upstream source that contributed to the creation of another resource.

**Attributes:**

| Name                    | Type          | Description |
| ----------------------- | ------------- | ----------- |
| revision_id             | str           |             |
| file_id                 | Optional[str] |             |
| resource_type           | Optional[str] |             |
| resource_id             | Optional[str] |             |
| relationship_identifier | Optional[str] |             |

## NewSource

Represents a reference to a source revision when creating a new model or artifact. This includes the revision's unique identifier and an optional relationship identifier that describes how the source relates to the new entity (e.g., "input", "dependency").

**Attributes:**

| Name                    | Type            | Description                                                                   |
| ----------------------- | --------------- | ----------------------------------------------------------------------------- |
| revision_id             | str             | Unique identifier of the source revision. (required)                          |
| relationship_identifier | str &#124; None | Optional label describing the relationship (e.g., `"input"`, `"dependency"`). |

## NewTrackedFile

**Attributes:**

| Name                    | Type                                                  | Description |
| ----------------------- | ----------------------------------------------------- | ----------- |
| specifier_type          | [TrackedFileSpecifierType](#trackedfilespecifiertype) |             |
| file_id                 | Optional[str]                                         |             |
| pinned_file_revision_id | Optional[str]                                         |             |

## TrackedFile

**Attributes:**

| Name                     | Type                                                  | Description |
| ------------------------ | ----------------------------------------------------- | ----------- |
| id                       | str                                                   |             |
| created                  | datetime.datetime                                     |             |
| created_by_id            | str                                                   |             |
| configuration_id         | str                                                   |             |
| specifier_type           | [TrackedFileSpecifierType](#trackedfilespecifiertype) |             |
| file_id                  | str                                                   |             |
| current_file_revision_id | str                                                   |             |
| archive_status           | str                                                   |             |
| pinned_file_revision_id  | Optional[str]                                         |             |

## TrackedFileSpecifierType

**Attributes:**

| Name   | Type | Description |
| ------ | ---- | ----------- |
| LOCKED | —    |             |
| LATEST | —    |             |

## FullTextSearch

Represents a search query for full-text search. Attributes ———- search_term (str): The search term. page (int): The page number for pagination. size (int): The number of items per page.

**Attributes:**

| Name        | Type                                                 | Description |
| ----------- | ---------------------------------------------------- | ----------- |
| search_term | Annotated[str, Field(min_length=1, strict=True)]     |             |
| page        | Optional[int]                                        |             |
| size        | Optional[Annotated[int, Field(le=100, strict=True)]] |             |

## ResourceSearchItem

Resource class for search results.

**Attributes:**

| Name                | Type                                             | Description |
| ------------------- | ------------------------------------------------ | ----------- |
| id                  | str                                              |             |
| file_id             | str                                              |             |
| file_revision_id    | str                                              |             |
| type_name           | [ResourceType](common.md#resourcetype)           |             |
| created_by_id       | str                                              |             |
| archive_status      | [ArchiveStatusName](common.md#archivestatusname) |             |
| created             | datetime.datetime                                |             |
| updated             | datetime.datetime                                |             |
| name                | Optional[str]                                    |             |
| extension           | Optional[str]                                    |             |
| size                | Optional[int]                                    |             |
| mime                | Optional[str]                                    |             |
| description         | Optional[str]                                    |             |
| version_name        | Optional[str]                                    |             |
| external_identifier | Optional[str]                                    |             |
| display_name        | Optional[str]                                    |             |

## SnapshotRevisionSearchItem

**Attributes:**

| Name                | Type                    | Description |
| ------------------- | ----------------------- | ----------- |
| file_id             | Optional[str]           |             |
| content_token       | [Token](admin.md#token) |             |
| properties_token    | [Token](admin.md#token) |             |
| name                | Optional[str]           |             |
| extension           | Optional[str]           |             |
| size                | Optional[int]           |             |
| description         | Optional[str]           |             |
| mime                | Optional[str]           |             |
| version_name        | Optional[str]           |             |
| external_identifier | Optional[str]           |             |
| display_name        | Optional[str]           |             |
| schema_version      | Optional[str]           |             |
| created_by_id       | Optional[str]           |             |

**Methods:**

| Name            | Description                                           |
| --------------- | ----------------------------------------------------- |
| read_bytes      | Read the byte contents associated with this snapshot. |
| read_text       | Read the contents as decoded text.                    |
| copy_to         | Copy the contents to a local file.                    |
| read_json       | Parse the contents as JSON.                           |
| cleanup_cache   | Clean up cached files if they exist.                  |
| get_cache_stats | Get filesystem cache statistics.                      |

## ObjectStoreSha

`ObjectStoreSha` is a subclass of `Base` and represents where a file is stored.

**Attributes:**

| Name            | Type              | Description |
| --------------- | ----------------- | ----------- |
| id              | str               |             |
| created         | datetime.datetime |             |
| sha             | str               |             |
| object_store_id | str               |             |

## ShaStorage

`ShaStorage` is a subclass of `Base` and represents where a file is stored.

**Attributes:**

| Name          | Type              | Description |
| ------------- | ----------------- | ----------- |
| id            | str               |             |
| created       | datetime.datetime |             |
| sha           | str               |             |
| file_store_id | str               |             |

## UploadAs

**Attributes:**

| Name     | Type | Description |
| -------- | ---- | ----------- |
| ARTIFACT | —    |             |
| MODEL    | —    |             |

## PageFile

A paginated response object for listing files.

## PageArtifact

A paginated response object for listing artifacts.

## PageComment

A paginated response object for listing comments.

## PageModelListItem

A paginated response object for listing model list items.

## PageResourceSearchItem

**Attributes:**

| Name  | Type                                            | Description |
| ----- | ----------------------------------------------- | ----------- |
| items | List[[ResourceSearchItem](#resourcesearchitem)] |             |
| total | Optional[int]                                   |             |
| page  | Optional[int]                                   |             |
| size  | Optional[int]                                   |             |
| pages | Optional[int]                                   |             |

## PageTrackedFile

A paginated response object for listing tracked files.

## PageSnapshotRevisionSearchItem

A paginated response object for listing snapshot revision search results.

## PageTypeVarCustomizedResourceSearchItem

**Attributes:**

| Name  | Type                                            | Description |
| ----- | ----------------------------------------------- | ----------- |
| items | List[[ResourceSearchItem](#resourcesearchitem)] |             |
| total | Optional[int]                                   |             |
| page  | Optional[int]                                   |             |
| size  | Optional[int]                                   |             |
| pages | Optional[int]                                   |             |

## RevisionBulkCreateItem

One item in an [`add_artifacts_bulk()`](../02-files.md#add_artifacts_bulk) call.

**Attributes:**

| Name                | Type                              | Description |
| ------------------- | --------------------------------- | ----------- |
| path                | PathLike                          |             |
| sources             | list of NewSource or str, or None |             |
| description         | Optional[str]                     |             |
| version_name        | Optional[str]                     |             |
| external_identifier | Optional[str]                     |             |
| display_name        | Optional[str]                     |             |


---

<!-- Source: api_reference/models/jobs.md -->

---
slug: /build/python/api_reference/models/jobs
sidebar_label: "Jobs"
---

# Jobs

Data types for job execution, status tracking, and agent assignment.

:::info
All data types support standard serialization methods (`to_json`, `from_json`, `to_dict`, `from_dict`, `to_str`) which are omitted from the tables below.
:::

## Job

Represents a job that runs a function on a model and produces a file result.

**Attributes:**

| Name                   | Type                                                           | Description |
| ---------------------- | -------------------------------------------------------------- | ----------- |
| id                     | str                                                            |             |
| created                | datetime.datetime                                              |             |
| file                   | [File](files.md#file)                                          |             |
| comments               | List[[Comment](files.md#comment)]                              |             |
| archive_status_history | List[[ResourceArchiveStatus](common.md#resourcearchivestatus)] |             |
| created_by_id          | str                                                            |             |
| function               | [FunctionVersion](agents.md#functionversion)                   |             |
| assigned_agent_id      | Optional[str]                                                  |             |
| agent_id               | Optional[str]                                                  |             |
| tenant_id              | Optional[str]                                                  |             |
| model_id               | Optional[str]                                                  |             |
| status_history         | Optional[List[[JobStatus](#jobstatus)]]                        |             |

**Methods:**

| Name                       | Description                                                                        |
| -------------------------- | ---------------------------------------------------------------------------------- |
| poll_job                   | Poll the job until it reaches a terminal state.                                    |
| update_properties          | Update one or more metadata fields on the underlying file.                         |
| update_description         | Update the file’s description.                                                     |
| update_display_name        | Update the file’s display name.                                                    |
| update_external_identifier | Update the file’s external identifier.                                             |
| update_version_name        | Update the file’s version name.                                                    |
| read_bytes                 | Read and return the raw byte contents of the associated file revision.             |
| read_text                  | Read the contents as decoded text.                                                 |
| copy_to                    | Copy the contents to a local file.                                                 |
| read_json                  | Parse the contents as JSON.                                                        |
| cleanup_cache              | Clean up cached files if they exist.                                               |
| get_cache_stats            | Get filesystem cache statistics.                                                   |
| create_access              | Create a new access relationship for a subject by ID.                              |
| create_access_by_email     | Create a new access relationship for a subject by email.                           |
| update_access              | Update an existing access relationship for a subject.                              |
| remove_access              | Remove an existing access relationship.                                            |
| list_access                | List all access relationships for this resource.                                   |
| archive                    | Archive the current item using the client’s archive method for this resource type. |
| restore                    | Restore the current item using the client’s restore method for this resource type. |

## JobStatus

Represents a status update for a job.

**Attributes:**

| Name          | Type                            | Description |
| ------------- | ------------------------------- | ----------- |
| id            | str                             |             |
| created       | datetime.datetime               |             |
| job_id        | str                             |             |
| name          | [JobStatusName](#jobstatusname) |             |
| created_by_id | Optional[str]                   |             |
| message       | Optional[str]                   |             |
| agent_id      | Optional[str]                   |             |

## JobStatusName

**Attributes:**

| Name       | Type | Description |
| ---------- | ---- | ----------- |
| CREATED    | —    |             |
| PENDING    | —    |             |
| CLAIMED    | —    |             |
| VALIDATING | —    |             |
| RUNNING    | —    |             |
| UPLOADING  | —    |             |
| COMPLETED  | —    |             |
| FAILED     | —    |             |
| CANCELED   | —    |             |
| UNKNOWN    | —    |             |

## JobStatusMessage

**Attributes:**

| Name    | Type | Description |
| ------- | ---- | ----------- |
| message | str  |             |

## NewCredentialBinding

Binds one of a job's `auth_info` inputs to a stored credential at submission. No secret is minted at submission, so a queued job holds no live token; the platform mints a sign-in from the credential when the job is claimed.

**Attributes:**

| Name          | Type | Description                                            |
| ------------- | ---- | ------------------------------------------------------ |
| input_name    | str  | The function's `auth_info` input the credential feeds. |
| credential_id | str  | The stored credential to mint from when the job runs.  |

## NewJobAssignedAgent

**Attributes:**

| Name     | Type | Description |
| -------- | ---- | ----------- |
| agent_id | str  |             |

## NoJobResponse

**Attributes:**

| Name    | Type | Description |
| ------- | ---- | ----------- |
| message | str  |             |

## ResponseGetJobForAgent

**Attributes:**

| Name                     | Type                                                          | Description |
| ------------------------ | ------------------------------------------------------------- | ----------- |
| anyof_schema_1_validator | Optional[[Job](#job)]                                         |             |
| anyof_schema_2_validator | Optional[[NoJobResponse](#nojobresponse)]                     |             |
| actual_instance          | Optional[Union[[Job](#job), [NoJobResponse](#nojobresponse)]] |             |
| any_of_schemas           | Set[str]                                                      |             |

**Methods:**

| Name                                | Description |
| ----------------------------------- | ----------- |
| actual_instance_must_validate_anyof |             |

## NoOpResponse

**Attributes:**

| Name    | Type | Description |
| ------- | ---- | ----------- |
| status  | str  |             |
| message | str  |             |

## PageJob

A paginated response object for listing jobs.

## NewJobAssignedAgentPool

Body for assigning a job to an agent pool.

**Attributes:**

| Name          | Type | Description |
| ------------- | ---- | ----------- |
| agent_pool_id | str  |             |


---

<!-- Source: api_reference/models/systems.md -->

---
slug: /build/python/api_reference/models/systems
sidebar_label: "Systems & snapshots"
---

# Systems & snapshots

Data types for systems, configurations, snapshots, and tags.

:::info
All data types support standard serialization methods (`to_json`, `from_json`, `to_dict`, `from_dict`, `to_str`) which are omitted from the tables below.
:::

## System

Represents a System object that aggregates configuration, versioning, and file content

**Attributes:**

| Name                        | Type                                                        | Description |
| --------------------------- | ----------------------------------------------------------- | ----------- |
| id                          | str                                                         |             |
| created                     | datetime.datetime                                           |             |
| created_by_id               | str                                                         |             |
| name                        | str                                                         |             |
| description                 | str                                                         |             |
| archive_status              | str                                                         |             |
| configurations              | Optional[List[[SystemConfiguration](#systemconfiguration)]] |             |
| baseline_tagged_snapshot_id | Optional[str]                                               |             |

**Methods:**

| Name                        | Description                                                                                                                         |
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| bulk_share_by_snapshot      | Grant a subject access to every file in a given snapshot (defaults to the system baseline).                                         |
| bulk_share_by_configuration | Grant a subject access to every file in the latest snapshot of a configuration.                                                     |
| bulk_share_by_system        | Grant a subject access to every file in the system's baseline snapshot.                                                             |
| get_branch                  | Look up a branch ([`SnapshotTag`](#snapshottag)) by name. Entry point for the branching API.                                        |
| list_branches               | List all user branches on the system (excludes the baseline tag).                                                                   |
| create_branch               | Create a new branch from an existing branch (like `git checkout -b`).                                                               |
| add_to_branch               | Add file revisions and/or [`SubsystemLink`](#subsystemlink) entries to a branch in a single commit.                                 |
| remove_from_branch          | Remove file revisions and/or [`SubsystemLink`](#subsystemlink) entries from a branch in a single commit.                            |
| list_branch_revisions       | List the file revisions tracked by a branch at its current snapshot.                                                                |
| list_branch_subsystems      | List the [`SnapshotSubsystemItem`](#snapshotsubsystemitem) entries tracked by a branch at its current snapshot.                     |
| merge_branch                | Move a target branch to point at the same snapshot as a source branch (like `git merge --ff`).                                      |
| rollback                    | Move a branch back N positions in its commit history (like `git reset --hard HEAD~N`).                                              |
| list_branch_history         | Return the full commit history of a branch as [`SnapshotTagRevision`](#snapshottagrevision) entries, newest first (like `git log`). |
| create_access               | Create a new access relationship for a subject by ID.                                                                               |
| create_access_by_email      | Create a new access relationship for a subject by email.                                                                            |
| update_access               | Update an existing access relationship for a subject.                                                                               |
| remove_access               | Remove an existing access relationship.                                                                                             |
| list_access                 | List all access relationships for this resource.                                                                                    |
| archive                     | Archive the current item using the client's archive method for this resource type.                                                  |
| restore                     | Restore the current item using the client's restore method for this resource type.                                                  |

## SystemBaseline

**Attributes:**

| Name        | Type              | Description |
| ----------- | ----------------- | ----------- |
| id          | str               |             |
| created     | datetime.datetime |             |
| system_id   | str               |             |
| tag_id      | str               |             |
| snapshot_id | str               |             |

## SystemConfiguration

**Attributes:**

| Name           | Type              | Description |
| -------------- | ----------------- | ----------- |
| id             | str               |             |
| created        | datetime.datetime |             |
| created_by_id  | str               |             |
| system_id      | str               |             |
| name           | str               |             |
| sha            | str               |             |
| archive_status | str               |             |

## Snapshot

**Attributes:**

| Name             | Type              | Description |
| ---------------- | ----------------- | ----------- |
| id               | str               |             |
| created          | datetime.datetime |             |
| configuration_id | str               |             |
| sha              | str               |             |
| created_by_id    | str               |             |

## SnapshotItem

**Attributes:**

| Name             | Type              | Description |
| ---------------- | ----------------- | ----------- |
| id               | str               |             |
| created          | datetime.datetime |             |
| snapshot_id      | str               |             |
| file_revision_id | str               |             |

## SnapshotTag

A named, movable pointer to a snapshot. Used to model branches: the `baseline` tag is created automatically with each system, and the [branching API](#system) on [`System`](#system) creates additional tags such as `main` or `feature/x`.

**Attributes:**

| Name           | Type              | Description |
| -------------- | ----------------- | ----------- |
| id             | str               |             |
| created        | datetime.datetime |             |
| tag            | str               |             |
| is_baseline    | bool              |             |
| archive_status | str               |             |
| snapshot_id    | str               |             |

## SnapshotTagRevision

One entry in a tag's history — i.e. one of the snapshots the tag has pointed at. Returned by `list_branch_history()` on [`System`](#system).

**Attributes:**

| Name           | Type              | Description |
| -------------- | ----------------- | ----------- |
| id             | str               |             |
| created        | datetime.datetime |             |
| created_by_id  | str               |             |
| tag_id         | str               |             |
| archive_status | str               |             |
| snapshot_id    | str               |             |

## NewSystem

**Attributes:**

| Name        | Type | Description |
| ----------- | ---- | ----------- |
| name        | str  |             |
| description | str  |             |

## NewSystemConfiguration

**Attributes:**

| Name            | Type                                                      | Description                                                                                                   |
| --------------- | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| name            | str                                                       |                                                                                                               |
| tracked_files   | Optional[List[[NewTrackedFile](files.md#newtrackedfile)]] |                                                                                                               |
| tracked_systems | Optional[List[[NewTrackedSystem](#newtrackedsystem)]]     | Subsystems to compose into this configuration. See [System composition](../04-systems.md#system-composition). |

## NewTrackedSystem

Reference to a child system that should be tracked as a subsystem of a parent configuration.

**Attributes:**

| Name      | Type          | Description                                                                                              |
| --------- | ------------- | -------------------------------------------------------------------------------------------------------- |
| system_id | str           | Id of the child system to link as a subsystem.                                                           |
| tag_id    | Optional[str] | Id of a [`SnapshotTag`](#snapshottag) on the child system to pin to. Falls back to the child's baseline. |

## Subsystem

A child system as it appears on a parent configuration, including the configuration and snapshot it is pinned to.

**Attributes:**

| Name                 | Type                                        | Description                                                         |
| -------------------- | ------------------------------------------- | ------------------------------------------------------------------- |
| id                   | str                                         | Id of the child system.                                             |
| created              | datetime.datetime                           |                                                                     |
| created_by_id        | str                                         |                                                                     |
| name                 | str                                         |                                                                     |
| description          | str                                         |                                                                     |
| archive_status       | str                                         |                                                                     |
| tag_id               | str                                         | Id of the [`SnapshotTag`](#snapshottag) the subsystem is pinned to. |
| tagged_configuration | [SystemConfiguration](#systemconfiguration) | The child configuration the tag points at.                          |
| tagged_snapshot_id   | str                                         | The child snapshot the tag points at.                               |
| added_on             | datetime.datetime                           | When the subsystem was added to the parent configuration.           |
| added_by_id          | str                                         |                                                                     |
| infosec_level        | Optional[InfosecLevel]                      |                                                                     |

## SnapshotSubsystemItem

A subsystem entry as captured on a snapshot. Returned by [`list_snapshot_subsystems()`](../04-systems.md#list_snapshot_subsystems).

**Attributes:**

| Name                      | Type              | Description                                           |
| ------------------------- | ----------------- | ----------------------------------------------------- |
| system_id                 | str               | Id of the child system.                               |
| system_name               | str               |                                                       |
| system_description        | Optional[str]     |                                                       |
| tag_id                    | str               | Id of the [`SnapshotTag`](#snapshottag) on the child. |
| tagged_configuration_id   | str               | Id of the child configuration the tag points at.      |
| tagged_configuration_name | str               |                                                       |
| tagged_snapshot_id        | str               | Id of the child snapshot the tag points at.           |
| is_archived               | bool              | Whether the underlying child system is archived.      |
| created_by_id             | str               |                                                       |
| created                   | datetime.datetime |                                                       |

## SubsystemLink

Lightweight reference to a child system (and optional tag) used by the branching API on [`System`](#system) — for example as the `subsystems` argument to `add_to_branch` and `remove_from_branch`. See [System composition](../04-systems.md#system-composition).

**Attributes:**

| Name   | Type                                  | Description                                                                       |
| ------ | ------------------------------------- | --------------------------------------------------------------------------------- |
| system | [System](#system)                     | The child system to link as a subsystem.                                          |
| tag    | Optional[[SnapshotTag](#snapshottag)] | Tag on the child system to pin to. Defaults to the child's baseline when omitted. |

## NewSnapshot

**Attributes:**

| Name    | Type           | Description |
| ------- | -------------- | ----------- |
| dry_run | Optional[bool] |             |

## NewSnapshotTag

**Attributes:**

| Name | Type | Description |
| ---- | ---- | ----------- |
| tag  | str  |             |

## UpdateSystem

**Attributes:**

| Name        | Type | Description |
| ----------- | ---- | ----------- |
| name        | str  |             |
| description | str  |             |

## UpdateTag

**Attributes:**

| Name        | Type | Description |
| ----------- | ---- | ----------- |
| snapshot_id | str  |             |

## DryRunSnapshot

**Attributes:**

| Name             | Type              | Description |
| ---------------- | ----------------- | ----------- |
| configuration_id | str               |             |
| sha              | str               |             |
| created_by_id    | str               |             |
| created          | datetime.datetime |             |

## ResponseCreateSnapshot

**Attributes:**

| Name                     | Type                                                                                                            | Description |
| ------------------------ | --------------------------------------------------------------------------------------------------------------- | ----------- |
| anyof_schema_1_validator | Optional[[Snapshot](#snapshot)]                                                                                 |             |
| anyof_schema_2_validator | Optional[[DryRunSnapshot](#dryrunsnapshot)]                                                                     |             |
| anyof_schema_3_validator | Optional[[NoOpResponse](jobs.md#noopresponse)]                                                                  |             |
| actual_instance          | Optional[Union[[DryRunSnapshot](#dryrunsnapshot), [NoOpResponse](jobs.md#noopresponse), [Snapshot](#snapshot)]] |             |
| any_of_schemas           | Set[str]                                                                                                        |             |

**Methods:**

| Name                                | Description |
| ----------------------------------- | ----------- |
| actual_instance_must_validate_anyof |             |

## UpstreamRemoteInfo

The receiving [secure connection](../../../users/admin-guide/secure-connections.md) a file was received over; embedded in [File](files.md#file).

**Attributes:**

| Name  | Type | Description |
| ----- | ---- | ----------- |
| id    | str  |             |
| label | str  |             |

## PageSystem

**Attributes:**

| Name  | Type                    | Description |
| ----- | ----------------------- | ----------- |
| items | List[[System](#system)] |             |
| total | Optional[int]           |             |
| page  | Optional[int]           |             |
| size  | Optional[int]           |             |
| pages | Optional[int]           |             |

## PageSystemConfiguration

**Attributes:**

| Name  | Type                                              | Description |
| ----- | ------------------------------------------------- | ----------- |
| items | List[[SystemConfiguration](#systemconfiguration)] |             |
| total | Optional[int]                                     |             |
| page  | Optional[int]                                     |             |
| size  | Optional[int]                                     |             |
| pages | Optional[int]                                     |             |

## PageSnapshot

**Attributes:**

| Name  | Type                        | Description |
| ----- | --------------------------- | ----------- |
| items | List[[Snapshot](#snapshot)] |             |
| total | Optional[int]               |             |
| page  | Optional[int]               |             |
| size  | Optional[int]               |             |
| pages | Optional[int]               |             |

## PageSnapshotItem

A paginated response object for listing snapshot items.

## PageSubsystem

**Attributes:**

| Name  | Type                          | Description |
| ----- | ----------------------------- | ----------- |
| items | List[[Subsystem](#subsystem)] |             |
| total | Optional[int]                 |             |
| page  | Optional[int]                 |             |
| size  | Optional[int]                 |             |
| pages | Optional[int]                 |             |

## PageSnapshotSubsystemItem

**Attributes:**

| Name  | Type                                                  | Description |
| ----- | ----------------------------------------------------- | ----------- |
| items | List[[SnapshotSubsystemItem](#snapshotsubsystemitem)] |             |
| total | Optional[int]                                         |             |
| page  | Optional[int]                                         |             |
| size  | Optional[int]                                         |             |
| pages | Optional[int]                                         |             |

## PageSnapshotTag

**Attributes:**

| Name  | Type                              | Description |
| ----- | --------------------------------- | ----------- |
| items | List[[SnapshotTag](#snapshottag)] |             |
| total | Optional[int]                     |             |
| page  | Optional[int]                     |             |
| size  | Optional[int]                     |             |
| pages | Optional[int]                     |             |

## PageConfigurationRevisionSearchItem

Page returned by [`list_configuration_revisions()`](../04-systems.md#list_configuration_revisions).

**Attributes:**

| Name  | Type                                      | Description       |
| ----- | ----------------------------------------- | ----------------- |
| items | list of `ConfigurationRevisionSearchItem` |                   |
| total | int                                       | Count, minimum 0. |
| page  | int                                       | Minimum 1.        |
| size  | int                                       | Minimum 1.        |
| pages | int                                       | Minimum 0.        |


---

<!-- Source: index.md -->

---
slug: /build/python
sidebar_label: Overview
sidebar_position: 0
title: Python Client
---

# Python Client

The **Python Client** (`istari-digital-client` on PyPI) is the supported way to drive the Istari Digital Platform from code. **Anything you can do through the platform's web UI, you can do from Python** — registering files, running extraction jobs, browsing systems and snapshots, managing access, working with agents and modules, and reading the digital thread that connects them all.

Use it to script one-off operations, automate recurring engineering work, or build new applications on top of platform data.

The package ships two clients that share one `Configuration`. `Client` covers jobs, agents, systems, snapshots, and access. `V3Client` is the resource API for models, artifacts, files, connected resources, revisions, comments, and relationships. Documents stay on `Client`. See the [V3Client quick start](./v3/01-quick-start.md). A **Key** from **Settings → Developer** authenticates either client. Scripts that still pass a personal access token: [Move a Python script from a PAT to a key](./move-from-pat-to-key.md).

## What you can build with it

Concrete examples we see customers reach for:

- **Automate engineering integrations.** Loop over hundreds of CAD or simulation files, register each one, run `@istari:extract` against the right tool, and collect the resulting artifacts — all in one script. See [Patterns](./02-patterns/index.md) for the building blocks.
- **Bulk import and migration.** Walk a network drive, register every supported file as a [Resource](../intro/key-concepts/resources.md), tag it, and place it in the right [System](../intro/key-concepts/systems.md).
- **Custom dashboards and reports.** Pull job histories, snapshot diffs, and model metadata into a notebook to produce engineering KPIs that aren't surfaced by the UI.
- **CI/CD for engineering data.** On every pull request, run an extraction against the changed model, compare the output to the baseline snapshot, and post a status check or comment.
- **Connect the platform to other tools.** Mirror snapshot tags into Jira, surface model changes in Slack, drive PLM updates from a job's output — with the client handling auth, retries, and pagination.
- **Programmatic access control.** Share systems with new project members, rotate control tag assignments, or audit who has access to a given snapshot.
- **Build new UIs on top of platform data.** Use the client as the data layer for a domain-specific tool that uses the same files, jobs, and systems as the rest of the organisation.

## What's in this section

| Page                                               | What it covers                                                                                                |
| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| [Setup](./01-setup.md)                             | Install the client and create a `Client` / `Configuration` (Keys first).                                      |
| [PAT to a key](./move-from-pat-to-key.md)          | Which change matches a script that still signs in with a personal access token.                               |
| [V3Client quick start](./v3/01-quick-start.md)     | When to reach for `V3Client`, the unified resource API, and how it relates to `Client`.                       |
| [Patterns](./02-patterns/index.md)                 | Reusable approaches for workflows, parameter studies, and combining operations into digital threads.          |
| [Branching](./04-branching.md)                     | Create System branches, commit Resources, and open or merge change requests from Python.                      |
| [Connected resources](./05-connected-resources.md) | Connect Resources that live in a third-party app, run jobs on them with a stored credential, and revise them. |
| [API reference](./api_reference/01-client.md)      | Every method on `Client` and `V3Client`, every parameter, every model. The exhaustive lookup.                 |

## Hands-on tutorial

If you'd rather learn by doing: [Python Client 201 — Your first System](../tutorials/automate/201-first-system.md) puts a CAD model on a System in one command. [Python Client 202 — First digital thread](../tutorials/automate/202-python-client.md) registers a spreadsheet, runs two extractions, and produces a diff.

:::tip
Want to see exactly what version of the client these pages document? See the version selector at the top of every Python Client page (or check the [PyPI release page](https://pypi.org/project/istari-digital-client/)).
:::


---

<!-- Source: linking-to-the-web-app.md -->

---
slug: /build/python/linking-to-the-web-app
sidebar_label: Linking to the web app
sidebar_position: 5
title: Linking to the web app
---

# Linking to the web app

Use these URL forms in a README, a chat message, or an integration when you want someone to open a System or Resource in the Istari Digital web app.

| Target                               | URL                                                                         |
| ------------------------------------ | --------------------------------------------------------------------------- |
| a System                             | `https://<host>/systems/<system_id>`                                        |
| a Resource on a branch               | `https://<host>/systems/<system_id>/<branch>/tree/m~<resource_id>?tab=file` |
| a specific revision of that Resource | `…/tree/m~<resource_id>?tab=file&rev=<file_revision_id>`                    |
| a workflow log entry                 | `https://<host>/systems/<system_id>?tab=workflow-log&entry=<entry_id>`      |
| a Resource without a System          | `https://<host>/resources/<resource_id>`                                    |
| a specific revision of that Resource | `https://<host>/resources/<resource_id>/<file_revision_id>`                 |
| an unparented artifact               | `https://<host>/resources/artifact/<artifact_id>`                           |

**Host.** `<host>` is the web app, not the API. Drop the service prefix from your Registry URL or API URL: `https://fileservice-v2.demo.istari.app` → `https://demo.istari.app`.

**Ids.** The `m~…` and `/resources/…` segments take the **Resource (model) id** — not the file id and not a revision id. A wrong id family loads the tree with nothing selected.

**Legacy `/files` links.** The web app redirects `/files/…` to the matching `/resources/…` path, preserving the query string and fragment, so older links keep working. Write new links against `/resources`.

**Branch.** `<branch>` is the tag name. A new System's default branch is `baseline`. Read the name back from the System's branches; do not assume `main`.

**Revision.** Put the revision in the `rev=` query parameter. Omit it to show the branch's committed revision. A `~<revision>` segment in the path is ignored.

**Resource type.** Upload anything people should open from the System tree as a **model**. A plain **file** Resource can appear in the tree and still fail to open from a link.

**Ids for links.** After a commit, read Resource ids from the branch's tracked files. Building a link from an upload return value can point at a Resource that was never tracked on the branch.

Python helpers that implement the host rule live in [`istari_quickstart_13_2_1.py`](pathname:///quickstart/istari_quickstart_13_2_1.py) (`ui_host`) and in the [`istari-links`](pathname:///skills/istari/istari-links/SKILL.md) skill.

## Related

- [Python Client 201 — Your first System](../tutorials/automate/201-first-system.md) — first System and README that uses these links
- [Folders in a System](./06-folders.md) — path encoding when you commit from Python
- [Systems](../users/user-guide/systems.md) — the same tree in the web app


---

<!-- Source: move-from-pat-to-key.md -->

---
slug: /build/python/move-from-pat-to-key
sidebar_label: PAT to a key
sidebar_position: 1.5
title: Move a Python script from a PAT to a key
---

# Move a Python script from a PAT to a key

:::warning Deprecated

Personal access tokens (PATs) are deprecated as of the July 2026 release. Keys replace them for programmatic access to the Istari Digital Platform. An existing PAT still signs in until it is revoked. On an instance where keys are available, a new PAT cannot be created. Support for PATs will be removed in a future release.

:::

A Python script signs in through `Configuration` on `Client` or `V3Client`. The change depends on how that object is built today, and on whether this instance has keys turned on. Every path on this page ends the same way: `Client(Configuration())` after the environment is loaded, with a key in that environment. Install and the credential screen are on [Setup](./01-setup.md).

## See whether this instance uses keys

Check this before you change a script. Any signed-in user can open the page.

In the web app, click your avatar, then **Settings** > **Developer**. The address on your instance is `/settings/developer`.

| What you see                                                                                                                                | Keys on this instance                                                          |
| ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| An **Access Keys** section is on the page. Under **Personal Access Tokens**, a banner reads **Personal Access Token creation is disabled**. | On. New credentials are keys. Continue with the case that matches your script. |
| **Generate New Token** is the button on **Personal Access Tokens**. The page has no **Access Keys** section.                                | Off. This instance still issues PATs. Keep the token you have.                 |

On the first row, the line under the **Personal Access Tokens** title is "Creation is disabled — use Access Keys for new credentials."

Keys need the [Identity Service](../icbs-install/03-control-plane/10-identity-service/01-Install-and-Configure.md). When the table says keys are off, ask an administrator to enable it before you create or exchange a key. Details of the cards: [Developer Settings — Keys](../users/user-guide/settings.md#developer-settings--keys).

## Where the script should end up

```python
from dotenv import load_dotenv
from istari_digital_client import Client, Configuration

load_dotenv()  # copies .env into the environment

client = Client(Configuration())
```

```text
ISTARI_DIGITAL_API_URL=<API URL from Endpoints>
ISTARI_CLIENT_IDENTITY_SERVICE_SECRET_FILE=/absolute/path/to/istari-credentials.json
ISTARI_DIGITAL_IDENTITY_SERVICE_ENABLED=true
```

`Configuration()` reads those names from the environment, so the credentials stay out of the source. The `ISTARI_CLIENT_` prefix on the file path is required. With that path and `ISTARI_DIGITAL_API_URL` set, Key authentication turns on even when `ISTARI_DIGITAL_IDENTITY_SERVICE_ENABLED` is absent. The sample sets it to `true` so the choice is explicit. Keep `.env` and the credentials file out of git.

**Download credentials** writes that file. The dialog names it `istari-credentials.json`; the saved name is `istari-credentials-<keyId>.json`. **Access Keys** is the section that lists it. The file itself holds three fields, and `key` is the private key, shown only in this download:

```json
{
  "clientId": "<client id>",
  "keyId": "<key id>",
  "key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
}
```

The **API URL** is in **avatar → Settings → Developer → Endpoints**. Full steps: [Setup — Credentials](./01-setup.md#credentials) and [Initialize the client](./01-setup.md#initialize-the-client).

Choose the heading that describes your current setup.

## If the PAT is written in your script

You are here when the constructor receives the PAT as `registry_auth_token`:

```python
from istari_digital_client import Client, Configuration

client = Client(Configuration(
    registry_url="https://your-instance.istari.digital",
    registry_auth_token="your-personal-access-token",
))
```

That call still signs in when the token was created for this instance, it has not been revoked, and the server still accepts PATs. A notebook cell that pastes the same string is the same case. Developer Settings will not issue a replacement PAT once [keys are on](#see-whether-this-instance-uses-keys).

Move the token out of the source:

1. Put the registry URL and the token in a `.env` file beside the script:

   ```text
   ISTARI_REGISTRY_URL=https://your-instance.istari.digital
   ISTARI_REGISTRY_AUTH_TOKEN=your-personal-access-token
   ```

   The **Registry URL** is in **Endpoints** on the same Developer page. See [Personal access tokens](./01-setup.md#personal-access-tokens).

2. Change the script to the `load_dotenv()` form in [Where the script should end up](#where-the-script-should-end-up). Drop `registry_url` and `registry_auth_token` from the constructor.

3. Confirm a call still succeeds. The script is still using the PAT; the token is just out of the source.

4. When [keys are on](#see-whether-this-instance-uses-keys), follow [Switch the environment to a key](#switch-the-environment-to-a-key). When keys are off, stop here and ask an administrator to enable the Identity Service.

## If your script expects a credentials file

You are here when the constructor names a key file:

```python
client = Client(Configuration(
    digital_api_url="https://api.your-instance.istari.app",
    identity_service_secret_file="/absolute/path/to/key.json",
    identity_service_enabled=True,
))
```

`identity_service_secret_file` is the path to that credentials file.

### The key file is already on disk

Pass that path and the **API URL**, with `identity_service_enabled=True`. The script signs in. Moving those three values into `.env`, as in [Where the script should end up](#where-the-script-should-end-up), keeps the path out of the source.

### You only have a PAT

Create a key, then point `identity_service_secret_file` at the file. This step needs [keys on](#see-whether-this-instance-uses-keys). When keys are off, keep signing in with `registry_auth_token` until an administrator enables the Identity Service.

Create the key in one of these ways:

#### Generate a key in the web app

1. Open **avatar → Settings → Developer** (`/settings/developer`).
2. In **Access Keys**, click **Generate Key**, then **Download credentials**. The credentials file is shown once.
3. Copy the **API URL** from **Endpoints** on the same page.
4. Pass that URL as `digital_api_url` and the downloaded file as `identity_service_secret_file`, with `identity_service_enabled=True`.

The dialog, expiration, and revoke control: [Developer Settings — Keys](../users/user-guide/settings.md#developer-settings--keys).

#### Exchange the PAT with the CLI

Use the CLI when the token should become a key file, including a token that was only ever in the Python script.

[Install the CLI](../icbs-install/05-CLI/01-get-started.md) if it is not on the machine. The exchange runs only when [keys are on](#see-whether-this-instance-uses-keys). The CLI also needs the API URL first. Both prerequisites, and the other flags, are on [PAT → Key Exchange](../icbs-install/05-CLI/04-exchanging-pat-for-key.md).

For the token from the script:

```sh
stari key exchange --pat "REPLACE_WITH_PAT" --output /path/to/create/key/file.json
```

That writes the key file and leaves the CLI config as it is. Point `identity_service_secret_file` at the file. Other flags — an existing key file, an agent token, rewriting the CLI's own config — are on that page. If the CLI is already signed in with this same PAT, `stari key exchange` with no arguments also switches the CLI; the guide covers that command.

The exchange leaves the PAT in place. Confirm the script signs in with the key, then revoke the token if nothing else uses it.

#### Exchange the PAT from Python

The client can run the same exchange when you do not want to install the CLI. Sign in once with `digital_api_url` and `registry_auth_token`, call `client.keys.generate_keypair_and_exchange()`, and write the file it returns. The call, and the single-string form for a secret manager, are on [Keys — Replace a personal access token](./api_reference/14-keys.md#replace-a-personal-access-token).

## If your script already loads credentials from the environment

You are here when the source does not name a token or a key file:

```python
from dotenv import load_dotenv
from istari_digital_client import Client, Configuration

load_dotenv()
client = Client(Configuration())
```

Keep this. Constructor arguments override the environment when one process talks to more than one instance; [Setup](./01-setup.md#passing-the-values-in-code) shows that form.

### The environment holds a PAT

These two names still work:

```text
ISTARI_REGISTRY_URL=https://your-instance.istari.digital
ISTARI_REGISTRY_AUTH_TOKEN=your-personal-access-token
```

`load_dotenv()` with no argument reads `.env` beside the script. Pass a path, `load_dotenv("path/to/file")`, when the names live in another file. The token itself is under [Personal access tokens](../users/user-guide/settings.md#developer-settings--personal-access-tokens).

### Switch the environment to a key

Create the key in the web app, or exchange the PAT with the CLI, using the options above. Then replace the two PAT lines with the three key lines in [Where the script should end up](#where-the-script-should-end-up).

Remove `ISTARI_REGISTRY_URL` and `ISTARI_REGISTRY_AUTH_TOKEN` after a call succeeds with the key. With the key path and `ISTARI_DIGITAL_API_URL` set, and `ISTARI_DIGITAL_IDENTITY_SERVICE_ENABLED` left unset, the key is what signs in, including when those PAT lines are still in the environment. Set `ISTARI_DIGITAL_IDENTITY_SERVICE_ENABLED=false` to keep the token while the key file is also configured.

## If a pipeline or secret manager provides the credentials

The script stays on `Client(Configuration())`. The pipeline or the secret manager sets the variables before the process starts.

- To keep the PAT for now, store `ISTARI_REGISTRY_URL` and `ISTARI_REGISTRY_AUTH_TOKEN`.
- To move to a key, store the key and set the three key variables. A store that takes one string uses `ISTARI_CLIENT_IDENTITY_SERVICE_SECRET` (the base64 form from `to_identity_service_secret()`). See [Keys](./api_reference/14-keys.md#replace-a-personal-access-token).

Each person uses their own key.

## If the CLI or an agent still uses a PAT

When `stari` or an agent is what still signs in with a PAT, follow [PAT → Key Exchange](../icbs-install/05-CLI/04-exchanging-pat-for-key.md). `stari key exchange` rewrites the CLI config. `stari key exchange --agent` does the same for an agent that already has a PAT.

## After the script signs in with a key

Revoke the PAT under **avatar → Settings → Developer** once no script, CLI, or agent still uses it. See [Revoke tokens](../users/user-guide/settings.md#revoke-tokens).

`Client.check_auth_deprecation()` reports whether this process is still signing in with a PAT on a server that accepts keys. See [PAT deprecation](./api_reference/01-client.md#pat-deprecation).


---

<!-- Source: v3/01-quick-start.md -->

---
slug: /build/python/v3/quick-start
sidebar_position: 1
sidebar_label: Quick start
---

# V3Client quick start

The `istari-digital-client` package ships two Python clients:

| Client     | Surface                                                                                                         |
| ---------- | --------------------------------------------------------------------------------------------------------------- |
| `Client`   | Jobs, agents, systems, snapshots, access control, modules, and functions.                                       |
| `V3Client` | Unified resource API for models, artifacts, files, connected resources, revisions, comments, and relationships. |

`V3Client` introduces a single **Resource** abstraction. Models, artifacts, and files share one create / list / get / archive / restore lifecycle, and `connected_container` and `connected_resource` are resource types on the same API. Documents stay on `Client`. Every resource carries an explicit revision history. `V3Client` also adds **relationships** between revisions.

Both clients coexist and share the same `Configuration`. Use `V3Client` for resource operations and `Client` for jobs, agents, systems, and access control. `V3Client` is the direction we're investing in; expect its surface to expand over time.

## Installation

Install from PyPI:

```bash
pip install istari-digital-client
```

## Initialize the clients

Both clients share one `Configuration`. `Configuration()` reads the key from the environment, the same way as [SDK setup](../01-setup.md#initialize-the-client):

```python
from dotenv import load_dotenv
from istari_digital_client import Client, V3Client, Configuration

load_dotenv()  # copies .env into the environment

config = Configuration()
client = Client(config)  # Jobs, agents, systems, access control
v3 = V3Client(config)    # Resources, revisions, comments, relationships
```

The `.env` names for the key are on [Credentials](../01-setup.md#credentials).

## Create a resource

Upload a file and register it as a resource in a single call. The `resource_type` field determines the classification.

```python
resource = v3.create_resource(
    path="/path/to/wing-stress.stl",
    resource_type="model",
    description="FEA model for wing stress testing",
    version_name="v1.0.0",
)
print(resource.resource_id)
```

## List and retrieve resources

```python
models = v3.list_resources(type_name=["model"])

resource = v3.get_resource(resource_id="<resource_id>")
```

## Add a revision

Create an explicit new revision on an existing resource:

```python
revision = v3.create_resource_revision(
    resource_id="<resource_id>",
    path="/path/to/wing-stress-v2.stl",
    description="Finer mesh near leading edge",
    version_name="v2.0.0",
)
```

## Browse revision history

```python
page = v3.list_resource_revisions(resource_id="<resource_id>")
for rev in page.items:
    print(rev.file_revision_id, rev.version_name, rev.created)
```

## Link revisions with relationships

Relationships connect revisions across resources — for example, linking a simulation output back to the model revision that produced it.

```python
from istari_digital_client.v3.models import NewRevisionRelationshipDto

types = v3.list_revision_relationship_types()

v3.create_revision_relationship(
    new_revision_relationship_dto=NewRevisionRelationshipDto(
        relationship_type_id=types.items[0].id,
        left_revision_id="<source_revision_id>",
        right_revision_id="<target_revision_id>",
    ),
)
```

## Use both clients together

`V3Client` and `Client` share the same resource IDs, so you can create a resource with `V3Client` and run a job on it with `Client`:

```python
resource = v3.create_resource(
    path="/path/to/model.stl",
    resource_type="model",
    description="My model",
)

job = client.add_job(
    model_id=resource.resource_id,
    function="@istari:extract",
    tool_name="siemens_nx",
    tool_version="2506",
    operating_system="Windows 11",
)
```

## What's next

- [V3Client reference](./v3-client.mdx) — full method signatures, parameters, and examples.
- [Migrating from `Client` to `V3Client`](./02-migration.mdx) — method mapping and incremental migration strategy.
- [Client reference](../api_reference/01-client.md) — `Client` methods for jobs, agents, systems, and access control.
- [Connected resources (V3Client)](./04-connected-resources.md) — register third-party Resources with metadata pointer files; run jobs with `Client`.
- [Connected resources (Client)](../05-connected-resources.md) — extensions, credentials, and revision updates.


---

<!-- Source: v3/02-migration.mdx -->

---
slug: /build/python/v3/migration
sidebar_position: 2
sidebar_label: Migrating to V3Client
---

# Migrating from `Client` to `V3Client`

`V3Client` introduces a unified **Resource** abstraction. Models, artifacts, and files share one lifecycle, and `connected_container` and `connected_resource` are resource types on the same API. Documents stay on [`Client`](../api_reference/11-documents.md). Resources are differentiated by a `resource_type` field: create, list, get, archive, restore.

:::info Backwards compatibility
`Client` and `V3Client` coexist. Both can be used in the same script — you do not need to migrate everything at once.
:::

## Architecture comparison

### Existing types via `Client`

Each type has its own dedicated methods on `Client`: `add_model`, `list_models`, `get_model`, `update_model`, `archive_model`, plus parallel sets for **artifacts**, **files**, and **comments**. **Documents** stay on `Client` ([Documents](../api_reference/11-documents.md)).

### Unified model via `V3Client`

`V3Client` exposes a single **Resource** abstraction with a `resource_type` discriminator:

| Existing type       | `V3Client` `resource_type` |
| ------------------- | -------------------------- |
| Model               | `"model"`                  |
| Artifact            | `"artifact"`               |
| File                | `"file"`                   |
| Connected container | `"connected_container"`    |
| Connected resource  | `"connected_resource"`     |

Comments are scoped to a resource and managed through `create_comment` / `list_comments` / `archive_comment` / `restore_comment`.

Every resource has a stable **resource ID**, an ordered list of **revisions**, and a **content token** on each revision.

## SDK setup

```python
from istari_digital_client import Configuration, Client, V3Client

config = Configuration(
    digital_api_url="https://api.your-instance.istari.app",
    identity_service_secret_file="/absolute/path/to/key.json",
    identity_service_enabled=True,
)

client = Client(config)    # Jobs, agents, systems, access control
v3 = V3Client(config)      # Resources, revisions, comments, relationships
```

## Method mapping

### Create a resource

**`Client`**

```python
model = client.add_model(
    path="/path/to/wing-stress.stl",
    description="FEA model for wing stress testing",
    version_name="v1.0.0",
)
```

**`V3Client`**

```python
resource = v3.create_resource(
    path="/path/to/wing-stress.stl",
    resource_type="model",
    description="FEA model for wing stress testing",
    version_name="v1.0.0",
)
```

### List resources

**`Client`**

```python
models    = client.list_models()
artifacts = client.list_artifacts()
files     = client.list_files()
```

**`V3Client`**

```python
all_resources = v3.list_resources()
models        = v3.list_resources(type_name=["model"])
```

### Get a resource

**`Client`**

```python
model    = client.get_model(model_id="<id>")
artifact = client.get_artifact(artifact_id="<id>")
file     = client.get_file(file_id="<id>")
```

**`V3Client`**

```python
resource = v3.get_resource(resource_id="<id>")
```

:::tip
Resource IDs carry over — the same UUIDs used by `Client` are the `resource_id` in `V3Client`.
:::

### Upload a new revision

With `Client`, updating a resource creates a revision implicitly. With `V3Client`, revisions are created explicitly.

**`Client`**

```python
model = client.update_model(
    model_id="<id>",
    path="/path/to/wing-stress-v2.stl",
    description="Finer mesh near leading edge",
    version_name="v2.0.0",
)
```

**`V3Client`**

```python
revision = v3.create_resource_revision(
    resource_id="<id>",
    path="/path/to/wing-stress-v2.stl",
    description="Finer mesh near leading edge",
    version_name="v2.0.0",
)
```

### List revisions

`Client` has no direct revision-list endpoint. `V3Client` exposes the full history:

```python
page = v3.list_resource_revisions(resource_id="<id>", size=10)
for rev in page.items:
    print(rev.file_revision_id, rev.version_name, rev.created)
```

### Archive and restore

**`Client`**

```python
client.archive_model(model_id="<id>")
client.restore_model(model_id="<id>")
```

**`V3Client`**

```python
v3.archive_resource(resource_id="<id>")
v3.restore_resource(resource_id="<id>")
```

### Comments

**`Client`** — comments are a separate top-level resource:

```python
comment  = client.add_comment(resource_id="<id>", path="/path/to/comment.json", description="Review notes")
comments = client.list_model_comments(model_id="<id>")
```

**`V3Client`** — comments are scoped to a resource:

```python
comment = v3.create_comment(resource_id="<id>", path="/path/to/comment.json")
page    = v3.list_comments(resource_id="<id>")
```

### Relationships (`V3Client` only)

Relationships link revisions across resources. There is no `Client` equivalent.

```python
from istari_digital_client.v3.models import NewRevisionRelationshipDto

types = v3.list_revision_relationship_types()

v3.create_revision_relationship(
    new_revision_relationship_dto=NewRevisionRelationshipDto(
        relationship_type_id=types.items[0].id,
        left_revision_id="<source_revision_id>",
        right_revision_id="<target_revision_id>",
    ),
)

page = v3.list_revision_relationships(revision_id="<revision_id>")
```

### Download a file

`get_content` returns the raw bytes for a resource, revision, or comment that has a content token:

```python
resource = v3.get_resource(resource_id="<id>")
data = v3.get_content(resource)
print(len(data))
```

## Capabilities only available via `Client`

Use `Client` for these — they have no `V3Client` equivalent yet:

| Capability             | `Client` methods                                     |
| ---------------------- | ---------------------------------------------------- |
| Jobs                   | `add_job`, `get_job`, `list_jobs`                    |
| Agents and pools       | `register_agent`, `list_agents`, `create_agent_pool` |
| Systems and snapshots  | `create_system`, `create_snapshot`                   |
| Modules and functions  | `list_functions`, `list_modules`                     |
| Access control         | `create_access`, `update_access`                     |
| Personal access tokens | `create_personal_access_token`                       |
| Users                  | `list_users`, `get_current_user`                     |
| Control tags           | `create_control_tag`                                 |
| Auth integrations      | `create_auth_integration`                            |

## Migration strategy

Use `V3Client` for resource operations (create, list, get, revisions, comments) and keep `Client` for everything else:

```python
resource = v3.create_resource(
    path="/path/to/model.stl",
    resource_type="model",
    description="My model",
)

job = client.add_job(
    model_id=resource.resource_id,
    function="@istari:extract",
    tool_name="siemens_nx",
    tool_version="2506",
    operating_system="Windows 11",
)
```

**Incremental path:**

1. **New scripts** — use `V3Client` for resource CRUD; keep `Client` for jobs, agents, and access control.
2. **Existing scripts** — migrate resource creation, listing, and download calls to `V3Client`; leave job and agent logic on `Client`.
3. **Capabilities only on `Client`** — jobs, systems, agents, and access control remain on `Client` until `V3Client` coverage expands.

## Full method map

| `Client` method                              | `V3Client` equivalent                                         |
| -------------------------------------------- | ------------------------------------------------------------- |
| `add_model(path=...)`                        | `create_resource(path=..., resource_type="model")`            |
| Connected model (metadata pointer file)      | Same — see [Connected resources](./04-connected-resources.md) |
| `add_artifact(model_id=..., path=...)`       | `create_resource(path=..., resource_type="artifact")`         |
| `get_model(model_id=...)`                    | `get_resource(resource_id=...)`                               |
| `get_artifact(artifact_id=...)`              | `get_resource(resource_id=...)`                               |
| `get_file(file_id=...)`                      | `get_resource(resource_id=...)`                               |
| `list_models()`                              | `list_resources(type_name=["model"])`                         |
| `list_artifacts()`                           | `list_resources(type_name=["artifact"])`                      |
| `list_files()`                               | `list_resources(type_name=["file"])`                          |
| `update_model(model_id=..., path=...)`       | `create_resource_revision(resource_id=..., path=...)`         |
| `update_artifact(artifact_id=..., path=...)` | `create_resource_revision(resource_id=..., path=...)`         |
| `update_file(file_id=..., path=...)`         | `create_resource_revision(resource_id=..., path=...)`         |
| `archive_model(model_id=...)`                | `archive_resource(resource_id=...)`                           |
| `restore_model(model_id=...)`                | `restore_resource(resource_id=...)`                           |
| `archive_artifact(artifact_id=...)`          | `archive_resource(resource_id=...)`                           |
| `restore_artifact(artifact_id=...)`          | `restore_resource(resource_id=...)`                           |
| `archive_file(file_id=...)`                  | `archive_resource(resource_id=...)`                           |
| `restore_file(file_id=...)`                  | `restore_resource(resource_id=...)`                           |
| `list_model_comments(model_id=...)`          | `list_comments(resource_id=...)`                              |
| `list_artifact_comments(artifact_id=...)`    | `list_comments(resource_id=...)`                              |
| `add_comment(resource_id=..., path=...)`     | `create_comment(resource_id=..., path=...)`                   |
| `archive_comment(comment_id=...)`            | `archive_comment(resource_id=..., comment_id=...)`            |
| `restore_comment(comment_id=...)`            | `restore_comment(resource_id=..., comment_id=...)`            |
| _(no equivalent)_                            | `list_resource_revisions(resource_id=...)`                    |
| _(no equivalent)_                            | `get_resource_revision(resource_id=..., revision_id=...)`     |
| _(no equivalent)_                            | `create_revision_relationship(...)`                           |
| _(no equivalent)_                            | `list_revision_relationships(...)`                            |


---

<!-- Source: v3/03-workflow-logs.md -->

---
slug: /build/python/v3/workflow-logs
sidebar_position: 3
sidebar_label: External workflow logs
---

# External workflow logs

External workflow logs record runs of work performed _outside_ Istari — a verification script on your workstation, a CI job, a batch run on an HPC cluster — against the system the work targeted. Output files are uploaded back to the system as **workflow outputs**, and a **workflow log entry** ties the run together with a title, status, and, when applicable, configuration and branch provenance from the time of the run.

External workflows are distinct from Istari **jobs**, which run on Istari agents and are scheduled and tracked end-to-end by the platform. With external workflows, the work happens wherever you run it; Istari stores the record and the outputs.

## A typical run

A common pattern: pull a tracked file from a system, do some work locally, then upload the artifacts and a single log entry back to Istari.

### Initialize the clients

```python
from istari_digital_client import Client, V3Client, Configuration

config = Configuration(
    digital_api_url="https://api.your-instance.istari.app",
    identity_service_secret_file="/absolute/path/to/key.json",
    identity_service_enabled=True,
)

client = Client(config)
v3 = V3Client(config)
```

### Pull the source from the system

`get_file` is deprecated in 13.1.9 and warns. It still returns the `File` whose latest revision this example reads. The lookup on `V3Client` is [`get_resource`](./v3-client.mdx#get_resource); bytes come back from [`get_content`](./v3-client.mdx#get_content).

```python
file = client.get_file(file_id="<file_id>")
source_bytes = file.revisions[-1].read_bytes()
```

### Upload your outputs

Once your workflow has produced one or more files on disk, register each as a workflow output:

```python
output_ids = []
for path in ["out/results.xml", "out/summary.json", "out/plot.png"]:
    output = v3.create_workflow_output(system_id="<system_id>", path=path)
    output_ids.append(output.id)
```

### Create the log entry

```python
from istari_digital_client.v3.models import WorkflowLogEntryCreateDto

entry = v3.create_workflow_log_entry(
    system_id="<system_id>",
    workflow_log_entry_create_dto=WorkflowLogEntryCreateDto(
        title="Design verification — iter-1",
        status="FAILED",          # SUCCESS | FAILED | UNSPECIFIED
        configuration_id="<configuration_id>",
        branch_id="<branch_id>",   # omit for runs on the baseline branch
        workflow_output_ids=output_ids,
    ),
)
```

The entry now appears on the system's **Workflows** tab.

## Branch provenance

`branch_id` records which branch the run was performed on. If you omit `branch_id`, Istari records the system's baseline (default) branch — see [Branches](../../users/user-guide/branches.md). For a run on any non-baseline branch, pass `branch_id` explicitly.

Unless `branchless=True`, `configuration_id` is required, and it must be reachable in that branch's history. Istari validates branch history rather than only the branch's current head, so a workflow can still be recorded correctly if the branch advances before the workflow finishes.

For workflows that are not tied to one branch or configuration state, set `branchless=True` and omit both `configuration_id` and `branch_id`:

```python
entry = v3.create_workflow_log_entry(
    system_id="<system_id>",
    workflow_log_entry_create_dto=WorkflowLogEntryCreateDto(
        title="Nightly compliance sweep",
        status="SUCCESS",
        branchless=True,
        workflow_output_ids=output_ids,
    ),
)
```

Workflow log responses include:

- `branch_id`: the branch recorded for the run, or `None` for workflows not tied to a branch state.
- `branch_name`: the stored branch name for display, or `None` for branchless entries.
- `branch_revision_id`: the branch-history revision that links the workflow to the recorded configuration, or `None` when no branch revision is recorded.

## `status` and `workflow_type`

Use one of `SUCCESS`, `FAILED`, or `UNSPECIFIED` for `status` — these are the values the Workflow log tab renders with the appropriate icon and colour. `UNSPECIFIED` is the default if you omit the field.

`workflow_type` should be `"external"` for runs created by the SDK against an external workflow. It is also the default if you omit the field.

## Outputs and entries

A workflow log entry owns its outputs. Create the outputs first, then create one entry that references them — a single workflow run should map to a single entry that holds all of its outputs.

## Listing and reading entries

```python
page = v3.list_workflow_log_entries(
    system_id="<system_id>",
    branch_id=["<branch_id>"],  # optional exact branch filter
)
for entry in page.items:
    print(entry.created, entry.status, entry.title, entry.branch_name)

detail = v3.get_workflow_log_entry(system_id="<system_id>", entry_id="<entry_id>")
print(detail.branch_id, detail.branch_revision_id)
for output in detail.workflow_outputs:
    print(output.name, output.size)
```

## What's next

- [V3Client reference](./v3-client.mdx#workflow-logs) — `create_workflow_output`, `create_workflow_log_entry`, list, get, archive, and restore.
- [Workflow log](../../users/user-guide/workflow-log.md) — viewing entries in the web app.


---

<!-- Source: v3/04-connected-resources.md -->

---
slug: /build/python/v3/connected-resources
sidebar_label: Connected resources
sidebar_position: 4
---

# Connected resources (V3Client)

A **connected Resource** is a link to data in a third-party app. You connect it by uploading a **metadata pointer file** with **`V3Client`**. The platform stores the pointer; the engineering bytes stay in the third-party app until an agent fetches them for a job.

Use **`V3Client`** to connect Resources and manage revisions. Use **`Client`** to run jobs — resource ids are shared between both clients. This page follows the same order as the `Client` version: **connect**, **run jobs**, then **revise**.

For upload vs connect, metadata extensions, credentials, and Windchill pointer details, see [Connected resources (Client)](../05-connected-resources.md). An administrator connects each third-party app once before its data can be reached — see [App Integrations](../../users/admin-guide/app-integrations.md).

## Prerequisites

- **Python Client** — installed, and a `Configuration` from [Setup → Initialize the client](../01-setup.md#initialize-the-client).
- **App integration (admin)** — an administrator connects the target app once in the web app. See [App Integrations](../../users/admin-guide/app-integrations.md).
- **A stored credential** — needed to _run jobs_ on the Resource, not to connect it. See [Run jobs on a third-party Resource](#run-jobs-on-a-third-party-resource).
- **Host app access** — the agent account must be able to open the external object. See [Connecting files](../../integrations/07-Third%20Party%20App%20Integrations/02-connect_files.mdx).

## Connect a third-party Resource

1. Create a JSON metadata pointer file (see [Metadata extensions](../05-connected-resources.md#metadata-extensions)).
2. Call `v3.create_resource(path=..., resource_type="model")` (or `"artifact"` / `"file"` when the pointer is that type). [`ResourceTypeDto`](../api_reference/08-enums.md#resourcetypedto) also includes `connected_container` and `connected_resource` for content the platform observes at a [connected source](./05-connected-sources.md).

The `path` is the same metadata file you would pass to `client.add_model(path=...)`.

Both clients take the same `Configuration`. Create it once as shown in [Setup → Initialize the client](../01-setup.md#initialize-the-client), then build both from it — the examples below assume `client` and `v3`:

```python
from istari_digital_client import Client, V3Client

client = Client(config)  # runs jobs
v3 = V3Client(config)  # connects Resources and manages revisions
```

### Example: Teamwork Cloud (Cameo)

Save a metadata pointer file (for example `my_project.istari_teamwork_cloud_metadata_mdzip`). Either shape below works:

**By project name, branch, and version:**

```json
{
  "project_name": "Istari_UAVOne(notional)",
  "branch_name": "trunk",
  "version": "11"
}
```

**By identifier URI:**

```json
{
  "identifier": "mdel://ANY?projectID=twcloud:/cf16d07a-9a9f-43dd-8ad9-bee73d9e2581/9903a418-e792-4a69-9add-dc01fe2f57de&serverType=esiserver&serverName=10.30.102.103&projectName=Istari_UAVOne(notional)&elementName=ANY_NAME"
}
```

Connect it:

```python
resource = v3.create_resource(
    path="my_project.istari_teamwork_cloud_metadata_mdzip",
    resource_type="model",
    display_name="TWC — Systems model",
    description="Connected Teamwork Cloud project",
)
print(resource.resource_id)
```

### Example: Windchill (via Creo module)

Save `input.istari_windchill_metadata` with the `oid` from the Windchill URL — see [Connected resources (Client)](../05-connected-resources.md#example-windchill-via-creo-module).

```python
resource = v3.create_resource(
    path="input.istari_windchill_metadata",
    resource_type="model",
    display_name="Windchill CAD",
)
```

## Run jobs on a third-party Resource

`V3Client` does not run functions. Pass `resource.resource_id` as `model_id` on **`Client.add_job`**, and bind a stored credential with **`auth_bindings`** when the function declares an authentication input:

```python
from istari_digital_client import NewCredentialBinding

twc_credential = next(
    c for c in client.list_credentials() if c.name == "My Teamwork Cloud account"
)

job = client.add_job(
    model_id=resource.resource_id,
    function="@istari:twc_extract",
    tool_name="dassault_cameo",
    tool_version="2022x Refresh2",
    operating_system="Windows 11",
    auth_bindings=[
        NewCredentialBinding(
            input_name="twc_auth_login",
            credential_id=twc_credential.id,
        )
    ],
)
```

The credential model is the same as on `Client` — see [Run jobs on a third-party Resource](../05-connected-resources.md#run-jobs-on-a-third-party-resource). Poll and read outputs with `get_job`, `get_model`, and the artifact helpers — see [Jobs](../api_reference/03-jobs.md) and [Use both clients together](./01-quick-start.md#use-both-clients-together).

## Revise a third-party Resource

When the link points somewhere new, upload an updated metadata file. The **resource id** stays the same:

```python
revision = v3.create_resource_revision(
    resource_id=resource.resource_id,
    path="my_project_v2.istari_teamwork_cloud_metadata_mdzip",
    version_name="link-2026-04",
    description="Point at TWC version 12",
)
```

This matches `client.update_model(model_id=..., path=...)` on **`Client`**.

To inspect what is there now — including the revision the platform imported after a job that wrote back to the third-party app:

```python
page = v3.list_resources(type_name=["model"])
resource = v3.get_resource(resource_id=resource.resource_id)

for rev in v3.list_resource_revisions(resource_id=resource.resource_id).items:
    print(rev.file_revision_id, rev.version_name, rev.name, rev.created)
```

## Related documentation

- [Connected resources (Client)](../05-connected-resources.md) — extensions, credentials, and `auth_bindings`
- [App Integrations](../../users/admin-guide/app-integrations.md) — connecting an app and creating service accounts
- [V3Client reference](./v3-client.mdx) — `create_resource`, `create_resource_revision`
- [Migrating from Client to V3Client](./02-migration.mdx)


---

<!-- Source: v3/05-connected-sources.md -->

---
slug: /build/python/v3/connected-sources
sidebar_position: 5
sidebar_label: Connected sources
---

# Connected sources

A connected source is a third-party system the platform observes. You create the source against an auth integration, browse it, then connect one external file or a container (a folder-like selection). The platform tracks what is there and syncs it.

[`ResourceTypeDto`](../api_reference/08-enums.md#resourcetypedto) values for this surface are `connected_resource` and `connected_container`.

Uploading a local metadata-pointer file as a model, artifact, or file is [Connected resources](./04-connected-resources.md). Secure Connections to a partner deployment are [Remote connections](./v3-client.mdx#remote-connections) on the `V3Client` reference.

Methods below are on `V3Client`.

## Sources

### create_connected_source()

Creates a connected source.

- **Parameters:**
  - **connected_source_create_dto** (`ConnectedSourceCreateDto`) – (required). `connector_key` and `auth_integration_id` are required. Optional: `name`, `probe_policy`, `credential_kind`.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `ConnectedSourceDto`

### get_connected_source()

- **Parameters:**
  - **connected_source_id** (_str_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `ConnectedSourceDto`

### list_connected_sources()

- **Parameters:**
  - **show_archived** (_bool_, _optional_)
  - **cursor** (_str_, _optional_)
  - **size** (_int_, _optional_)
  - **include_total** (_bool_, _optional_)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `CursorPageConnectedSourceDto`

### archive_connected_source()

- **Parameters:**
  - **connected_source_id** (_str_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `ConnectedSourceDto`

### browse_connected_source()

Lists entries under a locator. `locator` is a JSON-encoded, connector-specific address. `depth` defaults to 1 (direct children). A container that does not fit the response comes back with `children` null so you can browse it yourself.

- **Parameters:**
  - **connected_source_id** (_str_) – (required)
  - **locator** (_str_) – JSON-encoded address. (required)
  - **depth** (_int_, _optional_) – Minimum 1. Default 1.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** list of `BrowseEntryDto`

## Connections

A connection is one external file (`create_connection`) or the handle you use to read status, lineage, and selection.

### create_connection()

Connects a single external file.

- **Parameters:**
  - **connected_source_id** (_str_) – (required)
  - **connected_resource_create_dto** (`ConnectedResourceCreateDto`) – (required). `connector` and `locator` (a dict) are required. `name` is optional.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `ConnectedResourceDto`

### get_connection()

- **Parameters:**
  - **connected_resource_id** (_str_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `ConnectedResourceDto`

### list_connections()

- **Parameters:**
  - **connected_source_id** (_str_, _optional_)
  - **root_containers_only** (_bool_, _optional_)
  - **show_archived** (_bool_, _optional_)
  - **cursor** (_str_, _optional_)
  - **size** (_int_, _optional_)
  - **include_total** (_bool_, _optional_)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `CursorPageConnectedResourceDto`

### delete_connection()

Soft-stops a connection.

- **Parameters:**
  - **connected_resource_id** (_str_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `ConnectedResourceDto`

### browse_connection()

Browses an existing container connection. `depth` defaults to 1.

- **Parameters:**
  - **connected_resource_id** (_str_) – (required)
  - **depth** (_int_, _optional_)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** list of `BrowseEntryDto`

### sync_connection()

Syncs a connection now.

- **Parameters:**
  - **connected_resource_id** (_str_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `ConnectedResourceStatusDto`

### get_connection_status()

- **Parameters:**
  - **connected_resource_id** (_str_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `ConnectedResourceStatusDto`

### get_connection_lineage()

Returns the ancestor containers of a connection.

- **Parameters:**
  - **connected_resource_id** (_str_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** list of `LineageEntryDto`

### download_connected_content()

Downloads a connected revision. `t` is a signed, short-lived grant. The generated method declares a `None` return: the HTTP 200 body has no schema, and the client reads and discards it.

- **Parameters:**
  - **file_revision_id** (_str_) – Connected resource revision. (required)
  - **t** (_str_) – Signed grant. (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `None`

## Containers

### create_container()

Commits a recursive selection under a connected source and creates a connected container. `children` is the full list of checked provider child ids (files and folders, at every depth), at most 1000 entries.

- **Parameters:**
  - **connected_source_id** (_str_) – (required)
  - **connected_container_create_dto** (`ConnectedContainerCreateDto`) – (required). `connector`, `locator`, and `children` are required. Optional: `name`, `granularity`, `extraction_mode`, `prefer_recursive_list`, `subscribe`.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `ConnectedContainerDto`

### get_connection_selection()

Returns a container connection's include-list.

- **Parameters:**
  - **connected_resource_id** (_str_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `ContainerSelectionDto`

### update_connection_selection()

Adds and/or removes provider child ids. Removal stops future syncing and marks the membership removed. It does not delete the underlying resource.

- **Parameters:**
  - **connected_resource_id** (_str_) – (required)
  - **selection_update_dto** (`SelectionUpdateDto`) – (required). Optional lists `add` and `remove`.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `ContainerSelectionDto`

### list_container_snapshots()

Lists a container connection's snapshots.

- **Parameters:**
  - **connected_resource_id** (_str_) – (required)
  - **file_revision_id** (_str_, _optional_)
  - **cursor** (_str_, _optional_)
  - **size** (_int_, _optional_)
  - **include_total** (_bool_, _optional_)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `CursorPageContainerSnapshotDto`

### list_container_snapshot_children()

Lists what one container snapshot froze.

- **Parameters:**
  - **connected_resource_id** (_str_) – (required)
  - **snapshot_id** (_str_) – (required)
  - **claimed_by_me** (_bool_, _optional_) – When true, only children the caller had selected when this snapshot was taken.
  - **cursor** (_str_, _optional_)
  - **size** (_int_, _optional_)
  - **include_total** (_bool_, _optional_)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `CursorPageContainerSnapshotChildDto`


---

<!-- Source: v3/06-notifications.md -->

---
slug: /build/python/v3/notifications
sidebar_position: 6
sidebar_label: Notifications
---

# Notifications

Read and update the signed-in user's inbox from `V3Client`. The same inbox in the web app is [Notifications](../../users/user-guide/notifications.md).

`list_notifications()` polls for items that arrived since the last call. `list_inbox_items()` reads the persisted inbox, with filters.

## Event types

`list_inbox_items(event_type=…)` and `BulkInboxActionDto.filter_event_type` take one of these values:

| `event_type`                                  | Meaning                                                                                                                                            |
| --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `notification.user.received_resource.shared`  | A resource was shared in over a receiving connection. The event carries the revision's `display_name`, plus `file_extension` and `file_size`.      |
| `notification.user.received_resource.updated` | A received resource gained a new revision from its sender. The event carries the revision's `display_name`, plus `file_extension` and `file_size`. |
| `notification.user.received_resource.revoked` | The sender revoked a received resource. The event carries the connection, the local resource id and type, and when the revoke happened.            |
| `notification.user.workflow_log.completed`    | A workflow log entry completed. The event carries `status`.                                                                                        |
| `notification.user.change_request.opened`     | A change request was opened on a System.                                                                                                           |
| `notification.user.job.terminal_state`        | A job reached a terminal state: `Completed`, `Failed`, or `Canceled`. The event carries `job_id` and `terminal_state`.                             |
| `notification.user.access.granted`            | Access was granted on a resource. The event carries `granted_user_id`, `resource_id`, and `permission_level`.                                      |

## Inbox

### list_inbox_items()

- **Parameters:**
  - **cursor** (_str_, _optional_)
  - **size** (_int_, _optional_)
  - **read** (_bool_, _optional_)
  - **done** (_bool_, _optional_)
  - **archived** (_bool_, _optional_)
  - **event_type** (_str_, _optional_) – One of the [event types](#event-types).
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `InboxPageDto`

### get_inbox_item()

- **Parameters:**
  - **item_id** (_str_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `InboxItemDto`

### update_inbox_item()

Sets read and/or done. At least one of `read` or `done` must be set. `done=True` also sets the item read.

- **Parameters:**
  - **item_id** (_str_) – (required)
  - **mark_inbox_item_dto** (`MarkInboxItemDto`) – (required). Optional booleans `read` and `done`.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `InboxItemDto`

### bulk_action_inbox_items()

Applies one action to every item that matches a filter. The body does not take a list of ids.

- **Parameters:**
  - **bulk_inbox_action_dto** (`BulkInboxActionDto`) – (required). Filters: `filter_read`, `filter_done`, `filter_archived`, `filter_event_type` (one of the [event types](#event-types)). Actions: `read`, `done`, `archived`.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `BulkInboxActionResultDto`

### archive_inbox_item()

- **Parameters:**
  - **item_id** (_str_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `None`

### restore_inbox_item()

- **Parameters:**
  - **item_id** (_str_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `InboxItemDto`

## Poll

### list_notifications()

Polls new inbox items since the previous call.

- **Parameters:**
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `NotificationPageDto`


---

<!-- Source: v3/07-ai.md -->

---
slug: /build/python/v3/ai
sidebar_position: 7
sidebar_label: AI chat
---

# AI chat

Conversations, steering text, and LLM endpoint administration on `V3Client`. Chat in the web app is [AI Chat](../../icbs-build-ai/ai-chat.md).

LLM administration (`ai_config_*`) is an operator surface: endpoints, models, failover order, and the identical-tool-call guard. `ai_config_set_llm_auto_switch` stores the failover flag. The client documents that flag as stored only; the platform does not enforce it yet.

## Conversations

### create_ai_conversation()

- **Parameters:**
  - **create_conversation_request** (`CreateConversationRequest`) – (required). Optional `title` (max 256 characters).
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `AiConversationDto`

### list_ai_conversations()

- **Parameters:**
  - **q** (_str_, _optional_) – Search string.
  - **include_archived** (_bool_, _optional_)
  - **cursor** (_str_, _optional_)
  - **size** (_int_, _optional_)
  - **include_total** (_bool_, _optional_)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `CursorPageAiConversationDto`

### update_ai_conversation()

- **Parameters:**
  - **conversation_id** (_str_) – (required)
  - **update_conversation_request** (`UpdateConversationRequest`) – (required). Optional `title` (max 256 characters) and `archived`.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `AiConversationDto`

### list_ai_conversation_messages()

- **Parameters:**
  - **conversation_id** (_str_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** list of `AiMessageDto`

### append_ai_conversation_message()

- **Parameters:**
  - **conversation_id** (_str_) – (required)
  - **append_message_request** (`AppendMessageRequest`) – (required). `role` is `user`, `assistant`, or `system`. `content` is required.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `AiMessageDto`

### ai_chat()

Sends a chat turn to the configured LLM.

- **Parameters:**
  - **chat_request** (`ChatRequest`) – (required). `messages` is a non-empty list of `{role, content}`. `system_prompt` is optional.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `ChatResponse`

### ai_list_user_models()

Lists models the caller can select in chat.

- **Parameters:**
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `UserSelectableModelsResponse`

## Steering and tenant AI config

### get_ai_user_steering()

Returns the caller's steering text.

- **Return Type:** `UserSteeringDto`

### update_ai_user_steering()

Sets the caller's steering text. `steering_prompt` null clears it (max 2000 characters).

- **Parameters:**
  - **update_user_steering_request** (`UpdateUserSteeringRequest`) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `UserSteeringDto`

### get_ai_config()

Returns the tenant AI configuration.

- **Return Type:** `AiConfigDto`

### update_ai_config()

Patches the tenant AI configuration. A field left null is unchanged.

- **Parameters:**
  - **ai_config_update_request** (`AiConfigUpdateRequest`) – (required). Optional: `steering_prompt`, `system_prompt_delivery` (`system_role` or `user_turn`), `tool_mode` (`native` or `prompt`), `user_steering_enabled`.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `AiConfigDto`

## LLM endpoints and models

### ai_config_list_available_hosts()

Lists host slots an endpoint can use.

- **Return Type:** `AvailableHostsResponse`

### ai_config_list_llm_endpoints()

Lists endpoints and their model configurations.

- **Return Type:** `LlmConfigResponse`

### ai_config_create_llm_endpoint()

- **Parameters:**
  - **upsert_endpoint_request** (`UpsertEndpointRequest`) – (required). `name`, `slot`, and `enabled`.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `LlmEndpointDto`

### ai_config_update_llm_endpoint()

- **Parameters:**
  - **endpoint_id** (_str_) – (required)
  - **upsert_endpoint_request** (`UpsertEndpointRequest`) – (required). `name`, `slot`, and `enabled`.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `LlmEndpointDto`

### ai_config_delete_llm_endpoint()

Deletes an endpoint and its model configurations.

- **Parameters:**
  - **endpoint_id** (_str_) – (required)
  - **expected_revision** (_int_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** object

### ai_config_create_llm_model()

Adds a model to an endpoint.

- **Parameters:**
  - **endpoint_id** (_str_) – (required)
  - **upsert_model_request** (`UpsertModelRequest`) – (required). Required: `name`, `model_id`, `disable_system_prompt`, `disable_native_tools`, `enabled`, `user_selectable`. Optional: `path`, `max_iterations`, `carry_tool_context`, `return_thinking_blocks`, `carry_tool_max_calls`, `carry_tool_max_chars`, `carry_args_max_chars`, `extra_params`.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `LlmModelDto`

### ai_config_update_llm_model()

- **Parameters:**
  - **model_pk** (_str_) – (required)
  - **upsert_model_request** (`UpsertModelRequest`) – (required). Same fields as create.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `LlmModelDto`

### ai_config_delete_llm_model()

- **Parameters:**
  - **model_pk** (_str_) – (required)
  - **expected_revision** (_int_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** object

### ai_config_reorder_llm_model()

Sets a model's place in the failover priority list.

- **Parameters:**
  - **model_pk** (_str_) – (required)
  - **reorder_model_request** (`ReorderModelRequest`) – (required). `position` and `expected_revision`.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `LlmModelDto`

### ai_config_set_llm_auto_switch()

Stores whether availability-based model failover is enabled. The value is stored only; the platform does not enforce it yet.

- **Parameters:**
  - **set_auto_switch_request** (`SetAutoSwitchRequest`) – (required). `enabled`.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `SetAutoSwitchRequest`

### ai_config_set_llm_max_identical_tool_calls()

Sets the cluster-wide cap on identical tool calls.

- **Parameters:**
  - **set_max_identical_tool_calls_request** (`SetMaxIdenticalToolCallsRequest`) – (required). `max_identical_tool_calls`.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `SetMaxIdenticalToolCallsRequest`


---

<!-- Source: v3/08-search-and-favorites.md -->

---
slug: /build/python/v3/search-and-favorites
sidebar_position: 8
sidebar_label: Search and favorites
---

# Search and favorites

Look up platform objects and remember the ones the caller starred. Methods are on `V3Client`. Search in the web app is [Search](../../users/user-guide/search.md).

Starring a Secure Connection is [`favorite_connection()`](./v3-client.mdx#favorite_connection) on the `V3Client` reference, next to the other remote calls. `list_favorites` covers systems and resources.

## Search

### search()

Searches resources, systems, jobs, modules, and functions.

- **Parameters:**
  - **q** (_str_) – Query. (required)
  - **entity_type** (`SearchEntityType`, _optional_) – `resource`, `system`, `job`, `module`, or `function`.
  - **size** (_int_, _optional_)
  - **cursor** (_str_, _optional_)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `SearchPage`

### list_suggested_items()

Lists systems and resources the platform suggests for the caller.

- **Parameters:**
  - **item_type** (_list_ of `SuggestedItemType`, _optional_) – `system`, `resource`.
  - **signal** (_list_ of `SuggestionSignal`, _optional_) – `recently_viewed`, `recently_created_by_me`, `recently_favorited`, `recently_shared_with_me`. `recently_shared_with_me` applies to resources only.
  - **size** (_int_, _optional_) – Maximum items per group, 1–50.
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `SuggestedItemsDto`

## Favorites

### favorite_resource()

- **Parameters:**
  - **resource_id** (_str_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `None`

### unfavorite_resource()

- **Parameters:**
  - **resource_id** (_str_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `None`

### favorite_system()

- **Parameters:**
  - **system_id** (_str_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `None`

### unfavorite_system()

- **Parameters:**
  - **system_id** (_str_) – (required)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `None`

### list_favorites()

- **Parameters:**
  - **favorite_type** (`FavoriteType`, _optional_) – `system` or `resource`.
  - **cursor** (_str_, _optional_)
  - **size** (_int_, _optional_)
  - **include_total** (_bool_, _optional_)
  - **http_request_timeout_secs** (_int_, _optional_)

- **Return Type:** `CursorPageFavoriteDto`

### list_favorite_ids()

Returns the caller's favorite ids without the full objects.

- **Return Type:** `FavoriteIdsDto`


---

<!-- Source: v3/v3-client.mdx -->

---
slug: /build/python/v3/v3-client
title: V3Client
description: High-level Python client for the Istari v3 API with file-upload support.
---

import TabItem from "@theme/TabItem";
import Tabs from "@theme/Tabs";

## Quick-reference table

| Method                                                                                  | Description                                                    |
| --------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| [`create_resource()`](#create_resource)                                                 | Upload a file and register it as a new resource.               |
| [`create_resource_revision()`](#create_resource_revision)                               | Upload a new file revision for an existing resource.           |
| [`create_comment()`](#create_comment)                                                   | Upload a file and attach it as a comment on a resource.        |
| [`update_comment()`](#update_comment)                                                   | Replace an existing comment's file.                            |
| [`get_content()`](#get_content)                                                         | Download raw file bytes from a resource, revision, or comment. |
| [`get_resource()`](#get_resource)                                                       | Retrieve a resource by ID.                                     |
| [`get_resource_revision()`](#get_resource_revision)                                     | Retrieve a specific revision of a resource.                    |
| [`get_comment()`](#get_comment)                                                         | Retrieve a comment by ID.                                      |
| [`list_resources()`](#list_resources)                                                   | List resources with optional filters.                          |
| [`list_resource_revisions()`](#list_resource_revisions)                                 | List revisions for a resource.                                 |
| [`list_comments()`](#list_comments)                                                     | List comments on a resource.                                   |
| [`archive_resource()`](#archive_resource)                                               | Archive a resource.                                            |
| [`restore_resource()`](#restore_resource)                                               | Restore an archived resource.                                  |
| [`archive_comment()`](#archive_comment)                                                 | Archive a comment.                                             |
| [`restore_comment()`](#restore_comment)                                                 | Restore an archived comment.                                   |
| [`create_revision_relationship()`](#create_revision_relationship)                       | Create a typed relationship between two revisions.             |
| [`list_revision_relationships()`](#list_revision_relationships)                         | List relationships for a revision.                             |
| [`list_revision_relationship_types()`](#list_revision_relationship_types)               | List available relationship types.                             |
| [`create_receiving_remote()`](#create_receiving_remote)                                 | Create a receiving remote connection.                          |
| [`create_sending_remote()`](#create_sending_remote)                                     | Create a sending remote connection.                            |
| [`get_receiving_remote()`](#get_receiving_remote)                                       | Retrieve a receiving remote by ID.                             |
| [`get_sending_remote()`](#get_sending_remote)                                           | Retrieve a sending remote by ID.                               |
| [`list_receiving_remotes()`](#list_receiving_remotes)                                   | List receiving remote connections.                             |
| [`list_sending_remotes()`](#list_sending_remotes)                                       | List sending remote connections.                               |
| [`update_receiving_remote()`](#update_receiving_remote)                                 | Update a receiving remote connection.                          |
| [`update_sending_remote()`](#update_sending_remote)                                     | Update a sending remote connection.                            |
| [`list_shareable_sending_connections()`](#list_shareable_sending_connections)           | List the Secure Connections a resource may be shared to.       |
| [`share_file_to_sending_remote()`](#share_file_to_sending_remote)                       | Share a resource with a partner over a Secure Connection.      |
| [`revoke_file_from_sending_remote()`](#revoke_file_from_sending_remote)                 | Stop sharing a resource over a Secure Connection.              |
| [`list_sending_remote_shares_for_resource()`](#list_sending_remote_shares_for_resource) | List the Secure Connections a resource is shared to.           |

Other `V3Client` domains:

- [Connected sources](./05-connected-sources.md) — observe a third-party system, browse it, and connect a file or container.
- [Notifications](./06-notifications.md) — inbox and poll.
- [AI chat](./07-ai.md) — conversations, steering, and LLM endpoints.
- [Search and favorites](./08-search-and-favorites.md) — search, suggestions, and starred systems and resources.

Workflow logs, revision property updates, Secure Connection governance, and object stores are on this page below.

---

## Upload

### create_resource

```python
V3Client.create_resource(
    path,
    resource_type,
    *,
    description=None,
    version_name=None,
    external_identifier=None,
    display_name=None,
    upstream_remote_info=None,
) -> ResourceDto
```

Upload a local file and register it as a new resource. The `resource_type` determines how the resource is classified. `V3Client` handles file tokenisation and storage automatically — pass a plain filesystem path.

**Required parameters**

| Name            | Type              | Description                                                                                  |
| --------------- | ----------------- | -------------------------------------------------------------------------------------------- |
| `path`          | `PathLike`        | Filesystem path to the file to upload.                                                       |
| `resource_type` | `ResourceTypeDto` | Classification: `model`, `artifact`, `file`, `connected_container`, or `connected_resource`. |

**Optional parameters**

| Name                   | Type                            | Default | Description                                                                                                                   |
| ---------------------- | ------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `description`          | `str \| None`                   | `None`  | Text describing the resource's purpose or contents.                                                                           |
| `version_name`         | `str \| None`                   | `None`  | User-defined version label (e.g. `"v2.1.0"`).                                                                                 |
| `external_identifier`  | `str \| None`                   | `None`  | Identifier from an external system for cross-referencing.                                                                     |
| `display_name`         | `str \| None`                   | `None`  | Human-readable name for the resource.                                                                                         |
| `upstream_remote_info` | `UpstreamInfoCreateDto \| None` | `None`  | Provenance when the remote sync service imports this resource over a receiving connection. Leave unset for a file you upload. |

`UpstreamInfoCreateDto` requires every field together: `upstream_remote_id`, `upstream_file_id`, `upstream_file_created`, `upstream_file_revision_id`, and `upstream_file_revision_created`.

**Returns:** `ResourceDto` — the newly created resource.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    from istari_digital_client.v3.models.resource_type_dto import ResourceTypeDto

    resource = client.create_resource(
        path="model.onnx",
        resource_type=ResourceTypeDto.MODEL,
    )
    print(resource.resource_id)
    ```

  </TabItem>
  <TabItem value="full" label="Full example">
    ```python
    from istari_digital_client.v3.models.resource_type_dto import ResourceTypeDto

    resource = client.create_resource(
        path="wing-stress-v3.stl",
        resource_type=ResourceTypeDto.MODEL,
        display_name="Wing Stress Analysis v3",
        description="FEA results for revised wing geometry",
        version_name="v3.0.0",
        external_identifier="WS-2024-003",
    )
    # Fetch and verify the uploaded content
    data = client.get_content(resource)
    print(f"Uploaded {len(data)} bytes as resource {resource.resource_id}")
    ```

  </TabItem>
</Tabs>

---

### create_resource_revision

```python
V3Client.create_resource_revision(
    resource_id,
    path,
    *,
    description=None,
    version_name=None,
    external_identifier=None,
    display_name=None,
    upstream_revision_info=None,
) -> ResourceRevisionDto
```

Upload a new file and add it as a revision to an existing resource. Each call appends a new revision to the resource's history; previous revisions remain accessible.

**Required parameters**

| Name          | Type       | Description                                             |
| ------------- | ---------- | ------------------------------------------------------- |
| `resource_id` | `str`      | Unique identifier of the resource to add a revision to. |
| `path`        | `PathLike` | Filesystem path to the new file.                        |

**Optional parameters**

| Name                     | Type                                    | Default | Description                                                                                                                               |
| ------------------------ | --------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `description`            | `str \| None`                           | `None`  | Description for this revision.                                                                                                            |
| `version_name`           | `str \| None`                           | `None`  | Version label for this revision.                                                                                                          |
| `external_identifier`    | `str \| None`                           | `None`  | External system identifier.                                                                                                               |
| `display_name`           | `str \| None`                           | `None`  | Human-readable name for this revision.                                                                                                    |
| `upstream_revision_info` | `UpstreamRevisionInfoCreateDto \| None` | `None`  | Provenance when the remote sync service imports this revision over a receiving connection. Leave unset for a revision you author locally. |

`UpstreamRevisionInfoCreateDto` requires every field together: `receiving_connection_id`, `upstream_file_revision_id`, and `upstream_file_revision_created`.

**Returns:** `ResourceRevisionDto` — the newly created revision.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    revision = client.create_resource_revision(
        resource_id="550e8400-e29b-41d4-a716-446655440000",
        path="model-v2.onnx",
    )
    print(revision.file_revision_id)
    ```

  </TabItem>
  <TabItem value="full" label="Full example">
    ```python
    revision = client.create_resource_revision(
        resource_id="550e8400-e29b-41d4-a716-446655440000",
        path="model-v2.onnx",
        version_name="v2.0.0",
        description="Retrained with extended dataset",
    )

    # Confirm it appears in the revision list
    page = client.list_resource_revisions(
        resource_id="550e8400-e29b-41d4-a716-446655440000",
        version_name=["v2.0.0"],
    )
    assert page.items[0].file_revision_id == revision.file_revision_id
    ```

  </TabItem>
</Tabs>

---

### create_comment

```python
V3Client.create_comment(
    resource_id,
    path,
    parent_comment_id=None,
) -> CommentDto
```

Upload a local file and attach it as a comment on a resource. Supports threaded replies via `parent_comment_id`.

**Required parameters**

| Name          | Type       | Description                                      |
| ------------- | ---------- | ------------------------------------------------ |
| `resource_id` | `str`      | Unique identifier of the resource to comment on. |
| `path`        | `PathLike` | Filesystem path to the comment file.             |

**Optional parameters**

| Name                | Type          | Default | Description                           |
| ------------------- | ------------- | ------- | ------------------------------------- |
| `parent_comment_id` | `str \| None` | `None`  | ID of the parent comment to reply to. |

**Returns:** `CommentDto` — the newly created comment.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    comment = client.create_comment(
        resource_id="550e8400-e29b-41d4-a716-446655440000",
        path="review-notes.pdf",
    )
    print(comment.id)
    ```

  </TabItem>
  <TabItem value="full" label="Full example">
    ```python
    # Top-level comment, then a threaded reply
    comment = client.create_comment(
        resource_id="550e8400-e29b-41d4-a716-446655440000",
        path="initial-review.pdf",
    )
    reply = client.create_comment(
        resource_id="550e8400-e29b-41d4-a716-446655440000",
        path="follow-up.pdf",
        parent_comment_id=comment.id,
    )
    print(reply.parent_comment_id == comment.id)
    ```

  </TabItem>
</Tabs>

---

### update_comment

```python
V3Client.update_comment(
    resource_id,
    comment_id,
    path,
) -> CommentDto
```

Replace an existing comment's content by uploading a new file. The previous file is retained in history.

**Parameters**

| Name          | Type       | Description                                      |
| ------------- | ---------- | ------------------------------------------------ |
| `resource_id` | `str`      | Unique identifier of the parent resource.        |
| `comment_id`  | `str`      | Unique identifier of the comment to update.      |
| `path`        | `PathLike` | Filesystem path to the replacement comment file. |

**Returns:** `CommentDto` — the updated comment.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    updated = client.update_comment(
        resource_id="550e8400-e29b-41d4-a716-446655440000",
        comment_id="aabb1234-...",
        path="corrected-review.pdf",
    )
    ```

  </TabItem>
  <TabItem value="full" label="Full example">

```python
page = client.list_comments(resource_id="550e8400-e29b-41d4-a716-446655440000")
first_comment = page.items[0]
updated = client.update_comment(
    resource_id="550e8400-e29b-41d4-a716-446655440000",
    comment_id=first_comment.id,
    path="revised-notes.pdf",
)
data = client.get_content(updated)
print(f"Updated comment content: {len(data)} bytes")
```

  </TabItem>
</Tabs>

---

## Retrieve

### get_content

```python
V3Client.get_content(
    resource,
) -> bytes
```

Fetch and return the raw file content bytes for a resource, resource revision, or comment. The object must have a `content_token` attribute set.

:::tip
Pass the object returned by `get_resource()`, `get_resource_revision()`, or `get_comment()` directly — no need to extract the token manually.
:::

**Parameters**

| Name       | Type                                               | Description                                                    |
| ---------- | -------------------------------------------------- | -------------------------------------------------------------- |
| `resource` | `ResourceDto \| ResourceRevisionDto \| CommentDto` | Object whose content to download. Must have a `content_token`. |

**Returns:** `bytes` — raw file content.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    resource = client.get_resource("550e8400-e29b-41d4-a716-446655440000")
    data = client.get_content(resource)
    with open("downloaded.onnx", "wb") as f:
        f.write(data)
    ```

  </TabItem>
  <TabItem value="full" label="Full example">

```python
page = client.list_resource_revisions(
    resource_id="550e8400-e29b-41d4-a716-446655440000",
    version_name=["v1.0.0"],
)
revision = client.get_resource_revision(
    resource_id="550e8400-e29b-41d4-a716-446655440000",
    revision_id=page.items[0].file_revision_id,
)
data = client.get_content(revision)
print(f"Downloaded {len(data)} bytes for revision {revision.file_revision_id}")
```

  </TabItem>
</Tabs>

---

### get_resource

```python
V3Client.get_resource(
    resource_id,
) -> ResourceDto
```

Retrieve a resource by its unique identifier.

**Parameters**

| Name          | Type  | Description                                    |
| ------------- | ----- | ---------------------------------------------- |
| `resource_id` | `str` | Unique identifier of the resource to retrieve. |

**Returns:** `ResourceDto` — the resource.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    resource = client.get_resource("550e8400-e29b-41d4-a716-446655440000")
    print(resource.resource_type)
    ```

  </TabItem>
  <TabItem value="full" label="Full example">

```python
resource = client.get_resource("550e8400-e29b-41d4-a716-446655440000")
data = client.get_content(resource)
print(f"Resource {resource.resource_id} ({resource.resource_type}): {len(data)} bytes")
```

  </TabItem>
</Tabs>

---

### get_resource_revision

```python
V3Client.get_resource_revision(
    resource_id,
    revision_id,
) -> ResourceRevisionDto
```

Retrieve a specific revision of a resource.

**Parameters**

| Name          | Type  | Description                                    |
| ------------- | ----- | ---------------------------------------------- |
| `resource_id` | `str` | Unique identifier of the parent resource.      |
| `revision_id` | `str` | Unique identifier of the revision to retrieve. |

**Returns:** `ResourceRevisionDto` — the revision.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    revision = client.get_resource_revision(
        resource_id="550e8400-e29b-41d4-a716-446655440000",
        revision_id="aabb1234-...",
    )
    print(revision.version_name)
    ```

  </TabItem>
  <TabItem value="full" label="Full example">
    ```python
    page = client.list_resource_revisions(
        resource_id="550e8400-e29b-41d4-a716-446655440000",
        version_name=["v1.0.0"],
    )
    revision = client.get_resource_revision(
        resource_id="550e8400-e29b-41d4-a716-446655440000",
        revision_id=page.items[0].file_revision_id,
    )
    data = client.get_content(revision)
    ```

  </TabItem>
</Tabs>

---

### get_comment

```python
V3Client.get_comment(
    resource_id,
    comment_id,
) -> CommentDto
```

Retrieve a comment by its ID.

**Parameters**

| Name          | Type  | Description                                   |
| ------------- | ----- | --------------------------------------------- |
| `resource_id` | `str` | Unique identifier of the parent resource.     |
| `comment_id`  | `str` | Unique identifier of the comment to retrieve. |

**Returns:** `CommentDto` — the comment.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    comment = client.get_comment(
        resource_id="550e8400-e29b-41d4-a716-446655440000",
        comment_id="aabb1234-...",
    )
    data = client.get_content(comment)
    ```

  </TabItem>
  <TabItem value="full" label="Full example">
    ```python
    comment = client.get_comment(
        resource_id="550e8400-e29b-41d4-a716-446655440000",
        comment_id="aabb1234-...",
    )
    content = client.get_content(comment)
    with open("comment-attachment.pdf", "wb") as f:
        f.write(content)
    ```

  </TabItem>
</Tabs>

---

## List

### list_resources

```python
V3Client.list_resources(
    *,
    cursor=None,
    size=None,
    include_total=None,
    resource_id=None,
    created_by_id=None,
    name=None,
    type_name=None,
    description=None,
    version_name=None,
    external_identifier=None,
    display_name=None,
    mime_type=None,
    archive_status=None,
) -> CursorPageResourceDto
```

List resources with optional filters. Results are cursor-paginated; pass the `cursor` field from the previous page to fetch the next.

:::tip
Most filter parameters accept a list and support a `!` prefix for negation (e.g. `type_name=["!artifact"]` excludes artifacts).
:::

**Optional parameters**

| Name                  | Type                    | Default | Description                                                                                                                                            |
| --------------------- | ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `cursor`              | `str \| None`           | `None`  | Pagination cursor from the previous response.                                                                                                          |
| `size`                | `int \| None`           | `None`  | Page size (0–100, default 10).                                                                                                                         |
| `include_total`       | `bool \| None`          | `None`  | Include total item count in the response.                                                                                                              |
| `resource_id`         | `list[str] \| None`     | `None`  | Filter by resource ID(s). Supports `!` negation.                                                                                                       |
| `created_by_id`       | `list[str] \| None`     | `None`  | Filter by creator user ID(s).                                                                                                                          |
| `name`                | `list[str] \| None`     | `None`  | Filter by filename (exact match).                                                                                                                      |
| `type_name`           | `list[str] \| None`     | `None`  | Filter by [`ResourceTypeDto`](../api_reference/08-enums.md#resourcetypedto): `model`, `artifact`, `file`, `connected_container`, `connected_resource`. |
| `description`         | `list[str] \| None`     | `None`  | Filter by description (exact match).                                                                                                                   |
| `version_name`        | `list[str] \| None`     | `None`  | Filter by version label.                                                                                                                               |
| `external_identifier` | `list[str] \| None`     | `None`  | Filter by external identifier.                                                                                                                         |
| `display_name`        | `list[str] \| None`     | `None`  | Filter by display name (exact match).                                                                                                                  |
| `mime_type`           | `list[str] \| None`     | `None`  | Filter by MIME type (e.g. `model/stl`).                                                                                                                |
| `archive_status`      | `ArchiveStatus \| None` | `None`  | `active` (default), `archived`, or `all`.                                                                                                              |

**Returns:** `CursorPageResourceDto` — paginated list of resources.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    page = client.list_resources(type_name=["model"], size=20)
    for r in page.items:
        print(r.id, r.resource_type)
    ```

  </TabItem>
  <TabItem value="full" label="Full example">
    ```python
    # Paginate through all non-archived models. Pages expose the next cursor as `next_page`.
    cursor = None
    while True:
        page = client.list_resources(
            type_name=["model"],
            size=50,
            cursor=cursor,
        )
        for r in page.items:
            print(r.id)
        cursor = page.next_page
        if not cursor:
            break
    ```

  </TabItem>
</Tabs>

---

### list_resource_revisions

```python
V3Client.list_resource_revisions(
    resource_id,
    *,
    cursor=None,
    size=None,
    include_total=None,
    file_revision_id=None,
    created_by_id=None,
    name=None,
    description=None,
    version_name=None,
    external_identifier=None,
    display_name=None,
    mime_type=None,
) -> CursorPageResourceRevisionDto
```

List revisions for a resource. Results are cursor-paginated.

**Required parameters**

| Name          | Type  | Description                                                |
| ------------- | ----- | ---------------------------------------------------------- |
| `resource_id` | `str` | Unique identifier of the resource whose revisions to list. |

**Optional parameters**

| Name                  | Type                | Default | Description                    |
| --------------------- | ------------------- | ------- | ------------------------------ |
| `cursor`              | `str \| None`       | `None`  | Pagination cursor.             |
| `size`                | `int \| None`       | `None`  | Page size (0–100).             |
| `include_total`       | `bool \| None`      | `None`  | Include total count.           |
| `file_revision_id`    | `list[str] \| None` | `None`  | Filter by revision ID(s).      |
| `created_by_id`       | `list[str] \| None` | `None`  | Filter by creator user ID(s).  |
| `name`                | `list[str] \| None` | `None`  | Filter by filename.            |
| `description`         | `list[str] \| None` | `None`  | Filter by description.         |
| `version_name`        | `list[str] \| None` | `None`  | Filter by version label.       |
| `external_identifier` | `list[str] \| None` | `None`  | Filter by external identifier. |
| `display_name`        | `list[str] \| None` | `None`  | Filter by display name.        |
| `mime_type`           | `list[str] \| None` | `None`  | Filter by MIME type.           |

**Returns:** `CursorPageResourceRevisionDto` — paginated list of revisions.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    page = client.list_resource_revisions(
        resource_id="550e8400-e29b-41d4-a716-446655440000",
        size=10,
    )
    for rev in page.items:
        print(rev.file_revision_id, rev.version_name)
    ```

  </TabItem>
  <TabItem value="full" label="Full example">

```python
page = client.list_resource_revisions(
    resource_id="550e8400-e29b-41d4-a716-446655440000",
    version_name=["v2.0.0"],
    include_total=True,
)
print(f"Found {page.total} revision(s) matching v2.0.0")
if page.items:
    rev = client.get_resource_revision(
        resource_id="550e8400-e29b-41d4-a716-446655440000",
        revision_id=page.items[0].file_revision_id,
    )
    data = client.get_content(rev)
```

  </TabItem>
</Tabs>

---

### list_comments

```python
V3Client.list_comments(
    resource_id,
    *,
    cursor=None,
    size=None,
    include_total=None,
    comment_id=None,
    created_by_id=None,
) -> CursorPageCommentDto
```

List comments on a resource. Results are cursor-paginated.

**Required parameters**

| Name          | Type  | Description                                               |
| ------------- | ----- | --------------------------------------------------------- |
| `resource_id` | `str` | Unique identifier of the resource whose comments to list. |

**Optional parameters**

| Name            | Type                | Default | Description                                     |
| --------------- | ------------------- | ------- | ----------------------------------------------- |
| `cursor`        | `str \| None`       | `None`  | Pagination cursor.                              |
| `size`          | `int \| None`       | `None`  | Page size (0–100).                              |
| `include_total` | `bool \| None`      | `None`  | Include total count.                            |
| `comment_id`    | `list[str] \| None` | `None`  | Filter by comment ID(s). Supports `!` negation. |
| `created_by_id` | `list[str] \| None` | `None`  | Filter by creator user ID(s).                   |

**Returns:** `CursorPageCommentDto` — paginated list of comments.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    page = client.list_comments(
        resource_id="550e8400-e29b-41d4-a716-446655440000",
    )
    for c in page.items:
        print(c.id)
    ```

  </TabItem>
  <TabItem value="full" label="Full example">

```python
page = client.list_comments(
    resource_id="550e8400-e29b-41d4-a716-446655440000",
    include_total=True,
    size=50,
)
print(f"{page.total} comments total")
for c in page.items:
    data = client.get_content(c)
    print(f" comment {c.id}: {len(data)} bytes")
```

  </TabItem>
</Tabs>

---

## Archive & Restore

### archive_resource

```python
V3Client.archive_resource(
    resource_id,
) -> None
```

Archive a resource. Archived resources are excluded from default list queries unless `archive_status="archived"` or `archive_status="all"` is passed.

**Parameters**

| Name          | Type  | Description                                   |
| ------------- | ----- | --------------------------------------------- |
| `resource_id` | `str` | Unique identifier of the resource to archive. |

**Returns:** `None`

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    client.archive_resource("550e8400-e29b-41d4-a716-446655440000")
    ```

  </TabItem>
  <TabItem value="full" label="Full example">
    ```python
    resource = client.get_resource("550e8400-e29b-41d4-a716-446655440000")
    client.archive_resource(resource.resource_id)
    restored = client.restore_resource(resource.resource_id)
    print(restored.resource_id)
    ```

  </TabItem>
</Tabs>

---

### restore_resource

```python
V3Client.restore_resource(
    resource_id,
) -> ResourceDto
```

Restore an archived resource, making it active again.

**Parameters**

| Name          | Type  | Description                                   |
| ------------- | ----- | --------------------------------------------- |
| `resource_id` | `str` | Unique identifier of the resource to restore. |

**Returns:** `ResourceDto` — the restored resource.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    resource = client.restore_resource("550e8400-e29b-41d4-a716-446655440000")
    print(resource.resource_id)
    ```

  </TabItem>
  <TabItem value="full" label="Full example">

```python
archived = client.list_resources(archive_status="archived", type_name=["model"])
for r in archived.items:
    client.restore_resource(r.id)
    print(f"Restored {r.id}")
```

  </TabItem>
</Tabs>

---

### archive_comment

```python
V3Client.archive_comment(
    resource_id,
    comment_id,
) -> CommentDto
```

Archive a comment on a resource.

**Parameters**

| Name          | Type  | Description                                  |
| ------------- | ----- | -------------------------------------------- |
| `resource_id` | `str` | Unique identifier of the parent resource.    |
| `comment_id`  | `str` | Unique identifier of the comment to archive. |

**Returns:** `CommentDto` — the archived comment.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    client.archive_comment(
        resource_id="550e8400-e29b-41d4-a716-446655440000",
        comment_id="aabb1234-...",
    )
    ```

  </TabItem>
  <TabItem value="full" label="Full example">
    ```python
    page = client.list_comments(resource_id="550e8400-e29b-41d4-a716-446655440000")
    for c in page.items:
        client.archive_comment(
            resource_id="550e8400-e29b-41d4-a716-446655440000",
            comment_id=c.id,
        )
    ```

  </TabItem>
</Tabs>

---

### restore_comment

```python
V3Client.restore_comment(
    resource_id,
    comment_id,
) -> CommentDto
```

Restore an archived comment.

**Parameters**

| Name          | Type  | Description                                  |
| ------------- | ----- | -------------------------------------------- |
| `resource_id` | `str` | Unique identifier of the parent resource.    |
| `comment_id`  | `str` | Unique identifier of the comment to restore. |

**Returns:** `CommentDto` — the restored comment.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    comment = client.restore_comment(
        resource_id="550e8400-e29b-41d4-a716-446655440000",
        comment_id="aabb1234-...",
    )
    ```

  </TabItem>
  <TabItem value="full" label="Full example">

```python
comment = client.restore_comment(
    resource_id="550e8400-e29b-41d4-a716-446655440000",
    comment_id="aabb1234-...",
)
data = client.get_content(comment)
print(f"Restored comment: {len(data)} bytes")
```

  </TabItem>
</Tabs>

---

## Revision Relationships

### create_revision_relationship

```python
V3Client.create_revision_relationship(
    new_revision_relationship_dto,
) -> RevisionRelationshipDto
```

Create a typed relationship between two revisions. Relationships record provenance, dependency, or lineage links between resource versions.

**Parameters**

| Name                            | Type                         | Description                                                            |
| ------------------------------- | ---------------------------- | ---------------------------------------------------------------------- |
| `new_revision_relationship_dto` | `NewRevisionRelationshipDto` | DTO with the left revision, right revision, and relationship type IDs. |

**Returns:** `RevisionRelationshipDto` — the created relationship.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    from istari_digital_client.v3.models.new_revision_relationship_dto import NewRevisionRelationshipDto

    rel = client.create_revision_relationship(
        new_revision_relationship_dto=NewRevisionRelationshipDto(
            left_revision_id="rev-aaa",
            right_revision_id="rev-bbb",
            relationship_type_id="type-ccc",
        )
    )
    print(rel.id)
    ```

  </TabItem>
  <TabItem value="full" label="Full example">
    ```python
    from istari_digital_client.v3.models.new_revision_relationship_dto import NewRevisionRelationshipDto

    # Look up an available relationship type
    types = client.list_revision_relationship_types()
    rel_type_id = types.items[0].id

    rel = client.create_revision_relationship(
        new_revision_relationship_dto=NewRevisionRelationshipDto(
            left_revision_id="rev-aaa",
            right_revision_id="rev-bbb",
            relationship_type_id=rel_type_id,
        )
    )
    rels = client.list_revision_relationships(revision_id="rev-aaa")
    print(f"{len(rels.items)} relationship(s) for rev-aaa")
    ```

  </TabItem>
</Tabs>

---

### list_revision_relationships

```python
V3Client.list_revision_relationships(
    revision_id,
    *,
    cursor=None,
    size=None,
    include_total=None,
    left_revision_id=None,
    right_revision_id=None,
    owning_entity_type=None,
) -> CursorPageRevisionRelationshipDto
```

List relationships that the caller has access to for a given revision.

**Required parameters**

| Name          | Type  | Description                                |
| ------------- | ----- | ------------------------------------------ |
| `revision_id` | `str` | The revision ID to list relationships for. |

**Optional parameters**

| Name                 | Type                | Default | Description                                               |
| -------------------- | ------------------- | ------- | --------------------------------------------------------- |
| `cursor`             | `str \| None`       | `None`  | Pagination cursor.                                        |
| `size`               | `int \| None`       | `None`  | Page size (0–100).                                        |
| `include_total`      | `bool \| None`      | `None`  | Include total count.                                      |
| `left_revision_id`   | `list[str] \| None` | `None`  | Filter by left revision ID(s). Use `!uuid` to negate.     |
| `right_revision_id`  | `list[str] \| None` | `None`  | Filter by right revision ID(s).                           |
| `owning_entity_type` | `list[str] \| None` | `None`  | Filter by entity type (e.g. `model`, `artifact`, `file`). |

**Returns:** `CursorPageRevisionRelationshipDto` — paginated list of relationships.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    page = client.list_revision_relationships(revision_id="rev-aaa")
    for r in page.items:
        print(r.left_revision.file_revision_id, "->", r.right_revision.file_revision_id)
    ```
  </TabItem>
  <TabItem value="full" label="Full example">
    ```python
    page = client.list_revision_relationships(
        revision_id="rev-aaa",
        owning_entity_type=["model"],
        include_total=True,
    )
    print(f"{page.total} relationship(s) for this revision")
    ```
  </TabItem>
</Tabs>

---

### list_revision_relationship_types

```python
V3Client.list_revision_relationship_types(
    *,
    cursor=None,
    size=None,
    include_total=None,
) -> CursorPageRevisionRelationshipTypeDto
```

List all available revision relationship types registered in the system.

**Optional parameters**

| Name            | Type           | Default | Description          |
| --------------- | -------------- | ------- | -------------------- |
| `cursor`        | `str \| None`  | `None`  | Pagination cursor.   |
| `size`          | `int \| None`  | `None`  | Page size (0–100).   |
| `include_total` | `bool \| None` | `None`  | Include total count. |

**Returns:** `CursorPageRevisionRelationshipTypeDto` — paginated list of relationship types.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    types = client.list_revision_relationship_types()
    for t in types.items:
        print(t.id, t.name)
    ```

  </TabItem>
  <TabItem value="full" label="Full example">

```python
types = client.list_revision_relationship_types(include_total=True)
print(f"{types.total} relationship types available")
type_id = types.items[0].id
```

  </TabItem>
</Tabs>

---

## Remote Connections

### create_receiving_remote

```python
V3Client.create_receiving_remote(
    receiving_connection_create_dto,
) -> ReceivingConnectionDto
```

Create a receiving remote connection to accept resources pushed from another registry.

**Parameters**

| Name                              | Type                           | Description                                  |
| --------------------------------- | ------------------------------ | -------------------------------------------- |
| `receiving_connection_create_dto` | `ReceivingConnectionCreateDto` | DTO describing the new receiving connection. |

**Returns:** `ReceivingConnectionDto` — the created receiving remote.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    from istari_digital_client.v3.models.receiving_connection_create_dto import ReceivingConnectionCreateDto

    remote = client.create_receiving_remote(
        receiving_connection_create_dto=ReceivingConnectionCreateDto(
            label="upstream-registry",
            description="Accept resources from the partner",
            shared_id="upstream-registry",
            shared_secret="shared-secret",
            object_store_id="<object_store_id>",
        ),
    )
    print(remote.id)
    ```

  </TabItem>
  <TabItem value="full" label="Full example">
    ```python
    from istari_digital_client.v3.models.receiving_connection_create_dto import ReceivingConnectionCreateDto

    remote = client.create_receiving_remote(
        receiving_connection_create_dto=ReceivingConnectionCreateDto(
            label="partner-registry",
            description="Accept resources from the partner",
            shared_id="partner-registry",
            shared_secret="shared-secret",
            object_store_id="<object_store_id>",
        ),
    )
    retrieved = client.get_receiving_remote(remote.id)
    print(retrieved.label)
    ```

  </TabItem>
</Tabs>

---

### create_sending_remote

```python
V3Client.create_sending_remote(
    sending_connection_create_dto,
) -> SendingConnectionDto
```

Create a sending remote connection to push resources to another registry.

`SendingConnectionCreateDto.allow_reshare` defaults to `False`. Set it to `True` to let the receiving organization share files that arrived over this connection onward over its own sending connections. `False` keeps those files on the receiving instance.

**Parameters**

| Name                            | Type                         | Description                                                                                                                                |
| ------------------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `sending_connection_create_dto` | `SendingConnectionCreateDto` | DTO describing the new sending connection. `allow_reshare` (`bool`, default `False`) controls whether the receiver may share files onward. |

**Returns:** `SendingConnectionDto` — the created sending remote, including `allow_reshare`.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    from istari_digital_client.v3.models.sending_connection_create_dto import SendingConnectionCreateDto

    remote = client.create_sending_remote(
        sending_connection_create_dto=SendingConnectionCreateDto(
            label="downstream-registry",
            description="Send resources to the partner",
            shared_id="downstream-registry",
            shared_secret="shared-secret",
            object_store_id="<object_store_id>",
        ),
    )
    print(remote.id)
    ```

  </TabItem>
  <TabItem value="full" label="Full example">
    ```python
    from istari_digital_client.v3.models.sending_connection_create_dto import SendingConnectionCreateDto

    remote = client.create_sending_remote(
        sending_connection_create_dto=SendingConnectionCreateDto(
            label="partner-registry",
            description="Send resources to the partner",
            shared_id="partner-registry",
            shared_secret="shared-secret",
            object_store_id="<object_store_id>",
            allow_reshare=True,
        ),
    )
    remotes = client.list_sending_remotes()
    print(f"{len(remotes.items)} sending remote(s) configured")
    ```

  </TabItem>
</Tabs>

---

### get_receiving_remote

```python
V3Client.get_receiving_remote(
    remote_id,
) -> ReceivingConnectionDto
```

Retrieve a receiving remote connection by ID.

`ReceivingConnectionDto.allow_reshare` is read-only. The value is the sender's setting, learned when the connection syncs.

**Parameters**

| Name        | Type  | Description                            |
| ----------- | ----- | -------------------------------------- |
| `remote_id` | `str` | The ID of the receiving remote to get. |

**Returns:** `ReceivingConnectionDto` — the receiving remote, including `allow_reshare`.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    remote = client.get_receiving_remote("remote-id-here")
    print(remote.label)
    ```
  </TabItem>
  <TabItem value="full" label="Full example">
    ```python
    from istari_digital_client.v3.models.update_receiving_connection_dto import UpdateReceivingConnectionDto

    remote = client.get_receiving_remote("remote-id-here")
    updated = client.update_receiving_remote(
        remote_id=remote.id,
        update_receiving_connection_dto=UpdateReceivingConnectionDto(label="renamed"),
    )
    ```

  </TabItem>
</Tabs>

---

### get_sending_remote

```python
V3Client.get_sending_remote(
    remote_id,
) -> SendingConnectionDto
```

Retrieve a sending remote connection by ID.

**Parameters**

| Name        | Type  | Description                          |
| ----------- | ----- | ------------------------------------ |
| `remote_id` | `str` | The ID of the sending remote to get. |

**Returns:** `SendingConnectionDto` — the sending remote.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    remote = client.get_sending_remote("remote-id-here")
    print(remote.label)
    ```
  </TabItem>
  <TabItem value="full" label="Full example">
    ```python
    from istari_digital_client.v3.models.update_sending_connection_dto import UpdateSendingConnectionDto

    remote = client.get_sending_remote("remote-id-here")
    updated = client.update_sending_remote(
        remote_id=remote.id,
        update_sending_connection_dto=UpdateSendingConnectionDto(label="renamed"),
    )
    ```

  </TabItem>
</Tabs>

---

### list_receiving_remotes

```python
V3Client.list_receiving_remotes(
    *,
    cursor=None,
    size=None,
    include_total=None,
    show_archived=None,
) -> CursorPageReceivingConnectionDto
```

List receiving remote connections. Each item's `allow_reshare` is read-only and is the sender's setting, learned when the connection syncs.

**Optional parameters**

| Name            | Type           | Default | Description                           |
| --------------- | -------------- | ------- | ------------------------------------- |
| `cursor`        | `str \| None`  | `None`  | Pagination cursor.                    |
| `size`          | `int \| None`  | `None`  | Page size (0–100).                    |
| `include_total` | `bool \| None` | `None`  | Include total count.                  |
| `show_archived` | `bool \| None` | `None`  | Include archived remotes when `True`. |

**Returns:** `CursorPageReceivingConnectionDto` — paginated list. Each item includes `allow_reshare`.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    page = client.list_receiving_remotes()
    for r in page.items:
        print(r.id, r.label)
    ```

  </TabItem>
  <TabItem value="full" label="Full example">

```python
page = client.list_receiving_remotes(include_total=True, show_archived=True)
print(f"{page.total} receiving remote(s) (including archived)")
```

  </TabItem>
</Tabs>

---

### list_sending_remotes

```python
V3Client.list_sending_remotes(
    *,
    cursor=None,
    size=None,
    include_total=None,
    show_archived=None,
) -> CursorPageSendingConnectionDto
```

List sending remote connections.

**Optional parameters**

| Name            | Type           | Default | Description                           |
| --------------- | -------------- | ------- | ------------------------------------- |
| `cursor`        | `str \| None`  | `None`  | Pagination cursor.                    |
| `size`          | `int \| None`  | `None`  | Page size (0–100).                    |
| `include_total` | `bool \| None` | `None`  | Include total count.                  |
| `show_archived` | `bool \| None` | `None`  | Include archived remotes when `True`. |

**Returns:** `CursorPageSendingConnectionDto` — paginated list.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    page = client.list_sending_remotes()
    for r in page.items:
        print(r.id, r.label)
    ```

  </TabItem>
  <TabItem value="full" label="Full example">

```python
page = client.list_sending_remotes(include_total=True)
print(f"{page.total} sending remote(s) configured")
```

  </TabItem>
</Tabs>

---

### update_receiving_remote

```python
V3Client.update_receiving_remote(
    remote_id,
    update_receiving_connection_dto,
) -> ReceivingConnectionDto
```

Update a receiving remote connection.

**Parameters**

| Name                              | Type                           | Description                               |
| --------------------------------- | ------------------------------ | ----------------------------------------- |
| `remote_id`                       | `str`                          | The ID of the receiving remote to update. |
| `update_receiving_connection_dto` | `UpdateReceivingConnectionDto` | DTO containing the fields to update.      |

**Returns:** `ReceivingConnectionDto` — the updated receiving remote.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    from istari_digital_client.v3.models.update_receiving_connection_dto import UpdateReceivingConnectionDto

    updated = client.update_receiving_remote(
        remote_id="remote-id-here",
        update_receiving_connection_dto=UpdateReceivingConnectionDto(label="new-name"),
    )
    ```

  </TabItem>
  <TabItem value="full" label="Full example">
    ```python
    from istari_digital_client.v3.models.update_receiving_connection_dto import UpdateReceivingConnectionDto

    remote = client.get_receiving_remote("remote-id-here")
    updated = client.update_receiving_remote(
        remote_id=remote.id,
        update_receiving_connection_dto=UpdateReceivingConnectionDto(label="renamed-remote"),
    )
    print(updated.label)
    ```

  </TabItem>
</Tabs>

---

### update_sending_remote

```python
V3Client.update_sending_remote(
    remote_id,
    update_sending_connection_dto,
) -> SendingConnectionDto
```

Update a sending remote connection.

`UpdateSendingConnectionDto.allow_reshare` changes whether the receiving organization may share files that arrived over this connection onward over its own sending connections.

**Parameters**

| Name                            | Type                         | Description                                                                                                         |
| ------------------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| `remote_id`                     | `str`                        | The ID of the sending remote to update.                                                                             |
| `update_sending_connection_dto` | `UpdateSendingConnectionDto` | DTO containing the fields to update. `allow_reshare` (`bool`, optional) sets whether the receiver may share onward. |

**Returns:** `SendingConnectionDto` — the updated sending remote, including `allow_reshare`.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    from istari_digital_client.v3.models.update_sending_connection_dto import UpdateSendingConnectionDto

    updated = client.update_sending_remote(
        remote_id="remote-id-here",
        update_sending_connection_dto=UpdateSendingConnectionDto(label="new-name"),
    )
    ```

  </TabItem>
  <TabItem value="full" label="Full example">
    ```python
    from istari_digital_client.v3.models.update_sending_connection_dto import UpdateSendingConnectionDto

    remote = client.get_sending_remote("remote-id-here")
    updated = client.update_sending_remote(
        remote_id=remote.id,
        update_sending_connection_dto=UpdateSendingConnectionDto(
            label="renamed-remote",
            allow_reshare=True,
        ),
    )
    print(updated.label, updated.allow_reshare)
    ```

  </TabItem>
</Tabs>

---

## Secure Connection Sharing

Share individual resources with a partner organization over a **Sending Connection** (Secure Connection) that an administrator has already configured. These methods are the SDK counterpart of the **Share with external connection** dialog described in [Secure Connections](../../users/user-guide/secure-connections.md).

The same rules apply as in the web app:

- Only **models and artifacts** are synced to the partner. Systems cannot be shared as a whole. The share and list calls accept the file of any resource type and do not reject a standalone file, so check `resource_type` yourself rather than relying on an error.
- The caller needs **Editor** access or above on the resource. Any authenticated user may list shareable connections.
- The connection must exist and be active. Creating connections is an administrator task — see [Set up Secure Connections](../../users/admin-guide/secure-connections.md).
- The connection's **Permitted Infosec Level** and **Tag Rules** still apply. A share that violates them is rejected or automatically revoked.
- If the connection restricts **Permitted Senders**, you must be on its list, and your per-user level (View or Edit) caps the `share_level` you may request in addition to the connection's ceiling. There is no non-admin call to read your own level; a share above it fails with `403`. See [Permitted Senders](../../users/admin-guide/secure-connections.md#permitted-senders-sending-connections).
- Sync is **asynchronous**. A share call returns as soon as the share is recorded; the partner receives the file on the next sync cycle (typically 1–2 minutes).
- List calls are paginated. Each page exposes the cursor for the next page as `next_page`; pass it back as `cursor` until it is `None`.

Share methods take the resource's `file_id` (the storage-level identifier on `ResourceDto`), not its `resource_id`. `list_sending_remote_shares_for_resource()` takes the `resource_id` and resolves the file for you.

### list_shareable_sending_connections

```python
V3Client.list_shareable_sending_connections(
    *,
    cursor=None,
    size=None,
    include_total=None,
) -> CursorPageShareableSendingConnectionDto
```

List the active Sending Connections a resource may be shared to. Unlike [`list_sending_remotes()`](#list_sending_remotes), this is available to non-administrators and returns a slim projection without connection configuration. Secure Connections are not tenant-scoped, so the list is instance-wide.

**Optional parameters**

| Name            | Type           | Default | Description                         |
| --------------- | -------------- | ------- | ----------------------------------- |
| `cursor`        | `str \| None`  | `None`  | `next_page` from the previous page. |
| `size`          | `int \| None`  | `None`  | Page size (0–100).                  |
| `include_total` | `bool \| None` | `None`  | Include total count.                |

**Returns:** `CursorPageShareableSendingConnectionDto` — paginated list. Each item carries `id`, `label`, `description`, and `received_access_level`, the ceiling for the `share_level` you may request on that connection.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    page = client.list_shareable_sending_connections()
    for conn in page.items:
        print(conn.id, conn.label, conn.received_access_level)
    ```
  </TabItem>
  <TabItem value="full" label="Full example">
    ```python
    from istari_digital_client.v3.models.received_access_level import ReceivedAccessLevel

    # Find the connections that allow Edit access on the partner side, across all pages
    editable = []
    cursor = None
    while True:
        page = client.list_shareable_sending_connections(size=100, cursor=cursor)
        editable.extend(
            conn for conn in page.items
            if conn.received_access_level == ReceivedAccessLevel.EDITOR
        )
        cursor = page.next_page
        if not cursor:
            break
    for conn in editable:
        print(f"{conn.label}: {conn.description}")
    ```

  </TabItem>
</Tabs>

---

### share_file_to_sending_remote

```python
V3Client.share_file_to_sending_remote(
    remote_id,
    file_id,
    share_file_to_sending_remote_dto=None,
) -> RemoteFileShareDto
```

Share a resource's file with the partner behind a Sending Connection. If the file was previously shared and then revoked, the share is restored. Calling it again on an active share updates the `share_level` in place.

**Parameters**

| Name                               | Type                                  | Description                                                                                             |
| ---------------------------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| `remote_id`                        | `str`                                 | The ID of the Sending Connection to share to.                                                           |
| `file_id`                          | `str`                                 | The `file_id` of the resource to share.                                                                 |
| `share_file_to_sending_remote_dto` | `ShareFileToSendingRemoteDto \| None` | Optional body. `share_level` is `ReceivedAccessLevel.VIEWER` (default) or `ReceivedAccessLevel.EDITOR`. |

`share_level` controls what the partner can do with their copy. **Viewer** is read-only; **Editor** lets the receiving organization run jobs on the resource and add revisions to their copy. You cannot request **Editor** on a connection whose `received_access_level` is **Viewer**, or when the administrator has listed you as a View-level permitted sender on that connection.

**Returns:** `RemoteFileShareDto` — the share record, with `id`, `sending_connection_id`, `sending_connection_label`, `file_id`, `share_level`, `created`, `is_archived`, and `archived`.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    resource = client.get_resource("resource-id-here")

    share = client.share_file_to_sending_remote(
        remote_id="sending-connection-id-here",
        file_id=resource.file_id,
    )
    print(share.share_level)  # Viewer
    ```

  </TabItem>
  <TabItem value="full" label="Full example">
    ```python
    from istari_digital_client.v3.models.received_access_level import ReceivedAccessLevel
    from istari_digital_client.v3.models.share_file_to_sending_remote_dto import ShareFileToSendingRemoteDto

    resource = client.get_resource("resource-id-here")

    # Pick the connection by label and check its ceiling before asking for Editor
    conn = next(
        c for c in client.list_shareable_sending_connections(size=100).items
        if c.label == "partner-registry"
    )
    if conn.received_access_level != ReceivedAccessLevel.EDITOR:
        raise RuntimeError(f"{conn.label} only permits view access")

    share = client.share_file_to_sending_remote(
        remote_id=conn.id,
        file_id=resource.file_id,
        share_file_to_sending_remote_dto=ShareFileToSendingRemoteDto(
            share_level=ReceivedAccessLevel.EDITOR,
        ),
    )
    print(f"Shared to {share.sending_connection_label} at {share.share_level}")
    ```

  </TabItem>
</Tabs>

---

### revoke_file_from_sending_remote

```python
V3Client.revoke_file_from_sending_remote(
    remote_id,
    file_id,
) -> RemoteFileShareDto
```

Stop sharing a resource's file over a Sending Connection. This stops future synchronization and sends a revocation signal across the connection; the partner's platform tombstones its copy on a later sync cycle. Revocation is best-effort and cannot purge data the partner has already exported. See [Revocation and Tombstoned Files](../../users/user-guide/secure-connections.md#revocation-and-tombstoned-files).

**Parameters**

| Name        | Type  | Description                                      |
| ----------- | ----- | ------------------------------------------------ |
| `remote_id` | `str` | The ID of the Sending Connection to revoke from. |
| `file_id`   | `str` | The `file_id` of the resource to stop sharing.   |

**Returns:** `RemoteFileShareDto` — the share record with `is_archived=True` and `archived` set.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    resource = client.get_resource("resource-id-here")

    revoked = client.revoke_file_from_sending_remote(
        remote_id="sending-connection-id-here",
        file_id=resource.file_id,
    )
    print(revoked.is_archived)  # True
    ```

  </TabItem>
  <TabItem value="full" label="Full example">
    ```python
    # Revoke a resource from every connection it is currently shared to.
    # Collect every page first so a later-page share is not missed.
    resource = client.get_resource("resource-id-here")

    shares = []
    cursor = None
    while True:
        page = client.list_sending_remote_shares_for_resource(
            resource_id=resource.resource_id,
            size=100,
            cursor=cursor,
        )
        shares.extend(page.items)
        cursor = page.next_page
        if not cursor:
            break

    for share in shares:
        client.revoke_file_from_sending_remote(
            remote_id=share.sending_connection_id,
            file_id=share.file_id,
        )
        print(f"Revoked from {share.sending_connection_label}")
    ```

  </TabItem>
</Tabs>

---

### list_sending_remote_shares_for_resource

```python
V3Client.list_sending_remote_shares_for_resource(
    resource_id,
    *,
    cursor=None,
    size=None,
    include_total=None,
    show_archived=None,
) -> CursorPageRemoteFileShareDto
```

List the Sending Connections a resource is shared to. This is the SDK equivalent of the **Connections** row on the resource's details pane. The resource's underlying file is resolved automatically, so pass the `resource_id`.

**Parameters**

| Name          | Type  | Description                                           |
| ------------- | ----- | ----------------------------------------------------- |
| `resource_id` | `str` | The `resource_id` of the resource to list shares for. |

**Optional parameters**

| Name            | Type           | Default | Description                         |
| --------------- | -------------- | ------- | ----------------------------------- |
| `cursor`        | `str \| None`  | `None`  | `next_page` from the previous page. |
| `size`          | `int \| None`  | `None`  | Page size (0–100).                  |
| `include_total` | `bool \| None` | `None`  | Include total count.                |
| `show_archived` | `bool \| None` | `None`  | Include revoked shares when `True`. |

**Returns:** `CursorPageRemoteFileShareDto` — paginated list of `RemoteFileShareDto`. By default only active shares are returned.

<Tabs>
  <TabItem value="basic" label="Basic">
    ```python
    page = client.list_sending_remote_shares_for_resource(resource_id="resource-id-here")
    for share in page.items:
        print(share.sending_connection_label, share.share_level)
    ```
  </TabItem>
  <TabItem value="full" label="Full example">
    ```python
    # Include revoked shares to see the full sharing history of a resource
    page = client.list_sending_remote_shares_for_resource(
        resource_id="resource-id-here",
        show_archived=True,
        include_total=True,
    )
    print(f"{page.total} share(s), including revoked")
    for share in page.items:
        state = "revoked" if share.is_archived else "active"
        print(f"{share.sending_connection_label}: {share.share_level} ({state})")
    ```

  </TabItem>
</Tabs>

## Revision properties

### update_resource_revision

```python
V3Client.update_resource_revision(
    resource_id,
    revision_id,
    resource_revision_update_dto,
    http_request_timeout_secs=None,
) -> ResourceRevisionDto
```

Patches user-provided properties on an existing revision. Omitted fields stay as they are. An explicit null clears the value. A new upload is [`create_resource_revision()`](#create_resource_revision).

**Required parameters**

| Name                           | Type                        | Description                                                                                          |
| ------------------------------ | --------------------------- | ---------------------------------------------------------------------------------------------------- |
| `resource_id`                  | `str`                       | Resource that owns the revision.                                                                     |
| `revision_id`                  | `str`                       | Revision to update.                                                                                  |
| `resource_revision_update_dto` | `ResourceRevisionUpdateDto` | Optional fields: `display_name`, `description`, `version_name`, `external_identifier`. Each max 255. |

**Returns:** `ResourceRevisionDto`

## Workflow logs

Record a run that happened outside an Istari job. The how-to is [External workflow logs](./03-workflow-logs.md). The web app view is [Workflow log](../../users/user-guide/workflow-log.md).

`create_workflow_output` on `V3Client` takes a filesystem `path` and uploads the file. The generated method underneath takes a `WorkflowOutputCreateDto`; call the `V3Client` form.

### create_workflow_output

```python
V3Client.create_workflow_output(
    system_id,
    path,
    *,
    description=None,
    display_name=None,
    external_identifier=None,
) -> WorkflowOutputDto
```

| Name                  | Type          | Description                    |
| --------------------- | ------------- | ------------------------------ |
| `system_id`           | `str`         | System that stores the output. |
| `path`                | `PathLike`    | File to upload.                |
| `description`         | `str \| None` | Optional description.          |
| `display_name`        | `str \| None` | Optional display name.         |
| `external_identifier` | `str \| None` | Optional external id.          |

**Returns:** `WorkflowOutputDto`

### create_workflow_log_entry

```python
V3Client.create_workflow_log_entry(
    system_id,
    workflow_log_entry_create_dto,
    http_request_timeout_secs=None,
) -> WorkflowLogEntryDto
```

`WorkflowLogEntryCreateDto` fields, all optional: `title` (max 255), `status` (max 64; the platform default when omitted is `UNSPECIFIED`), `workflow_type` (max 64; default `external`), `configuration_id`, `branch_id`, `branchless` (default `False`), `workflow_output_ids`.

Unless `branchless` is true, `configuration_id` is required. Omitting `branch_id` records the system's baseline branch. When `branchless` is true, omit both `configuration_id` and `branch_id`.

### list_workflow_log_entries

```python
V3Client.list_workflow_log_entries(
    system_id,
    cursor=None,
    size=None,
    include_total=None,
    branch_id=None,
    title=None,
    status=None,
    archive_status=None,
) -> CursorPageWorkflowLogEntryDto
```

`branch_id`, `title`, and `status` are lists. `archive_status` is `active`, `archived`, or `all`.

### get_workflow_log_entry

```python
V3Client.get_workflow_log_entry(system_id, entry_id) -> WorkflowLogEntryDetailDto
```

The detail includes `workflow_outputs`.

### archive_workflow_log_entry

```python
V3Client.archive_workflow_log_entry(system_id, entry_id) -> None
```

### restore_workflow_log_entry

```python
V3Client.restore_workflow_log_entry(system_id, entry_id) -> WorkflowLogEntryDto
```

## Secure connection governance

Owners, permitted senders, infosec mappings, sync status, and tag-rule checks for a remote created with the [Remote connections](#remote-connections) methods. `remote_id` is that connection's id.

Starring a Secure Connection is separate from [resource and system favorites](./08-search-and-favorites.md).

### favorite_connection

```python
V3Client.favorite_connection(connection_id) -> None
```

### unfavorite_connection

```python
V3Client.unfavorite_connection(connection_id) -> None
```

### get_receiving_connection_owners

```python
V3Client.get_receiving_connection_owners(remote_id) -> list[ReceivingConnectionOwnerDto]
```

### set_receiving_connection_owners

Replaces the owner list. An owner without `access_level` is `EDITOR`.

```python
V3Client.set_receiving_connection_owners(
    remote_id,
    set_receiving_connection_owners_dto,
) -> list[ReceivingConnectionOwnerDto]
```

`SetReceivingConnectionOwnersDto.owners` is the complete list.

### get_sending_connection_permitted_senders

```python
V3Client.get_sending_connection_permitted_senders(remote_id) -> list[SendingConnectionPermittedSenderDto]
```

### set_sending_connection_permitted_senders

Replaces the permitted-sender list. A sender without `access_level` is `EDITOR`.

```python
V3Client.set_sending_connection_permitted_senders(
    remote_id,
    set_sending_connection_permitted_senders_dto,
) -> list[SendingConnectionPermittedSenderDto]
```

### get_receiving_connection_infosec_levels

Incoming infosec levels observed on a receiving connection.

```python
V3Client.get_receiving_connection_infosec_levels(remote_id) -> list[ReceivingConnectionInfosecLevelDto]
```

### get_receiving_connection_infosec_level_mappings

```python
V3Client.get_receiving_connection_infosec_level_mappings(remote_id) -> list[ReceivingConnectionInfosecLevelMappingDto]
```

### set_receiving_connection_infosec_level_mappings

Replaces the mapping list. An empty list removes every mapping.

```python
V3Client.set_receiving_connection_infosec_level_mappings(
    remote_id,
    set_receiving_connection_infosec_level_mappings_dto,
) -> list[ReceivingConnectionInfosecLevelMappingDto]
```

### get_receiving_connection_control_tags

```python
V3Client.get_receiving_connection_control_tags(remote_id) -> list[ReceivingConnectionControlTagDto]
```

### list_receiving_remote_sync_statuses

```python
V3Client.list_receiving_remote_sync_statuses(
    remote_id,
    only_with_updates=None,
    cursor=None,
    size=None,
    include_total=None,
) -> CursorPageSyncStatusUpdateDtoCustomized
```

### list_sending_remote_sync_statuses

Same parameters and return type as [`list_receiving_remote_sync_statuses`](#list_receiving_remote_sync_statuses), for a sending remote.

### list_resource_sync_status_by_connection

Most recent sync status of one resource on each Secure Connection.

```python
V3Client.list_resource_sync_status_by_connection(resource_id) -> list[ResourceSyncStatusByConnectionDto]
```

### evaluate_sending_remote_tag_sets

Previews what a sending remote's tag rules do to the given control-tag sets. Results come back in request order.

```python
V3Client.evaluate_sending_remote_tag_sets(
    remote_id,
    evaluate_sending_tag_sets_with_hypothetical_rule_set_dto,
) -> list[SendingTagSetEvaluationDto]
```

`tag_sets` is a list of tag-id lists (at most 1000 sets, 200 ids each). `hypothetical_rule_set` is optional.

### validate_receiving_remote_manifest_catalog

Checks a manifest's control-tag catalog against a receiving remote. Send the tags the manifest reports as unarchived.

```python
V3Client.validate_receiving_remote_manifest_catalog(
    remote_id,
    validate_manifest_catalog_dto,
) -> ManifestCatalogValidationDto
```

`ValidateManifestCatalogDto.control_tag_ids` holds at most 1000 ids.

## Object stores

### list_object_stores

```python
V3Client.list_object_stores(
    cursor=None,
    size=None,
    include_total=None,
) -> CursorPageObjectStoreDto
```

`size` is 0–100 and defaults to 10. Pass the previous response's cursor to continue.

## Authentication advisory

### auth_deprecation

`V3Client.auth_deprecation` is a property, not a method call. It is the latest auth-deprecation advisory captured by a request, or `None`. It is set when the client authenticates with a personal access token against an Identity-Service-enabled registry. Exchange that token with [`client.keys.exchange_pat()`](../api_reference/14-keys.md#exchange_pat) or [`generate_keypair_and_exchange()`](../api_reference/14-keys.md#generate_keypair_and_exchange).

`Client.check_auth_deprecation()` forces a fresh check. `V3Client` exposes the stored result only.
