Skip to main content

What You’ll Learn

  • Listing every volume owned by the caller
  • Inspecting per-volume metadata (size, content type, creation time)
  • Deleting a single volume (blob + metadata row)

Prerequisites

export DECLAW_API_KEY="your-api-key"
export DECLAW_DOMAIN="your-declaw-instance.example.com:8080"

Listing

from declaw import Volumes

volumes = Volumes.list()  # newest first
for vol in volumes:
    print(f"{vol.volume_id}  {vol.name:30s}  {vol.size_bytes:>12,} bytes  {vol.created_at}")
Returns an empty list if the caller has no volumes. The list is owner-scoped: another tenant’s volumes are never visible.

Fetching One

vol = Volumes.get("vol-abc123")
print(vol.blob_key)       # object-store key, for reference only
print(vol.size_bytes)
Raises NotFoundException (Python) / NotFoundError (TypeScript) on an unknown or non-owned volume ID.

Deleting

Volumes.delete("vol-abc123")
Deletion removes both the blob and the catalog row. It does not affect sandboxes that were previously created with the volume — they hold their own hydrated copies in their overlays. Future Sandbox.create(volumes=[...]) calls referencing that volume_id will fail with 403.

Housekeeping Pattern

Delete every volume whose name matches a prefix and was created more than 7 days ago:
import datetime as dt
from declaw import Volumes

cutoff = dt.datetime.now(dt.timezone.utc) - dt.timedelta(days=7)

for vol in Volumes.list():
    created = dt.datetime.fromisoformat(vol.created_at.rstrip("Z") + "+00:00")
    if vol.name.startswith("ephemeral-") and created < cutoff:
        print(f"deleting {vol.volume_id} ({vol.name}, {vol.size_bytes} bytes)")
        Volumes.delete(vol.volume_id)

Phase 1 Limits

  • There is no bulk-delete endpoint; loop over Volumes.list() and call .delete() per item.
  • Deletion is not transactional with in-flight Sandbox.create calls. A volume referenced by a not-yet-dispatched create can be deleted between validation and dispatch; the create then fails.