# Pool

Build and manage scratch org or sandbox pools

* [`sfp pool metrics publish`](#sfp-pool-metrics-publish)
* [`sfp pool probe`](#sfp-pool-probe)
* [`sfp pool sandbox expire`](#sfp-pool-sandbox-expire)
* [`sfp pool sandbox fetch`](#sfp-pool-sandbox-fetch)
* [`sfp pool sandbox init`](#sfp-pool-sandbox-init)
* [`sfp pool sandbox list`](#sfp-pool-sandbox-list)
* [`sfp pool sandbox monitor`](#sfp-pool-sandbox-monitor)
* [`sfp pool sandbox retain`](#sfp-pool-sandbox-retain)
* [`sfp pool scratch delete`](#sfp-pool-scratch-delete)
* [`sfp pool scratch fetch`](#sfp-pool-scratch-fetch)
* [`sfp pool scratch init`](#sfp-pool-scratch-init)
* [`sfp pool scratch list`](#sfp-pool-scratch-list)

## `sfp pool metrics publish`

Publish metrics about scratch org pools to your observability platform, via StatsD or direct APIs for supported platforms

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

FLAGS
  -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
  Publish metrics about scratch org pools to your observability platform, via StatsD or direct APIs for supported
  platforms

EXAMPLES
  $ sfp pool:metrics:publish -v <myDevHub>
```

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

## `sfp pool probe`

Probe a pool by name in a given folder

```
USAGE
  $ sfp pool probe -n <value> -f <value> [--json]

FLAGS
  -f, --folder=<value>  (required) Path to the folder containing pool definition files
  -n, --name=<value>    (required) Name of the pool to find

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Probe a pool by name in a given folder

EXAMPLES
  $ sfp pool:probe -n mypool -f ./mypools
```

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

## `sfp pool sandbox expire`

Expire a sandbox from a pool

```
USAGE
  $ sfp pool sandbox expire -n <value> [--json] [-r <value>] [--repository-org <value>]

FLAGS
  -n, --name=<value>            (required) The name of the sandbox to expire
  -r, --repository=<value>      The repository path that stores the lock. E.g `owner/repo`
      --repository-org=<value>  Salesforce org alias to be used when SALESFORCE is the repository provider

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Expire a sandbox from a pool
```

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

## `sfp pool sandbox fetch`

Fetch a sandbox from a pool and assign with a unique identifier

```
USAGE
  $ sfp pool sandbox fetch --devhubalias <value> -p <value> -b <value> -i <value> [--json] [-r <value>]
    [--repository-org <value>] [-m]

FLAGS
  -b, --branch=<value>          (required) The branch of the pool from where environment is to be fetched
  -i, --uniqueid=<value>        (required) unique id to identify the assignment of the sandbox
  -m, --mortal                  If set, the sandbox will expire according to pool configuration. By default, sandboxes
                                are immortal.
  -p, --pool=<value>            (required) The name of the pool to fetch the sandbox from
  -r, --repository=<value>      The repository path that stores the lock. E.g `owner/repo`
      --devhubalias=<value>     (required) [default: devhub] The devhub alias associated with the pool
      --repository-org=<value>  Salesforce org alias to be used when SALESFORCE is the repository provider

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Fetch a sandbox from a pool and assign with a unique identifier

EXAMPLES
  $ sfp pool sandbox fetch --repository owner/repo --pool pool-ci --branch feature/branch --uniqueid 1234

  $ sfp pool sandbox fetch --repository owner/repo --pool pool-ci --poolType sandbox --branch feature/branch --uniqueid 1234
```

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

## `sfp pool sandbox init`

Prepare a pool of sandboxes

```
USAGE
  $ sfp pool sandbox init -v <value> -r <value> [--json] [-f <value>] [--repository-org <value>] [-g <value>...]
    [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -f, --poolconfig=<value>            [default: config/sandbox-pool-config.json] The path to the configuration file for
                                      creating a pool of scratch orgs
  -g, --logsgroupsymbol=<value>...    Symbol used by CICD platform to group/collapse logs in the console. Provide an
                                      opening group, and an optional closing group symbol.
  -r, --repository=<value>            (required) Github repository in the format owner/repo
  -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>
      --repository-org=<value>        Salesforce org alias to be used when SALESFORCE is the repository provider

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Prepare a pool of sandboxes

EXAMPLES
  $ sfp pool sandbox init -f path/to/sandbox-pool-config.json -v devhub-alias -r owner/repo
```

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

## `sfp pool sandbox list`

List all sandboxes in the pool

```
USAGE
  $ sfp pool sandbox list [--json] [-r <value>] [--repository-org <value>] [-p <value>] [-b <value>]

FLAGS
  -b, --branch=<value>          Filter by branch name
  -p, --pool=<value>            Filter by pool name
  -r, --repository=<value>      The repository path that stores the lock. E.g `owner/repo`
      --repository-org=<value>  Salesforce org alias to be used when SALESFORCE is the repository provider

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  List all sandboxes in the pool
```

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

## `sfp pool sandbox monitor`

Monitor sandbox status and do the necessary actions such as assigning to pool, activating users, etc.

```
USAGE
  $ sfp pool sandbox monitor -v <value> -r <value> [--json] [-d <value>] [-f <value>...] [--repository-org <value>] [-g
    <value>...] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -d, --directory=<value>             Directory containing the sandbox pool configuration files
  -f, --configfile=<value>...         Path to the sandbox pool configuration file
  -g, --logsgroupsymbol=<value>...    Symbol used by CICD platform to group/collapse logs in the console. Provide an
                                      opening group, and an optional closing group symbol.
  -r, --repository=<value>            (required) Repository in the format owner/repo for GitHub, or ProjectId for Gitlab
  -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>
      --repository-org=<value>        Salesforce org alias to be used when SALESFORCE is the repository provider

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Monitor sandbox status and do the necessary actions such as assigning to pool, activating users, etc.

EXAMPLES
  $ sfp pool sandbox monitor -v devhub -r owner/repo -f path/to/sandbox-pool-config.json
```

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

## `sfp pool sandbox retain`

Toggle immortality of a sandbox (prevent/allow automatic expiration)

```
USAGE
  $ sfp pool sandbox retain -n <value> [--json] [-r <value>] [--repository-org <value>]

FLAGS
  -n, --name=<value>            (required) The name of the sandbox to toggle immortality for
  -r, --repository=<value>      The repository path that stores the lock. E.g `owner/repo`
      --repository-org=<value>  Salesforce org alias to be used when SALESFORCE is the repository provider

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Toggle immortality of a sandbox (prevent/allow automatic expiration)
```

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

## `sfp pool scratch delete`

Deletes the pooled scratch orgs from the Scratch Org Pool

```
USAGE
  $ sfp pool scratch delete -v <value> [--json] [-t <value>] [-i | -a] [-o] [--apiversion <value>] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -a, --allscratchorgs                Deletes all used and unused Scratch orgs from pool by the tag
  -i, --inprogressonly                Deletes all In Progress Scratch orgs from pool by the tag
  -o, --orphans                       Recovers scratch orgs that were created by salesforce but were not tagged to sfp
                                      due to timeouts etc.
  -t, --tag=<value>                   tag used to identify the scratch org pool
  -v, --targetdevhubusername=<value>  (required) Username or alias of the Dev Hub org.
      --apiversion=<value>            Override the api version used for api requests made by this command
      --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
  Deletes the pooled scratch orgs from the Scratch Org Pool

ALIASES
  $ sfp pool delete

EXAMPLES
  $ sfp pool scratch delete -t core 

  $ sfp pool scratch delete -t core -v devhub

  $ sfp pool scratch delete --orphans -v devhub
```

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

## `sfp pool scratch fetch`

Gets an active/unused scratch org from the scratch org pool

```
USAGE
  $ sfp pool scratch fetch -v <value> -t <value> [--json] [-a <value>] [-s <value>] [-d] [--nosourcetracking]
    [--apiversion <value>] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -a, --alias=<value>                 Fetch and set an alias for the org
  -d, --setdefaultusername            set the authenticated org as the default username that all commands run against
  -s, --sendtouser=<value>            Send the credentials of the fetched scratchorg to another DevHub user, Useful for
                                      situations when pool is only limited to certain users
  -t, --tag=<value>                   (required) (required) tag used to identify the scratch org pool
  -v, --targetdevhubusername=<value>  (required) Username or alias of the Dev Hub org.
      --apiversion=<value>            Override the api version used for api requests made by this command
      --loglevel=<option>             [default: info] logging level for this command invocation
                                      <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --nosourcetracking              Do not set source tracking while fetching the scratch org

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Gets an active/unused scratch org from the scratch org pool

ALIASES
  $ sfp pool fetch

EXAMPLES
  $ sfp pool:scratch:fetch  -t core 

  $ sfp pool:scratch:fetch  -t core -v devhub

  $ sfp pool:scratch:fetch  -t core -v devhub -m

  $ sfp pool:scratch:fetch  -t core -v devhub -s testuser@test.com
```

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

## `sfp pool scratch init`

Prepare a pool of scratchorgs with all the packages upfront, so that any incoming change can be validated in an optimized manner

```
USAGE
  $ sfp pool scratch init -v <value> [--json] [-f <value>] [--npmrcpath <value>] [--keys <value>] [-g <value>...]
    [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -f, --poolconfig=<value>            [default: config/poolconfig.json] The path to the configuration file for creating
                                      a pool of scratch orgs
  -g, --logsgroupsymbol=<value>...    Symbol used by CICD platform to group/collapse logs in the console. Provide an
                                      opening group, and an optional closing group symbol.
  -v, --targetdevhubusername=<value>  (required) Username or alias of the Dev Hub org.
      --keys=<value>                  Keys to be used while installing any managed package dependencies. Required format
                                      is a string of key-value pairs separated by spaces e.g. packageA:pw123
                                      packageB:pw123 packageC:pw123
      --loglevel=<option>             [default: info] logging level for this command invocation
                                      <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --npmrcpath=<value>             Path to .npmrc file used for authentication to a npm registry when using npm based
                                      artifacts. If left blank, defaults to home directory

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Prepare a pool of scratchorgs with all the packages upfront, so that any incoming change can be validated in an
  optimized manner

ALIASES
  $ sfp prepare
  $ sfp pool prepare
  $ sfp pool scratch prepare

EXAMPLES
  $ sfp pool scratch init -f config/mypoolconfig.json  -v <devhub>
```

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

## `sfp pool scratch list`

Retrieves a list of active scratch org and details from any pool. If this command is run with -m|--mypool, the command will retrieve the passwords for the pool created by the user who is executing the command.

```
USAGE
  $ sfp pool scratch list -v <value> [--json] [--apiversion <value>] [-t <value>] [-m] [-a] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -a, --allscratchorgs                Gets all used and unused Scratch orgs from pool
  -m, --mypool                        Filter the tag for any additions created  by the executor of the command
  -t, --tag=<value>                   tag used to identify the scratch org pool
  -v, --targetdevhubusername=<value>  (required) Username or alias of the Dev Hub org.
      --apiversion=<value>            Override the api version used for api requests made by this command
      --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
  Retrieves a list of active scratch org and details from any pool. If this command is run with -m|--mypool, the command
  will retrieve the passwords for the pool created by the user who is executing the command.

ALIASES
  $ sfp pool list

EXAMPLES
  $ sfp pool:list -t core 

  $ sfp pool:list -t core -v devhub

  $ sfp pool:list -t core -v devhub -m

  $ sfp pool:list -t core -v devhub -m -a
```

*See code:* [*src/commands/pool/scratch/list.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-v50-and-below/advanced/pool.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.
