How do I batch delete sandboxes from the CLI?

Last updated: December 19, 2025

Context

When managing multiple sandboxes, you may need to delete several or all of them at once rather than deleting them individually. This is particularly useful for cleanup operations or when managing sandbox lifecycle at scale.

Answer

You can batch delete sandboxes using the CLI in several ways depending on your needs:

Delete All Sandboxes

To delete all your sandboxes at once:

bl delete sbx $(bl get sbx -ojson | jq -r '.[].metadata.name')

Delete Specific Sandboxes

To delete multiple specific sandboxes by name:

bl delete sandbox sandbox-1 sandbox-2

Delete Sandboxes by Status

To delete sandboxes with a specific status (e.g., failed sandboxes):

bl delete sbx $(bl get sbx -ojson | jq -r '.[] | select(.status == "FAILED") | .metadata.name')

Delete Sandboxes by Labels

To delete sandboxes that match specific labels:

bl delete sbx $(bl get sbx -ojson | jq -r '.[] | select(.metadata.labels.nextjs == "true") | .metadata.name')

These commands use jq to parse JSON output and filter sandboxes based on your criteria, making it easy to implement automated cleanup processes for sandbox lifecycle management.