paradime.admin is the Python client for the Administration API. 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.
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. 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. - Python 3.11 or later, and the latest
paradime-iopackage.
Install the SDK
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.
Areas
paradime.admin has one client for each area of the Administration API.
To run schedules and agents, keep using
paradime.bolt and paradime.dinoai_agents. The SDK has no methods for 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-Workspaceheader. The client sends theworkspace_uidyou create it with. Every workspace-level method also takesworkspace_uid=, which targets another workspace for that call only. - Company-level calls need no workspace:
admin.workspaces(create, list, update, delete),admin.usageacross workspaces, and the Slack connection. You can create the client withoutworkspace_uidfor these calls.
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.
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.
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 raisesAdminConflictException: 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 examplehas_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. 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 readsNone 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 anAdminJob. Wait for it with admin.jobs.wait.
Errors
Each API error raises the exception of itsextensions.code. Every exception below subclasses AdminApiException, which subclasses ParadimeAPIException. Import them from paradime.apis.admin.
Each exception has these attributes:
AdminConnectionException(inparadime.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 thetimeoutofadmin.jobs.wait. Itsjobattribute 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 tomax_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.
Next steps
Onboard a workspace with the API
Set up a new workspace from start to finish with API calls only.
Admin CLI
Run the same operations from your terminal with
paradime admin.Administration API
The GraphQL operations that the admin client calls.
Conventions
Capability groups, error codes, rate limits, pagination and async jobs.