Daytona Toolbox API Client
The official Python client for interacting with the Daytona Toolbox API, enabling programmatic management of workspaces, projects, and sandboxes. As part of a rapidly evolving platform, this library sees frequent updates, typically on a daily or weekly cadence, and is currently in version 0.164.0.
Warnings
- breaking The library is pre-1.0 (0.x.x versioning), meaning API stability is not guaranteed between minor versions. Backward-incompatible changes can be introduced frequently without a major version bump.
- breaking Error handling was standardized across SDKs in v0.163.0. If you have custom error handling logic, it may need to be updated.
- gotcha Authentication primarily relies on environment variables (`DAYTONA_SERVER_URL`, `DAYTONA_API_KEY`) or the CLI `daytona login`. Failure to configure these will result in client initialization errors or failed API calls.
- gotcha The client is a thin wrapper around the OpenAPI specification. Direct access to API endpoints (e.g., `client.workspace.list_workspaces()`) relies on the OpenAPI structure and may change if the underlying API definitions are modified.
Install
-
pip install daytona-toolbox-api-client
Imports
- DaytonaToolboxApiClient
from daytona_toolbox_api_client.client import DaytonaToolboxApiClient
Quickstart
import os
from daytona_toolbox_api_client.client import DaytonaToolboxApiClient
daytona_server_url = os.environ.get("DAYTONA_SERVER_URL", "")
daytona_api_key = os.environ.get("DAYTONA_API_KEY", "")
if not daytona_server_url or not daytona_api_key:
print("Please set DAYTONA_SERVER_URL and DAYTONA_API_KEY environment variables, or log in via the Daytona CLI.")
else:
try:
client = DaytonaToolboxApiClient(
server_url=daytona_server_url,
api_key=daytona_api_key,
)
# Example: List workspaces
workspaces = client.workspace.list_workspaces()
print("\nYour workspaces:")
if workspaces:
for workspace in workspaces:
print(f"- {workspace.name} (ID: {workspace.id})")
else:
print("No workspaces found.")
except Exception as e:
print(f"Error interacting with Daytona API: {e}")