---
title: Organizations and workspaces
description: Organizations and workspaces in the dltHub Runtime Python SDK (dlthub_sdk)
keywords: [dlthub, runtime, python sdk, dlthub_sdk, api]
---
# Organizations and workspaces

<!-- generated from dlthub-client 0.33.1, do not edit -->

New to the SDK? [Getting started](getting-started.md) shows how to connect and use it.

## Organizations

### `Organizations` {#organizations}

The organizations the caller belongs to.

#### `Organizations.get()` {#organizations-get}

```python
get(*, id: str) -> Organization
```

Return one organization by ID.

**Arguments**

| Name | Type | Description |
| --- | --- | --- |
| `id` | <code>str</code> | The organization UUID. |

**Returns:** <code><a href="#organization">Organization</a></code> — The organization. Async mode returns an awaitable.

**Raises**

| Exception | When |
| --- | --- |
| [`BadRequest`](errors.md#badrequest) | The runtime rejected the request as invalid. `message`, `code` and `fields` say why. |
| [`NotAuthorized`](errors.md#notauthorized) | The caller lacks the access that this call needs. `message` says why. |
| [`NotFound`](errors.md#notfound) | The organization does not exist. |

#### `Organizations.count()` {#organizations-count}

```python
count() -> int
```

Return how many organizations the caller belongs to.

**Returns:** <code>int</code> — The organization count, which saturates at 10,001. Async mode returns an awaitable.

#### `Organizations.list()` {#organizations-list}

```python
list(
    *,
    limit: int | None = None,
    offset: int = 0,
) -> Iterable[Organization] | AsyncIterable[Organization]
```

Yield the organizations that the caller belongs to, page by page.

It needs no scope, so it is the entry point when the caller knows no IDs
yet.

**Arguments**

| Name | Type | Description |
| --- | --- | --- |
| `limit` | <code>int &#124; None</code> | The most items to return. `None` returns every item up to item 10,100, where the runtime stops paging. |
| `offset` | <code>int</code> | The number of items that the runtime skips first. |

**Returns:** <code>Iterable[<a href="#organization">Organization</a>] &#124; AsyncIterable[<a href="#organization">Organization</a>]</code> — An iterable of organizations. Async mode returns an async iterable.

**Raises**

| Exception | When |
| --- | --- |
| `ValueError` | A negative `limit` or `offset`. |

### `Organization` {#organization}

An organization: the tenant that owns workspaces, members and billing.

**[Collections](getting-started.md#collections-and-attributes)**

| Name | Type | Example | Description |
| --- | --- | --- | --- |
| `organization.workspaces` | <code><a href="#workspaces">Workspaces</a></code> | `organization.workspaces.list()` | The workspaces in this organization. |

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `id` | <code>str</code> | Unique ID (a UUID). |
| `name` | <code>str</code> | The name of the organization. |
| `description` | <code>str &#124; None</code> | Free-text description of the organization; `None` when none is set. |
| `dataplane_id` | <code>str &#124; None</code> | Data plane of the organization's workspaces; `None` until a region is set. |
| `created_at` | <code>datetime</code> | When it was created. |

#### `Organization.set_dataplane()` {#organization-set_dataplane}

```python
set_dataplane(*, dataplane_id: str) -> Organization
```

Set the data plane that holds the workspaces of this organization.

The organization needs a data plane before it can hold a workspace. The
data plane fixes where the data of the workspaces resides. The choice is
final.

**Arguments**

| Name | Type | Description |
| --- | --- | --- |
| `dataplane_id` | <code>str</code> | The data plane to assign. |

**Returns:** <code><a href="#organization">Organization</a></code> — A fresh snapshot. Async mode returns an awaitable.

**Raises**

| Exception | When |
| --- | --- |
| [`BadRequest`](errors.md#badrequest) | The runtime rejected the request as invalid. `message`, `code` and `fields` say why. |
| [`Conflict`](errors.md#conflict) | The organization already has a data plane. |
| [`NotAuthorized`](errors.md#notauthorized) | The caller lacks the access that this call needs. `message` says why. |
| [`NotFound`](errors.md#notfound) | The organization does not exist. |

#### `Organization.me()` {#organization-me}

```python
me() -> OrganizationCaller
```

Return who the caller is in this organization, with role and workspaces.

It works for an API key and for a user token.

**Returns:** <code><a href="#organizationcaller">OrganizationCaller</a></code> — The identity, role and workspace memberships of the caller in this organization. Async mode returns an awaitable.

**Raises**

| Exception | When |
| --- | --- |
| [`NotAuthorized`](errors.md#notauthorized) | The caller lacks the access that this call needs. `message` says why. |
| [`NotFound`](errors.md#notfound) | The organization no longer exists. |

### `Membership` {#membership}

A workspace that the caller belongs to, with the role of the caller.

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `workspace` | <code><a href="#workspace">Workspace</a></code> | The workspace, bound and ready to navigate from. |
| `role` | <code>str</code> | The role of the user in the workspace. |

### `OrganizationCaller` {#organizationcaller}

Who the token belongs to, and what the caller can do in one organization.

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `email` | <code>str</code> | The email of the current user. |
| `user_id` | <code>str</code> | The ID of the current user. |
| `organization_membership_id` | <code>str</code> | The ID of the organization member for this organization. |
| `role` | <code>str</code> | The role of the user in this organization. |
| `workspace_memberships` | <code>tuple[<a href="#membership">Membership</a>, ...]</code> | The workspaces of the organization that the caller belongs to. |

## Workspaces

### `Workspaces` {#workspaces}

The workspaces of an organization, scoped by the context that reaches them.

#### `Workspaces.create()` {#workspaces-create}

```python
create(
    *,
    name: str,
    description: str | None = None,
    organization_id: str | None = None,
) -> Workspace
```

Create a workspace in an organization.

**Arguments**

| Name | Type | Description |
| --- | --- | --- |
| `name` | <code>str</code> | Name of the new workspace. Names do not have to be unique. |
| `description` | <code>str &#124; None</code> | Free-text description, or `None` for none. |
| `organization_id` | <code>str &#124; None</code> | Overrides the organization in scope. Required when the context carries none. |

**Returns:** <code><a href="#workspace">Workspace</a></code> — The new workspace, scoped so that its jobs are reachable. Async mode returns an awaitable.

**Raises**

| Exception | When |
| --- | --- |
| [`BadRequest`](errors.md#badrequest) | The runtime rejected the request as invalid. `message`, `code` and `fields` say why. |
| [`Conflict`](errors.md#conflict) | The organization has no data plane yet, or a trial organization already has its workspace. `code` and `message` say why. |
| [`NotAuthorized`](errors.md#notauthorized) | The caller lacks the access that this call needs. `message` says why. |
| [`NotFound`](errors.md#notfound) | The organization does not exist. |
| [`ScopeMissing`](errors.md#scopemissing) | No organization in scope and none passed. |

#### `Workspaces.get()` {#workspaces-get}

```python
get(*, id: str) -> Workspace
```

Return one workspace by ID.

**Arguments**

| Name | Type | Description |
| --- | --- | --- |
| `id` | <code>str</code> | The workspace UUID. |

**Returns:** <code><a href="#workspace">Workspace</a></code> — The workspace. Async mode returns an awaitable.

**Raises**

| Exception | When |
| --- | --- |
| [`BadRequest`](errors.md#badrequest) | The runtime rejected the request as invalid. `message`, `code` and `fields` say why. |
| [`NotAuthorized`](errors.md#notauthorized) | The caller lacks the access that this call needs. `message` says why. |
| [`NotFound`](errors.md#notfound) | The workspace does not exist. |

#### `Workspaces.count()` {#workspaces-count}

```python
count(*, organization_id: str | None = None) -> int
```

Count the workspaces of one organization, without reading them.

It counts the live (unarchived) workspaces of the organization that the
caller can see.

**Arguments**

| Name | Type | Description |
| --- | --- | --- |
| `organization_id` | <code>str &#124; None</code> | Overrides the organization in scope. Required when the context carries none. |

**Returns:** <code>int</code> — The workspace count, which saturates at 10,001. Async mode returns an awaitable.

**Raises**

| Exception | When |
| --- | --- |
| [`BadRequest`](errors.md#badrequest) | The runtime rejected the request as invalid. `message`, `code` and `fields` say why. |
| [`NotAuthorized`](errors.md#notauthorized) | The caller lacks the access that this call needs. `message` says why. |
| [`NotFound`](errors.md#notfound) | The organization does not exist. |
| [`ScopeMissing`](errors.md#scopemissing) | No organization in scope and none passed. |

#### `Workspaces.list()` {#workspaces-list}

```python
list(
    *,
    organization_id: str | None = None,
    limit: int | None = None,
    offset: int = 0,
) -> Iterable[Workspace] | AsyncIterable[Workspace]
```

Yield the workspaces of one organization, page by page.

It yields the live (unarchived) workspaces of the organization that the
caller can see. Errors from the runtime raise when the iteration starts.

**Arguments**

| Name | Type | Description |
| --- | --- | --- |
| `organization_id` | <code>str &#124; None</code> | Overrides the organization in scope. Required when the context carries none. |
| `limit` | <code>int &#124; None</code> | The most workspaces to return. `None` returns every workspace up to item 10,100, where the runtime stops paging. |
| `offset` | <code>int</code> | The number of workspaces that the runtime skips first. |

**Returns:** <code>Iterable[<a href="#workspace">Workspace</a>] &#124; AsyncIterable[<a href="#workspace">Workspace</a>]</code> — An iterable of workspaces. Async mode returns an async iterable.

**Raises**

| Exception | When |
| --- | --- |
| [`BadRequest`](errors.md#badrequest) | The runtime rejected the request as invalid. `message`, `code` and `fields` say why. |
| [`NotAuthorized`](errors.md#notauthorized) | The caller lacks the access that this call needs. `message` says why. |
| [`NotFound`](errors.md#notfound) | The organization does not exist. |
| [`ScopeMissing`](errors.md#scopemissing) | No organization in scope and none passed. |
| `ValueError` | A negative `limit` or `offset`. |

### `Workspace` {#workspace}

A workspace: the unit that holds deployed jobs.

**[Collections](getting-started.md#collections-and-attributes)**

| Name | Type | Example | Description |
| --- | --- | --- | --- |
| `workspace.job_runs` | <code><a href="job-runs#jobruns">JobRuns</a></code> | `workspace.job_runs.list()` | The job runs of this workspace, across all its jobs. |
| `workspace.deployments` | <code><a href="deployments#deployments">Deployments</a></code> | `workspace.deployments.list()` | The code versions uploaded to this workspace. |
| `workspace.configurations` | <code><a href="deployments#configurations">Configurations</a></code> | `workspace.configurations.list()` | The configuration versions uploaded to this workspace. |
| `workspace.telemetry` | <code><a href="telemetry#telemetry">Telemetry</a></code> | `workspace.telemetry.status()` | What the runtime recorded about the pipeline runs of this workspace. |
| `workspace.variables` | <code><a href="variables#variables">Variables</a></code> | `workspace.variables.list()` | The variables that the job runs of this workspace read. |
| `workspace.jobs` | <code><a href="jobs#jobs">Jobs</a></code> | `workspace.jobs.list()` | The jobs deployed in this workspace. |

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `id` | <code>str</code> | Unique ID (a UUID). |
| `name` | <code>str</code> | The name of the workspace. |
| `description` | <code>str &#124; None</code> | Free-text description of the workspace; `None` when none is set. |
| `organization_id` | <code>str</code> | The ID of the parent organization. |
| `dataplane_id` | <code>str</code> | Identifier of the data plane that holds this workspace's user data. Matches the subdomain of the plane's public entrypoint. |
| `is_playground` | <code>bool</code> | Whether this is the user's auto-created personal playground workspace. A playground has a single member and cannot be updated, archived, shared, or given API keys. |
| `predefined_profiles` | <code>Mapping[str, str]</code> | Deprecated and always empty. A job definition declares its data access. |
| `created_at` | <code>datetime</code> | When it was created. |
| `archived_at` | <code>datetime &#124; None</code> | When the workspace was archived; `None` when live. An archived workspace rejects all changes except unarchiving, though owners can still manage its workspace variables. |
| `dashboard_url` | <code>str</code> | The page of this workspace in the dltHub web app. |

#### `Workspace.update()` {#workspace-update}

```python
update(*, name: str | Keep = KEEP, description: str | None | Keep = KEEP) -> Workspace
```

Change the name of the workspace, its description, or both.

**Arguments**

| Name | Type | Description |
| --- | --- | --- |
| `name` | <code>str &#124; <a href="client#keep">Keep</a></code> | New name. [`KEEP`](client.md#KEEP), the default, leaves it unchanged. |
| `description` | <code>str &#124; None &#124; <a href="client#keep">Keep</a></code> | New description. `None` clears it, and [`KEEP`](client.md#KEEP) leaves it unchanged. |

**Returns:** <code><a href="#workspace">Workspace</a></code> — A fresh snapshot. Async mode returns an awaitable.

**Raises**

| Exception | When |
| --- | --- |
| [`BadRequest`](errors.md#badrequest) | The runtime rejected the request as invalid. `message`, `code` and `fields` say why. |
| [`Conflict`](errors.md#conflict) | The current state does not allow the call, for example an archived workspace. `code` and `message` say why. |
| [`NotAuthorized`](errors.md#notauthorized) | The caller lacks the access that this call needs. `message` says why. |
| [`NotFound`](errors.md#notfound) | The workspace no longer exists. |

#### `Workspace.archive()` {#workspace-archive}

```python
archive() -> Workspace
```

Freeze the workspace: its schedules stop and it refuses changes.

**Returns:** <code><a href="#workspace">Workspace</a></code> — A fresh snapshot with `archived_at` set. Async mode returns an awaitable.

**Raises**

| Exception | When |
| --- | --- |
| [`BadRequest`](errors.md#badrequest) | The runtime rejected the request as invalid. `message`, `code` and `fields` say why. |
| [`Conflict`](errors.md#conflict) | The workspace is already archived, or a job run in it is still active. `code` and `message` say why. |
| [`NotAuthorized`](errors.md#notauthorized) | The caller lacks the access that this call needs. `message` says why. |
| [`NotFound`](errors.md#notfound) | The workspace no longer exists. |

#### `Workspace.unarchive()` {#workspace-unarchive}

```python
unarchive() -> Workspace
```

Reopen an archived workspace and restart its schedules.

**Returns:** <code><a href="#workspace">Workspace</a></code> — A fresh snapshot with `archived_at` cleared. Async mode returns an awaitable.

**Raises**

| Exception | When |
| --- | --- |
| [`Conflict`](errors.md#conflict) | The workspace is not archived. |
| [`NotAuthorized`](errors.md#notauthorized) | The caller lacks the access that this call needs. `message` says why. |
| [`NotFound`](errors.md#notfound) | The workspace no longer exists. |

#### `Workspace.members()` {#workspace-members}

```python
members(
    *,
    limit: int | None = None,
    offset: int = 0,
) -> Iterable[WorkspaceMember] | AsyncIterable[WorkspaceMember]
```

Yield the members of this workspace, with their roles.

**Arguments**

| Name | Type | Description |
| --- | --- | --- |
| `limit` | <code>int &#124; None</code> | The most items to return. `None` returns every item up to item 10,100, where the runtime stops paging. |
| `offset` | <code>int</code> | The number of items that the runtime skips first. |

**Returns:** <code>Iterable[<a href="#workspacemember">WorkspaceMember</a>] &#124; AsyncIterable[<a href="#workspacemember">WorkspaceMember</a>]</code> — An iterable of members. Async mode returns an async iterable.

**Raises**

| Exception | When |
| --- | --- |
| [`NotAuthorized`](errors.md#notauthorized) | The caller lacks the access that this call needs. `message` says why. |
| `ValueError` | A negative `limit` or `offset`. |

#### `Workspace.me()` {#workspace-me}

```python
me() -> WorkspaceCaller
```

Return who the caller is in this workspace, and what the caller can do.

It works for an API key and for a user token. It also records this
workspace as the latest one of the caller, so [`Runtime.me()`](client.md#runtime-me) then
reports its organization as `latest_organization`.

**Returns:** <code><a href="#workspacecaller">WorkspaceCaller</a></code> — The identity and roles of the caller. Async mode returns an awaitable.

**Raises**

| Exception | When |
| --- | --- |
| [`NotAuthorized`](errors.md#notauthorized) | The caller lacks the access that this call needs. `message` says why. |
| [`NotFound`](errors.md#notfound) | The workspace no longer exists. |

### `WorkspaceCaller` {#workspacecaller}

Who the token belongs to, and what the caller can do in one workspace.

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `email` | <code>str</code> | The email of the current user. |
| `user_id` | <code>str</code> | The ID of the current user. |
| `organization_membership_id` | <code>str</code> | The ID of the organization member in the parent organization. |
| `organization_id` | <code>str</code> | The ID of the parent organization. |
| `organization_role` | <code>str</code> | The role of the user in the parent organization. |
| `workspace_role` | <code>str</code> | The role of the user in this workspace. |

### `WorkspaceMember` {#workspacemember}

One member of a workspace: a person or a service account (workspace API key).

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `email` | <code>str</code> | The email of the user. |
| `user_id` | <code>str</code> | The ID of the user. |
| `role` | <code>str</code> | The role of the user in the workspace. |
| `name` | <code>str &#124; None</code> | Display name; `None` when the user has no name set. |

## Caller

### `Caller` {#caller}

The person that the token belongs to.

A user token or a personal API key gets it. A workspace API key gets
`dlthub_sdk.NotAuthorized` instead (see `dlthub_sdk.Runtime.me()`).
[`Organization.me()`](#organization-me) and [`Workspace.me()`](#workspace-me) answer for any caller.

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `email` | <code>str</code> | The email of the current user. |
| `user_id` | <code>str</code> | The ID of the current user. |
| `organization_membership_id` | <code>str</code> | Your membership id in `latest_organization`. |
| `name` | <code>str &#124; None</code> | The user's display name (full name); `None` if the identity provider supplied none. |
| `primary_organization` | <code><a href="#organization">Organization</a></code> | The organization where new workspaces are created by default. |
| `latest_organization` | <code><a href="#organization">Organization</a></code> | The organization you used most recently. |
| `organization_memberships` | <code>tuple[<a href="#organizationmembership">OrganizationMembership</a>, ...]</code> | Every organization that the user belongs to, with the role of the user. |

### `OrganizationMembership` {#organizationmembership}

An organization that the caller belongs to, with the role of the caller.

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `organization` | <code><a href="#organization">Organization</a></code> | The organization, bound and ready to navigate from. |
| `role` | <code>str</code> | The role of the user in the organization. |
| `is_active` | <code>bool</code> | Whether the membership is active. |

## Data planes

### `Dataplanes` {#dataplanes}

The data planes that this caller can choose from.

The runtime returns them in one response, so there is nothing to page and no
count.

#### `Dataplanes.list()` {#dataplanes-list}

```python
list() -> tuple[Dataplane, ...]
```

Return every data plane available to this caller.

It needs no organization or workspace, like [`Organizations.list()`](#organizations-list).

**Returns:** <code>tuple[<a href="#dataplane">Dataplane</a>, ...]</code> — All of them, in the order of the runtime. Async mode returns an awaitable.

### `Dataplane` {#dataplane}

A data plane that an organization can use for its workspaces.

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `id` | <code>str</code> | Data plane id, e.g. `eu1`; also the subdomain of its URL. |
| `name` | <code>str</code> | Human-readable data plane name. |
| `region` | <code>str</code> | Cloud region the data plane runs in, e.g. `europe-west4`. |
| `description` | <code>str &#124; None</code> | Optional note about the data plane; `None` when there is none. |
