Daytona Toolbox API Client

0.164.0 · active · verified Sat Apr 11

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

Install

Imports

Quickstart

This quickstart initializes the Daytona client using environment variables for authentication and then attempts to list the user's workspaces. Ensure DAYTONA_SERVER_URL and DAYTONA_API_KEY are set.

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}")

view raw JSON →