# Sandbox

Create, refresh, and login to sandboxes

* [`sfp sandbox create`](#sfp-sandbox-create)
* [`sfp sandbox delete`](#sfp-sandbox-delete)
* [`sfp sandbox delete-with-cleanup`](#sfp-sandbox-delete-with-cleanup)
* [`sfp sandbox list`](#sfp-sandbox-list)
* [`sfp sandbox login`](#sfp-sandbox-login)
* [`sfp sandbox update`](#sfp-sandbox-update)
* [`sfp sandbox validate`](#sfp-sandbox-validate)

## `sfp sandbox create`

Create a sandbox.

```
USAGE
  $ sfp sandbox create -v <value> [--json] [-s <value> [-n <value> | -f <value>]] [-d <value>] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -d, --description=<value>           Description for the sandbox being created
  -f, --definition-file=<value>       Sandbox definition file. Multiple inputs possible by comma seperated list.
  -n, --name=<value>                  Sandbox name(s). Multiple inputs possible by comma seperated list.
  -s, --sourcesandbox=<value>         Provide the name of the source sandbox where the sandbox should be cloned from
  -v, --targetdevhubusername=<value>  (required) Username or alias of the Dev Hub org.
      --loglevel=<option>             [default: info] logging level for this command invocation
                                      <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Create a sandbox.

  Start a sandbox create process for all specified names from the input flag.

ALIASES
  $ sfp org create sandbox

EXAMPLES
  $ sfp sandbox:create -v MyDevHub -n MySandbox1 -s SourceSandbox
```

*See code:* [*src/commands/sandbox/create.ts*](https://source.flxbl.io/flxbl/sfp-pro)

## `sfp sandbox delete`

Delete a sandbox.

```
USAGE
  $ sfp sandbox delete -n <value> -v <value> [--json] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -n, --name=<value>                  (required) Sandbox name(s). Multiple inputs possible by comma seperated list.
  -v, --targetdevhubusername=<value>  (required) Username or alias of the Dev Hub org.
      --loglevel=<option>             [default: info] logging level for this command invocation
                                      <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Delete a sandbox.

  Start a sandbox deletion process for all specified names from the input flag. The process includes only sandboxes with
  status "Completed"

ALIASES
  $ sfp org delete sandbox

EXAMPLES
  $ sfp sandbox:delete -n SIT -v my-sandbox-org
```

*See code:* [*src/commands/sandbox/delete.ts*](https://source.flxbl.io/flxbl/sfp-pro)

## `sfp sandbox delete-with-cleanup`

Delete a sandbox with full cleanup of associated resources.

```
USAGE
  $ sfp sandbox delete-with-cleanup -n <value> -v <value> [--json] [-r <value>] [-e <value>] [-t <value>] [--sfp-server-url
    <value>] [--delete-environments] [--unregister-org] [-f] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -e, --email=<value>                 Email address for authenticated user. Ignored if --application-token is provided.
                                      Can be set via SFP_SERVER_USER env var.
  -f, --force                         Skip confirmation prompts.
  -n, --name=<value>                  (required) Name of the sandbox to delete.
  -r, --repository=<value>            Repository identifier for environment operations. Required when using
                                      --delete-environments.
  -t, --application-token=<value>     Application token for CI/CD authentication. Can be set via SFP_SERVER_TOKEN env
                                      var (CLI flags take precedence over env vars).
  -v, --targetdevhubusername=<value>  (required) Username or alias of the Dev Hub org.
      --delete-environments           Delete all environments associated with this sandbox.
      --loglevel=<option>             [default: info] logging level for this command invocation
                                      <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --sfp-server-url=<value>        URL of the SFP server. Can be set via SFP_SERVER_URL env var or config: sfp
                                      config:set server-url
      --unregister-org                Unregister the sandbox org from sfp server after deletion.

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Delete a sandbox with full cleanup of associated resources.

  Deletes a sandbox from Salesforce and optionally cleans up all associated resources:
  - Deletes all environments in sfp server that use this sandbox
  - Unregisters the sandbox org from sfp server

  This is a compound command that performs multiple operations in sequence, providing a single command for complete
  sandbox cleanup.

EXAMPLES
  $ sfp sandbox delete-with-cleanup -n mySandbox -v myProdOrg

  $ sfp sandbox delete-with-cleanup -n mySandbox -v myProdOrg --delete-environments --repository myorg/myrepo

  $ sfp sandbox delete-with-cleanup -n mySandbox -v myProdOrg --delete-environments --repository myorg/myrepo --unregister-org

  $ sfp sandbox delete-with-cleanup -n mySandbox -v myProdOrg --force --json
```

*See code:* [*src/commands/sandbox/delete-with-cleanup.ts*](https://source.flxbl.io/flxbl/sfp-pro)

## `sfp sandbox list`

This command displays the sandbox status from the given devhub.

```
USAGE
  $ sfp sandbox list -v <value> [--json] [-n <value>] [-s
    Pending|Processing|Completed|Deleted|Deleting|Discarding|Locked|Locking|Sampling|Stopped|Suspended|Activating]
    [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -n, --name=<value>                  Name of the sandbox.
  -s, --status=<option>               [default: Completed] Status of the sandbox to be filtered on
                                      <options: Pending|Processing|Completed|Deleted|Deleting|Discarding|Locked|Locking|
                                      Sampling|Stopped|Suspended|Activating>
  -v, --targetdevhubusername=<value>  (required) Username or alias of the Dev Hub org.
      --json                          output in json format
      --loglevel=<option>             [default: info] logging level for this command invocation
                                      <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>

DESCRIPTION
  This command displays the sandbox status from the given devhub.

ALIASES
  $ sfp sandbox status

EXAMPLES
  $ sfops sandbox:status --name mySandbox1 -v myDevHub
```

*See code:* [*src/commands/sandbox/list.ts*](https://source.flxbl.io/flxbl/sfp-pro)

## `sfp sandbox login`

This command performs a login using the sandbox name.

```
USAGE
  $ sfp sandbox login -n <value> [--json] [--repository <value>] [-e <value>] [-t <value>] [--sfp-server-url
    <value>] [-p <value>] [-a <value>] [-s] [-w] [-v <value>] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -a, --alias=<value>                 Alias for the org.
  -e, --email=<value>                 Email address for authenticated user. Ignored if --application-token is provided.
                                      Can be set via SFP_SERVER_USER env var.
  -n, --name=<value>                  (required) Name of the sandbox required for login.
  -p, --production-username=<value>   Username of the production org that owns the sandbox (for server-based auth)
  -s, --set-default                   Set this org as the default org
  -t, --application-token=<value>     Application token for CI/CD authentication. Can be set via SFP_SERVER_TOKEN env
                                      var (CLI flags take precedence over env vars).
  -v, --targetdevhubusername=<value>  Username or alias of the Dev Hub org.
  -w, --write-file                    Write the results of the org into org_details.json, Please note this is sensitive
                                      and contains access token, so please
                                      ensure it is deleted
      --loglevel=<option>             [default: info] logging level for this command invocation
                                      <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --repository=<value>            The repository identifier. E.g `owner/repo` for GitHub/GitLab or
                                      `org/project/repo` for Azure DevOps
      --sfp-server-url=<value>        URL of the SFP server. Can be set via SFP_SERVER_URL env var or config: sfp
                                      config:set server-url

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  This command performs a login using the sandbox name.

ALIASES
  $ sfp org login sandbox

EXAMPLES
  $ sfp sandbox login --name mySandbox1 -v myDevHub

  $ sfp sandbox login --name mySandbox1 --production-username admin@prod.com

  $ sfp sandbox login -n dev1 -a dev1  # Auto-detects production org via server
```

*See code:* [*src/commands/sandbox/login.ts*](https://source.flxbl.io/flxbl/sfp-pro)

## `sfp sandbox update`

Update/Refresh a sandbox.

```
USAGE
  $ sfp sandbox update -v <value> [--json] [-n <value> | -f <value>] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -f, --definition-file=<value>       [default: config/sandbox-def.json] Sandbox definition file. Multiple inputs
                                      possible by comma seperated list.
  -n, --name=<value>                  Sandbox name(s). Multiple inputs possible by comma seperated list.
  -v, --targetdevhubusername=<value>  (required) Username or alias of the Dev Hub org.
      --loglevel=<option>             [default: info] logging level for this command invocation
                                      <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Update/Refresh a sandbox.

  Start a sandbox refresh process for all specified names from the input flag.

ALIASES
  $ sfp org update sandbox

EXAMPLES
  $ sfp sandbox:update -o MyDevHub -n my-sandbox
```

*See code:* [*src/commands/sandbox/update.ts*](https://source.flxbl.io/flxbl/sfp-pro)

## `sfp sandbox validate`

Validate a sandbox for create, delete, or refresh operations.

```
USAGE
  $ sfp sandbox validate -o create|delete|refresh -v <value> [--json] [-n <value>] [-l
    DEVELOPER|DEVELOPER_PRO|PARTIAL|FULL] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -l, --licensetype=<option>          License type for create validation (DEVELOPER, DEVELOPER_PRO, PARTIAL, FULL).
                                      <options: DEVELOPER|DEVELOPER_PRO|PARTIAL|FULL>
  -n, --name=<value>                  Name of the sandbox to validate (required for delete/refresh operations).
  -o, --operation=<option>            (required) The operation to validate for: create, delete, or refresh.
                                      <options: create|delete|refresh>
  -v, --targetdevhubusername=<value>  (required) Username or alias of the Dev Hub org.
      --loglevel=<option>             [default: info] logging level for this command invocation
                                      <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Validate a sandbox for create, delete, or refresh operations.

  Validates that a sandbox is in the correct state for the specified operation and returns eligibility information
  including any required wait time before the operation can proceed.

  For create operations: Checks if sufficient sandbox licenses are available.
  For delete/refresh operations: Checks if sandbox exists, is in a valid state, and calculates the eligibility wait time
  based on license type.

  Minimum age requirements for delete/refresh:
  - Developer / Developer Pro: 1 day (24 hours)
  - Partial Copy: 5 days
  - Full: 29 days

EXAMPLES
  $ sfp sandbox validate --operation delete --name mySandbox -v myProdOrg

  $ sfp sandbox validate --operation refresh --name mySandbox -v myProdOrg --json

  $ sfp sandbox validate --operation create --licensetype DEVELOPER -v myProdOrg
```

*See code:* [*src/commands/sandbox/validate.ts*](https://source.flxbl.io/flxbl/sfp-pro)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flxbl.io/flxbl/sfp/sfp-community/cli-reference-v51-release-v3/advanced/sandbox.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
