# Admin

# 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)
```

# API Keys

## Create

`admin.api_keys.create(APIKeyCreateParams**kwargs)  -> APIKeyCreateResponse`

**post** `/compute/v1/admin/api-keys`

Create a workspace API key

### Parameters

- `name: str`

  API key name

- `allowed_ips: Optional[SequenceNotStr[str]]`

  IP addresses allowed to use this key (IPv4 or IPv6). An empty array (the default) means all IPs are allowed.

- `expires_in_days: Optional[int]`

  Days until the key expires. Omit for a key that does not expire.

- `mode: Optional[Literal["live", "test"]]`

  Key mode. Test keys create test-mode resources with synthetic data.

  - `"live"`

  - `"test"`

- `workspace_id: Optional[str]`

  Workspace ID to scope this key to. Omit for default workspace.

### Returns

- `class APIKeyCreateResponse: …`

  - `key: str`

    The full API key. This is only shown once — store it securely.

  - `key_details: KeyDetails`

    - `id: str`

      API key ID

    - `allowed_ips: List[str]`

      IP addresses allowed to use this key. An empty array means all IPs are allowed.

    - `created_at: datetime`

    - `expires_at: Optional[datetime]`

      When the key expires. Null if the key does not expire.

    - `is_active: bool`

    - `key_prefix: str`

      First 12 characters of the key

    - `key_type: Literal["workspace"]`

      - `"workspace"`

    - `last_used_at: Optional[datetime]`

    - `livemode: bool`

      Whether this is a live API key (false for test keys).

    - `name: str`

      API key name

    - `workspace_id: str`

      Workspace this key is scoped to

### 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
)
api_key = client.admin.api_keys.create(
    name="x",
)
print(api_key.key)
```

## List

`admin.api_keys.list(APIKeyListParams**kwargs)  -> SyncCursorPage[APIKeyListResponse]`

**get** `/compute/v1/admin/api-keys`

List API keys

### 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

- `workspace_id: Optional[str]`

  Filter by workspace ID. If not provided, returns keys across all workspaces.

### Returns

- `class APIKeyListResponse: …`

  - `id: str`

    API key ID

  - `allowed_ips: List[str]`

    IP addresses allowed to use this key. An empty array means all IPs are allowed.

  - `created_at: datetime`

  - `expires_at: Optional[datetime]`

    When the key expires. Null if the key does not expire.

  - `is_active: bool`

  - `key_prefix: str`

    First 12 characters of the key

  - `key_type: Literal["admin", "workspace"]`

    - `"admin"`

    - `"workspace"`

  - `last_used_at: Optional[datetime]`

  - `livemode: bool`

    Whether this is a live API key (false for test keys).

  - `name: str`

    API key name

  - `workspace_id: Optional[str]`

    Workspace ID if workspace-scoped

### 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.api_keys.list()
page = page.data[0]
print(page.id)
```

## Revoke

`admin.api_keys.revoke(strapi_key_id)  -> APIKeyRevokeResponse`

**post** `/compute/v1/admin/api-keys/{api_key_id}/revoke`

Revoke an API key

### Parameters

- `api_key_id: str`

### Returns

- `class APIKeyRevokeResponse: …`

  - `id: str`

    API key ID

  - `allowed_ips: List[str]`

    IP addresses allowed to use this key. An empty array means all IPs are allowed.

  - `created_at: datetime`

  - `expires_at: Optional[datetime]`

    When the key expires. Null if the key does not expire.

  - `is_active: bool`

  - `key_prefix: str`

    First 12 characters of the key

  - `key_type: Literal["admin", "workspace"]`

    - `"admin"`

    - `"workspace"`

  - `last_used_at: Optional[datetime]`

  - `livemode: bool`

    Whether this is a live API key (false for test keys).

  - `name: str`

    API key name

  - `workspace_id: Optional[str]`

    Workspace ID if workspace-scoped

### 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.api_keys.revoke(
    "api_key_id",
)
print(response.id)
```

# Usage

## List

`admin.usage.list(UsageListParams**kwargs)  -> SyncOpaqueCursorPage[UsageListResponse]`

**get** `/compute/v1/admin/usage`

Retrieve aggregated usage data across the organization, optionally grouped by workspace and/or application.

### Parameters

- `ending_at: Union[str, datetime]`

  End of the time range as an ISO 8601 date-time with timezone, for example 2026-04-08T18:56:46Z

- `starting_at: Union[str, datetime]`

  Start of the time range as an ISO 8601 date-time with timezone, for example 2026-04-08T18:56:46Z

- `window_size: Literal["HOUR", "DAY"]`

  Time window size. HOUR supports up to 31 days per query; DAY supports up to 365 days per query.

  - `"HOUR"`

  - `"DAY"`

- `applications: Optional[Union[Literal["structure_and_binding", "small_molecule_design", "small_molecule_library_screen", 3 more], List[Literal["structure_and_binding", "small_molecule_design", "small_molecule_library_screen", 3 more]]]]`

  Filter to specific applications

  - `Literal["structure_and_binding", "small_molecule_design", "small_molecule_library_screen", 3 more]`

    - `"structure_and_binding"`

    - `"small_molecule_design"`

    - `"small_molecule_library_screen"`

    - `"protein_design"`

    - `"protein_library_screen"`

    - `"adme"`

  - `List[Literal["structure_and_binding", "small_molecule_design", "small_molecule_library_screen", 3 more]]`

    - `"structure_and_binding"`

    - `"small_molecule_design"`

    - `"small_molecule_library_screen"`

    - `"protein_design"`

    - `"protein_library_screen"`

    - `"adme"`

- `group_by: Optional[Union[Literal["workspace_id", "application"], List[Literal["workspace_id", "application"]]]]`

  Group results by workspace_id and/or application

  - `Literal["workspace_id", "application"]`

    - `"workspace_id"`

    - `"application"`

  - `List[Literal["workspace_id", "application"]]`

    - `"workspace_id"`

    - `"application"`

- `limit: Optional[int]`

  Maximum number of buckets to return

- `page: Optional[str]`

  Cursor for pagination

- `workspace_ids: Optional[Union[str, SequenceNotStr[str]]]`

  Filter to specific workspace IDs

  - `str`

  - `SequenceNotStr[str]`

### Returns

- `class UsageListResponse: …`

  - `end_time: datetime`

  - `quantity: int`

    Aggregated billed quantity for this bucket

  - `start_time: datetime`

  - `application: Optional[Literal["structure_and_binding", "small_molecule_design", "small_molecule_library_screen", 3 more]]`

    - `"structure_and_binding"`

    - `"small_molecule_design"`

    - `"small_molecule_library_screen"`

    - `"protein_design"`

    - `"protein_library_screen"`

    - `"adme"`

  - `workspace_id: Optional[str]`

    Present when grouped by workspace_id

### Example

```python
import os
from datetime import datetime
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.usage.list(
    ending_at=datetime.fromisoformat("2019-12-27T18:11:19.117"),
    starting_at=datetime.fromisoformat("2019-12-27T18:11:19.117"),
    window_size="HOUR",
)
page = page.data[0]
print(page.workspace_id)
```
