Skip to main content
You can list sandboxes using the Sandbox.list() method.
Once you have information about running sandbox, you can connect to it using the Sandbox.connect() method.

Listing sandboxes

The Sandbox.list() method supports pagination. In the advanced pagination section, you can find more information about pagination techniques using the updated method.
The code above will output something like this:

Filtering sandboxes

Filter sandboxes by their current state. The state parameter can contain either “running” for running sandboxes or “paused” for paused sandboxes, or both.
Filter sandboxes by the metadata key value pairs specified during Sandbox creation.

Advanced pagination

For more granular pagination, you can set custom per-page item limit (default and maximum is 100) and specify an offset parameter (nextToken or next_token) to start paginating from.
You can fetch all pages by looping through the paginator while checking if there is a next page (using hasNext or has_next property) and fetching until there are no more pages left to fetch:

Old SDK (v1.x.y)

If you’re using SDK with version lower than 2.0.0, the Sandbox.list() method behaves differently.

Filtering sandboxes

You can filter sandboxes by specifying Metadata key value pairs. Specifying multiple key value pairs will return sandboxes that match all of them. This can be useful when you have a large number of sandboxes and want to find only specific ones. The filtering is performed on the server.