{"id":5606,"library":"daytona-toolbox-api-client-async","title":"Daytona Toolbox API Client (Async)","description":"The `daytona-toolbox-api-client-async` library provides an asynchronous Python client for interacting with the Daytona Toolbox API. It allows programmatic access to manage developer environments, workspaces, and other Daytona resources. The library is frequently updated, often with daily or near-daily releases aligning with the main Daytona platform.","status":"active","version":"0.164.0","language":"en","source_language":"en","source_url":"https://github.com/daytonaio/daytona","tags":["api-client","async","daytona","development-environments","asyncio"],"install":[{"cmd":"pip install daytona-toolbox-api-client-async","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"symbol":"Client","correct":"from daytona_toolbox_api_client_async import Client"}],"quickstart":{"code":"import asyncio\nimport os\nfrom daytona_toolbox_api_client_async import Client\n\nasync def main():\n    # It's recommended to set API_TOKEN and BASE_URL as environment variables\n    api_token = os.environ.get('DAYTONA_API_TOKEN', 'YOUR_API_TOKEN')\n    base_url = os.environ.get('DAYTONA_BASE_URL', 'http://localhost:3000') # Adjust if your Daytona instance is elsewhere\n\n    if api_token == 'YOUR_API_TOKEN':\n        print(\"Warning: Please set DAYTONA_API_TOKEN environment variable or replace 'YOUR_API_TOKEN'.\")\n    \n    try:\n        client = Client(base_url=base_url, token=api_token)\n        \n        # Example: List available workspaces (requires authentication)\n        print(f\"Attempting to list workspaces from {base_url}...\")\n        workspaces_page = await client.workspaces.list()\n        \n        # Access items from the paginated response\n        if workspaces_page.items:\n            print(f\"Found {len(workspaces_page.items)} workspaces.\")\n            for workspace in workspaces_page.items:\n                print(f\"  - Workspace ID: {workspace.id}, Name: {workspace.name}\")\n        else:\n            print(\"No workspaces found or accessible.\")\n\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n        print(\"Ensure your DAYTONA_API_TOKEN and DAYTONA_BASE_URL are correct and the Daytona API is running.\")\n\nif __name__ == \"__main__\":\n    asyncio.run(main())","lang":"python","description":"This quickstart initializes the asynchronous client and attempts to list workspaces. It uses environment variables for authentication (`DAYTONA_API_TOKEN`) and the API endpoint (`DAYTONA_BASE_URL`), which is the recommended practice. Replace placeholder values or set environment variables before running."},"warnings":[{"fix":"Migrate your dependencies to `daytona-sdk` and update imports accordingly (e.g., `from daytona_sdk import AsyncClient` if applicable). Refer to the `daytona-sdk` documentation for detailed usage.","message":"This `daytona-toolbox-api-client-async` package appears to be superseded by the `daytona-sdk` package. The official Daytona GitHub repository and recent release notes consistently refer to `sdk-python`, which corresponds to the `daytona-sdk` PyPI package. Users are advised to migrate to `daytona-sdk` for future compatibility and features.","severity":"deprecated","affected_versions":"All versions from 0.157.0 onwards (where `daytona-sdk` became prominent)"},{"fix":"Ensure your code uses `await` for all client method calls and runs the main async function using `asyncio.run()`.","message":"This is an *asynchronous* client. All API calls are coroutines and must be `await`ed within an `async` function. The main execution must be wrapped in `asyncio.run()`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Initialize the `Client` with a `token` parameter, typically retrieved from an environment variable (e.g., `os.environ.get('DAYTONA_API_TOKEN')`).","message":"Authentication is mandatory for most Daytona API calls. You must provide a valid API token (or similar credentials) to the `Client` constructor. Failing to do so will result in authentication errors.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}