# Workspaces

## Create

`admin.workspaces.create(WorkspaceCreateParams**kwargs)  -> WorkspaceCreateResponse`

**post** `/compute/v1/admin/workspaces`

Create a workspace

### Parameters

- `data_retention: Optional[DataRetention]`

  How long result data is retained before automatic deletion. Defaults to 7 days if not specified. Maximum retention is 14 days (336 hours).

  - `unit: Literal["hours", "days"]`

    Time unit for retention duration

    - `"hours"`

    - `"days"`

  - `value: int`

    Duration value. Maximum retention is 14 days (or 336 hours).

- `name: Optional[str]`

  Workspace name

### Returns

- `class WorkspaceCreateResponse: …`

  - `id: str`

    Workspace ID

  - `archived_at: Optional[datetime]`

  - `created_at: datetime`

  - `data_retention: DataRetention`

    How long result data is retained before automatic deletion. Defaults to 7 days if not specified. Maximum retention is 14 days (336 hours).

    - `unit: Literal["hours", "days"]`

      Time unit for retention duration

      - `"hours"`

      - `"days"`

    - `value: int`

      Duration value. Maximum retention is 14 days (or 336 hours).

  - `is_default: bool`

    Whether this is the default workspace

  - `name: Optional[str]`

    Workspace name

  - `updated_at: datetime`

### Example

```python
import os
from boltz_api import Boltz

client = Boltz(
    api_key=os.environ.get("BOLTZ_API_KEY"),  # This is the default and can be omitted
)
workspace = client.admin.workspaces.create()
print(workspace.id)
```

## List

`admin.workspaces.list(WorkspaceListParams**kwargs)  -> SyncCursorPage[WorkspaceListResponse]`

**get** `/compute/v1/admin/workspaces`

List workspaces

### Parameters

- `after_id: Optional[str]`

  Return results after this ID

- `before_id: Optional[str]`

  Return results before this ID

- `limit: Optional[int]`

  Max items to return

### Returns

- `class WorkspaceListResponse: …`

  - `id: str`

    Workspace ID

  - `archived_at: Optional[datetime]`

  - `created_at: datetime`

  - `data_retention: DataRetention`

    How long result data is retained before automatic deletion. Defaults to 7 days if not specified. Maximum retention is 14 days (336 hours).

    - `unit: Literal["hours", "days"]`

      Time unit for retention duration

      - `"hours"`

      - `"days"`

    - `value: int`

      Duration value. Maximum retention is 14 days (or 336 hours).

  - `is_default: bool`

    Whether this is the default workspace

  - `name: Optional[str]`

    Workspace name

  - `updated_at: datetime`

### Example

```python
import os
from boltz_api import Boltz

client = Boltz(
    api_key=os.environ.get("BOLTZ_API_KEY"),  # This is the default and can be omitted
)
page = client.admin.workspaces.list()
page = page.data[0]
print(page.id)
```

## Retrieve

`admin.workspaces.retrieve(strworkspace_id)  -> WorkspaceRetrieveResponse`

**get** `/compute/v1/admin/workspaces/{workspace_id}`

Get a workspace

### Parameters

- `workspace_id: str`

### Returns

- `class WorkspaceRetrieveResponse: …`

  - `id: str`

    Workspace ID

  - `archived_at: Optional[datetime]`

  - `created_at: datetime`

  - `data_retention: DataRetention`

    How long result data is retained before automatic deletion. Defaults to 7 days if not specified. Maximum retention is 14 days (336 hours).

    - `unit: Literal["hours", "days"]`

      Time unit for retention duration

      - `"hours"`

      - `"days"`

    - `value: int`

      Duration value. Maximum retention is 14 days (or 336 hours).

  - `is_default: bool`

    Whether this is the default workspace

  - `name: Optional[str]`

    Workspace name

  - `updated_at: datetime`

### Example

```python
import os
from boltz_api import Boltz

client = Boltz(
    api_key=os.environ.get("BOLTZ_API_KEY"),  # This is the default and can be omitted
)
workspace = client.admin.workspaces.retrieve(
    "workspace_id",
)
print(workspace.id)
```

## Update

`admin.workspaces.update(strworkspace_id, WorkspaceUpdateParams**kwargs)  -> WorkspaceUpdateResponse`

**post** `/compute/v1/admin/workspaces/{workspace_id}`

Update a workspace

### Parameters

- `workspace_id: str`

- `data_retention: Optional[DataRetention]`

  How long result data is retained before automatic deletion. Defaults to 7 days if not specified. Maximum retention is 14 days (336 hours).

  - `unit: Literal["hours", "days"]`

    Time unit for retention duration

    - `"hours"`

    - `"days"`

  - `value: int`

    Duration value. Maximum retention is 14 days (or 336 hours).

- `name: Optional[str]`

### Returns

- `class WorkspaceUpdateResponse: …`

  - `id: str`

    Workspace ID

  - `archived_at: Optional[datetime]`

  - `created_at: datetime`

  - `data_retention: DataRetention`

    How long result data is retained before automatic deletion. Defaults to 7 days if not specified. Maximum retention is 14 days (336 hours).

    - `unit: Literal["hours", "days"]`

      Time unit for retention duration

      - `"hours"`

      - `"days"`

    - `value: int`

      Duration value. Maximum retention is 14 days (or 336 hours).

  - `is_default: bool`

    Whether this is the default workspace

  - `name: Optional[str]`

    Workspace name

  - `updated_at: datetime`

### Example

```python
import os
from boltz_api import Boltz

client = Boltz(
    api_key=os.environ.get("BOLTZ_API_KEY"),  # This is the default and can be omitted
)
workspace = client.admin.workspaces.update(
    workspace_id="workspace_id",
)
print(workspace.id)
```

## Archive

`admin.workspaces.archive(strworkspace_id)  -> WorkspaceArchiveResponse`

**post** `/compute/v1/admin/workspaces/{workspace_id}/archive`

Archives a workspace and deactivates all its API keys. This action is irreversible.

### Parameters

- `workspace_id: str`

### Returns

- `class WorkspaceArchiveResponse: …`

  - `id: str`

    Workspace ID

  - `archived_at: Optional[datetime]`

  - `created_at: datetime`

  - `data_retention: DataRetention`

    How long result data is retained before automatic deletion. Defaults to 7 days if not specified. Maximum retention is 14 days (336 hours).

    - `unit: Literal["hours", "days"]`

      Time unit for retention duration

      - `"hours"`

      - `"days"`

    - `value: int`

      Duration value. Maximum retention is 14 days (or 336 hours).

  - `is_default: bool`

    Whether this is the default workspace

  - `name: Optional[str]`

    Workspace name

  - `updated_at: datetime`

### Example

```python
import os
from boltz_api import Boltz

client = Boltz(
    api_key=os.environ.get("BOLTZ_API_KEY"),  # This is the default and can be omitted
)
response = client.admin.workspaces.archive(
    "workspace_id",
)
print(response.id)
```
