> ## Documentation Index
> Fetch the complete documentation index at: https://docs.paradime.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Admin client

> Use paradime.admin, the Python client for the Paradime Administration API, to set up workspaces, git, connections, environments and users from code.

`paradime.admin` is the Python client for the [Administration API](https://docs.paradime.io/developers/graphql-api/admin-api/index). Use it to set up and change workspaces from code: create a workspace, connect its git repository and warehouses, add environments and variables, deploy Bolt schedules, invite users, and read the setup checklist.

> [!NOTE]
>
> **Prerequisites**
>
> * Most of the admin client works on every plan. Workspace creation and changes, git, warehouse connections, environments, environment variables, integrations, notifications, and usage are part of the [Enterprise plan](https://www.paradime.io/pricing). On other plans, those calls raise `AdminPlanUpgradeRequiredException`.
> * A company API key (`prdm_cmp_...`) or a workspace API key (`prdm_wsp_...`) with the capability groups that the calls need. Each page lists the groups. See [API keys](https://docs.paradime.io/developers/api-keys.md).
> * Python 3.11 or later, and the latest `paradime-io` package.&#x20;

## Install the SDK

```bash theme={"system"}
pip install --upgrade paradime-io
```

## Create the client

The admin client uses the same credentials as the rest of the SDK. With a company API key, `workspace_uid` sets the workspace that workspace-level calls act on.

```python theme={"system"}
from paradime import Paradime

paradime = Paradime(
    api_endpoint="API_ENDPOINT",
    api_secret="prdm_cmp_...",  # a company API key
    workspace_uid="WORKSPACE_UID",  # the workspace that calls act on by default
)

for workspace in paradime.admin.workspaces.list():
    print(workspace.uid, workspace.name)
```

## Areas

`paradime.admin` has one client for each area of the Administration API.

| Attribute | What it manages | Python reference | GraphQL reference |
| - | - | - | - |
| `admin.workspaces` | Workspaces and their settings | [Workspaces](https://docs.paradime.io/developers/python-sdk/modules/admin/workspaces.md) | [Workspaces](https://docs.paradime.io/developers/graphql-api/admin-api/workspaces) |
| `admin.git` | The git repository and the deploy key | [Git repository](https://docs.paradime.io/developers/python-sdk/modules/admin/git.md) | [Git repositories](https://docs.paradime.io/developers/graphql-api/admin-api/git-repositories) |
| `admin.connections` | Warehouse connections | [Warehouse connections](https://docs.paradime.io/developers/python-sdk/modules/admin/connections.md) | [Warehouse connections](https://docs.paradime.io/developers/graphql-api/admin-api/warehouse-connections) |
| `admin.environments` | Bolt and agent environments | [Environments](https://docs.paradime.io/developers/python-sdk/modules/admin/environments.md) | [Environments](https://docs.paradime.io/developers/graphql-api/admin-api/environments) |
| `admin.environment_variables` | Environment variables | [Environment variables](https://docs.paradime.io/developers/python-sdk/modules/admin/environment-variables.md) | [Environment variables](https://docs.paradime.io/developers/graphql-api/admin-api/environment-variables) |
| `admin.bolt` | Schedules created in the UI or through the API, YAML deploys, Trigger URLs | [Bolt](https://docs.paradime.io/developers/python-sdk/modules/admin/bolt.md) | [Bolt](https://docs.paradime.io/developers/graphql-api/admin-api/bolt) |
| `admin.jobs` | Async jobs | [Jobs](https://docs.paradime.io/developers/python-sdk/modules/admin/jobs.md) | [Conventions](https://docs.paradime.io/developers/graphql-api/admin-api/conventions.md) |
| `admin.users` | Users, roles and auto-join domains | [Users](https://docs.paradime.io/developers/python-sdk/modules/admin/users.md) | [Users](https://docs.paradime.io/developers/graphql-api/admin-api/users) |
| `admin.notifications` | Slack and email alerts | [Notifications](https://docs.paradime.io/developers/python-sdk/modules/admin/notifications.md) | [Notifications](https://docs.paradime.io/developers/graphql-api/admin-api/notifications) |
| `admin.integrations` | BI, ETL and observability integrations, DinoAI agent integrations, external secret managers | [Integrations](https://docs.paradime.io/developers/python-sdk/modules/admin/integrations.md) | [Integrations](https://docs.paradime.io/developers/graphql-api/admin-api/integrations) |
| `admin.dinoai` | DinoAI agent definitions and settings | [DinoAI](https://docs.paradime.io/developers/python-sdk/modules/admin/dinoai.md) | [DinoAI](https://docs.paradime.io/developers/graphql-api/admin-api/dinoai) |
| `admin.usage` | Bolt and DinoAI usage | [Usage](https://docs.paradime.io/developers/python-sdk/modules/admin/usage.md) | [Usage](https://docs.paradime.io/developers/graphql-api/admin-api/usage) |
| `admin.setup_status` | The onboarding checklist | [Setup status](https://docs.paradime.io/developers/python-sdk/modules/admin/setup-status.md) | [Setup status](https://docs.paradime.io/developers/graphql-api/admin-api/setup-status.md) |

To run schedules and agents, keep using [`paradime.bolt`](https://docs.paradime.io/developers/python-sdk/modules/bolt) and [`paradime.dinoai_agents`](https://docs.paradime.io/developers/python-sdk/modules/dinoai-programmable-agents). The SDK has no methods for [API keys](https://docs.paradime.io/developers/graphql-api/admin-api/api-keys) or DinoAI consumption budgets: use the GraphQL API for them.

## Choose the workspace

* A **workspace API key** acts on its own workspace.
* A **company API key** acts on the workspace in the `X-Paradime-Workspace` header. The client sends the `workspace_uid` you create it with. Every workspace-level method also takes `workspace_uid=`, which targets another workspace for that call only.
* **Company-level calls** need no workspace: `admin.workspaces` (create, list, update, delete), `admin.usage` across workspaces, and the Slack connection. You can create the client without `workspace_uid` for these calls.

```python theme={"system"}
# One company API key, two workspaces
staging_envs = list(paradime.admin.environments.list(workspace_uid="STAGING_WORKSPACE_UID"))
prod_envs = list(paradime.admin.environments.list(workspace_uid="PROD_WORKSPACE_UID"))
```

A workspace-level call with a company API key and no workspace raises `AdminWorkspaceRequiredException`.

## Read lists

List methods return an iterator that reads one page at a time while you loop over it. `page_size` sets how many items each request reads: 100 by default, at most 500. A larger value raises `ValueError` before any request.

```python theme={"system"}
for user in paradime.admin.users.list(page_size=500):
    print(user.email, user.status)
```

## Keep or clear a setting

`workspaces.update` and `environments.update` change only the settings you pass. A setting you leave out keeps its value. `None` sends null, which clears the setting where the API allows it, for example a workspace's default branch.

```python theme={"system"}
# Change the dbt™ version, keep every other setting
paradime.admin.workspaces.update("WORKSPACE_UID", dbt_version="1.10")

# Clear the branch that Bolt schedules deploy from
paradime.admin.workspaces.update("WORKSPACE_UID", schedule_deployment_branch=None)
```

To build the arguments in code, use the `UNSET` sentinel from `paradime.apis.admin`: an argument set to `UNSET` is left out of the request.

## Send the same input again

Most writes are safe to retry. A create or set call with the same input as a stored object returns that object and changes nothing. A create that finds an object with the same key but other settings raises `AdminConflictException`: change that object with the matching update method.

Environments, Bolt schedules and DinoAI agents are keyed by slug. Pass `slug=` to make a create safe to retry. Without a slug, every call creates another object with a new slug.

Each method says when it works differently. For example, `users.create` raises `AdminConflictException` for an email that already belongs to a user or to a pending invitation, and `git.rotate_deploy_key` makes a new key on every call.

## Secrets are write-only

No read returns a password, private key, token or variable value. Models show only whether a secret is set, for example `has_password`, `has_client_secret` or `is_set`. An update that leaves out a secret keeps the stored value. The `repr()` of input models masks secret fields.

To read the value of an environment variable, use [`environment_variables.reveal`](https://docs.paradime.io/developers/python-sdk/modules/admin/environment-variables#reveal-a-variable). It needs its own capability group, and Paradime writes every reveal to the audit log.

## Linked objects

Some models link to another object, for example the environment of a warehouse connection. Reading a link needs the capability that reads the linked object. A key without it reads `None` for that link, and the rest of the response is unchanged.

## Async jobs

Cloning a git repository, deploying YAML schedules and syncing DinoAI agents from code run as jobs. The methods that start them return an `AdminJob`. Wait for it with [`admin.jobs.wait`](https://docs.paradime.io/developers/python-sdk/modules/admin/jobs).

## Errors

Each API error raises the exception of its `extensions.code`. Every exception below subclasses `AdminApiException`, which subclasses `ParadimeAPIException`. Import them from `paradime.apis.admin`.

| Code | Exception | When |
| - | - | - |
| `UNAUTHENTICATED` | `AdminUnauthenticatedException` | The API key is missing, not valid, or expired. |
| `MISSING_CAPABILITY` | `AdminMissingCapabilityException` | The API key doesn't have the capability that the call needs. |
| `WORKSPACE_REQUIRED` | `AdminWorkspaceRequiredException` | A company API key sent a workspace-level call without a workspace. |
| `NOT_FOUND` | `AdminNotFoundException` | The object doesn't exist, or the API key can't reach it. |
| `VALIDATION_FAILED` | `AdminValidationFailedException` | An input is not valid. `field` names the input path. |
| `CONNECTION_TEST_FAILED` | `AdminConnectionTestFailedException` | A warehouse, integration or repository refused the connection. Nothing is saved. |
| `CONFLICT` | `AdminConflictException` | The call conflicts with stored state, for example an object with the same key and other settings. |
| `RATE_LIMITED` | `AdminRateLimitedException` | The API key used up its rate limit, and the SDK's retries did not help. |
| `PLAN_UPGRADE_REQUIRED` | `AdminPlanUpgradeRequiredException` | The company's plan doesn't include the call. |
| `INTERNAL` | `AdminInternalException` | Paradime failed to complete the call. |

Each exception has these attributes:

**code** `Optional[ErrorCode]`

The error code, or `None` when the server sent no known code.

**message** `str`

What went wrong.

**field** `Optional[List[str]]`

The input path that the error is about, for example `["input", "accountType"]`.

**extensions** `dict`

The error's `extensions`, as the server sent them.

**errors** `List[dict]`

Every error of the response. The exception describes the first one.

**job** `Optional[AdminJob]`

The failed job, when the error comes from a job that failed.

```python theme={"system"}
from paradime.apis.admin import AdminConflictException, AdminValidationFailedException
from paradime.apis.admin.users.types import UserAccountType

try:
    paradime.admin.users.create("data-lead@example.com", UserAccountType.ADMIN)
except AdminConflictException:
    print("This email already belongs to a user or to a pending invitation.")
except AdminValidationFailedException as error:
    print(error.field, error.message)
```

Two other exceptions don't come from an API error code:

* `AdminConnectionException` (in `paradime.apis.admin.exception`): the SDK can't reach the API. The message replaces the company token in the endpoint with `***`.
* `AdminJobTimeoutException`: a job didn't finish before the `timeout` of `admin.jobs.wait`. Its `job` attribute is the job's last state.

## Rate limits

When the API refuses a request for its rate limit, the SDK waits for the time that the server asks for and retries. It retries up to `max_rate_limit_retries` times (3 by default). When the server asks for a wait longer than `max_retry_wait` seconds (60 by default), the SDK raises `AdminRateLimitedException` at once. Its `retry_after` attribute is the wait in seconds, when the server sent one.

```python theme={"system"}
paradime = Paradime(
    api_endpoint="API_ENDPOINT",
    api_secret="prdm_cmp_...",
    workspace_uid="WORKSPACE_UID",
    max_rate_limit_retries=5,
    max_retry_wait=120,
)
```

## Next steps

> [card] [Onboard a workspace with the API](https://docs.paradime.io/guides/set-up-and-configure/onboard-a-workspace-with-the-api.md)
>
> Set up a new workspace from start to finish with API calls only.

> [card] [Admin CLI](https://docs.paradime.io/developers/paradime-cli/admin-cli.md)
>
> Run the same operations from your terminal with `paradime admin`.

> [card] [Administration API](https://docs.paradime.io/developers/graphql-api/admin-api/index)
>
> The GraphQL operations that the admin client calls.

> [card] [Conventions](https://docs.paradime.io/developers/graphql-api/admin-api/conventions.md)
>
> Capability groups, error codes, rate limits, pagination and async jobs.


## Related topics

- [Admin client: notifications](https://docs.paradime.io/developers/python-sdk/modules/admin/notifications.md)
- [Admin client: workspaces](https://docs.paradime.io/developers/python-sdk/modules/admin/workspaces.md)
- [Admin client: Bolt](https://docs.paradime.io/developers/python-sdk/modules/admin/bolt.md)
- [Admin client: users](https://docs.paradime.io/developers/python-sdk/modules/admin/users.md)
- [Admin client: environments](https://docs.paradime.io/developers/python-sdk/modules/admin/environments.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.