# Environment

Manage environments in sfp server

* [`sfp server environment create`](#sfp-server-environment-create)
* [`sfp server environment delete`](#sfp-server-environment-delete)
* [`sfp server environment get`](#sfp-server-environment-get)
* [`sfp server environment list`](#sfp-server-environment-list)
* [`sfp server environment lock`](#sfp-server-environment-lock)
* [`sfp server environment unlock`](#sfp-server-environment-unlock)

## `sfp server environment create`

Create a new environment in the server

```
USAGE
  $ sfp server environment create -r <value> -n <value> -c dev|test|snapshot|release -b <value> -d <value> [--json] [-e
    <value>] [-t <value>] [--sfp-server-url <value>] [-g <value>...] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] [-o <value>] [-t <value>] [--devhubusername
    <value>] [--inactive] [-m <value>]

FLAGS
  -b, --branch=<value>              (required) Git branch associated with this environment
  -c, --category=<option>           (required) Category of the environment
                                    <options: dev|test|snapshot|release>
  -d, --description=<value>         (required) Description of the environment
  -e, --email=<value>               [env: SFP_SERVER_USER] Email address for authenticated user. Ignored if
                                    --application-token is provided.
  -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.
  -m, --metadata=<value>            Additional metadata as JSON object
  -n, --name=<value>                (required) Name of the environment
  -o, --targetusername=<value>      Salesforce username for this environment (if not provided, will prompt for
                                    selection)
  -r, --repository=<value>          (required) Repository identifier (e.g., owner/repo)
  -t, --application-token=<value>   [env: SFP_SERVER_TOKEN] Application token for CI/CD authentication. Takes precedence
                                    over --email.
  -t, --tags=<value>                Comma-separated tags for the environment
      --devhubusername=<value>      Parent production org username for sandbox authentication (auto-detected for JIT
                                    sandboxes)
      --inactive                    Create the environment as inactive
      --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>      [env: SFP_SERVER_URL] URL of the SFP server. Can be set via environment variable
                                    `SFP_SERVER_URL` or config: sfp config:set server-url

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Create a new environment in the server

EXAMPLES
  $ sfp server environment create --repository myorg/myrepo --name UAT --category test --branch main --description "User Acceptance Testing Environment" --targetusername uat@mycompany.com

  $ sfp server environment create --repository myorg/myrepo --name Production --category release --branch main --description "Production Environment"  # Interactive username selection
```

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

## `sfp server environment delete`

Delete an environment from the server

```
USAGE
  $ sfp server environment delete -r <value> -n <value> [--json] [-e <value>] [-t <value>] [--sfp-server-url <value>] [-g
    <value>...] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] [-f]

FLAGS
  -e, --email=<value>               [env: SFP_SERVER_USER] Email address for authenticated user. Ignored if
                                    --application-token is provided.
  -f, --force                       Skip confirmation prompt
  -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.
  -n, --name=<value>                (required) Name of the environment to delete
  -r, --repository=<value>          (required) Repository identifier (e.g., owner/repo)
  -t, --application-token=<value>   [env: SFP_SERVER_TOKEN] Application token for CI/CD authentication. Takes precedence
                                    over --email.
      --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>      [env: SFP_SERVER_URL] URL of the SFP server. Can be set via environment variable
                                    `SFP_SERVER_URL` or config: sfp config:set server-url

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Delete an environment from the server

EXAMPLES
  $ sfp server environment delete --repository myorg/myrepo --name UAT

  $ sfp server environment delete --repository myorg/myrepo --name Production --force
```

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

## `sfp server environment get`

Get detailed information about a specific environment, optionally retrieving SFDX auth URL with a lock ticket

```
USAGE
  $ sfp server environment get -r <value> -n <value> [--json] [-e <value>] [-t <value>] [--sfp-server-url <value>] [-g
    <value>...] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] [--lock-ticket-id
    <value>] [-a] [--auth-type accessToken|sfdxAuthUrl]

FLAGS
  -a, --authenticate                Authenticate the org locally using the environment name as alias (requires
                                    lock-ticket-id)
  -e, --email=<value>               [env: SFP_SERVER_USER] Email address for authenticated user. Ignored if
                                    --application-token is provided.
  -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.
  -n, --name=<value>                (required) Name of the environment
  -r, --repository=<value>          (required) Repository identifier (e.g., owner/repo)
  -t, --application-token=<value>   [env: SFP_SERVER_TOKEN] Application token for CI/CD authentication. Takes precedence
                                    over --email.
      --auth-type=<option>          Type of authentication to include: "accessToken" (recommended, short-lived) or
                                    "sfdxAuthUrl" (long-lived refresh token for extended operations). Requires
                                    owner/application role.
                                    <options: accessToken|sfdxAuthUrl>
      --lock-ticket-id=<value>      Lock ticket ID to retrieve SFDX auth URL (from lock command)
      --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>      [env: SFP_SERVER_URL] URL of the SFP server. Can be set via environment variable
                                    `SFP_SERVER_URL` or config: sfp config:set server-url

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Get detailed information about a specific environment, optionally retrieving SFDX auth URL with a lock ticket

EXAMPLES
  $ sfp server environment get --name production --repository myorg/myrepo

  $ sfp server environment get --name uat --repository myorg/myrepo --lock-ticket-id ticket_123abc

  $ sfp server environment get --name dev --repository myorg/myrepo --lock-ticket-id ticket_456def --authenticate

  $ sfp server environment get --name staging --repository myorg/myrepo --auth-type accessToken

  $ sfp server environment get --name staging --repository myorg/myrepo --auth-type sfdxAuthUrl
```

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

## `sfp server environment list`

List environments from the SFP server with optional filtering for CI/CD matrix jobs

```
USAGE
  $ sfp server environment list [--json] [-r <value>] [-e <value>] [-t <value>] [--sfp-server-url <value>] [-g <value>...]
    [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] [-b <value>] [-c
    dev|test|snapshot|release] [--all] [-t <value>] [--metadata <value>] [-m]

FLAGS
  -b, --branch=<value>              Filter environments by git branch
  -c, --category=<option>           Filter environments by category
                                    <options: dev|test|snapshot|release>
  -e, --email=<value>               [env: SFP_SERVER_USER] Email address for authenticated user. Ignored if
                                    --application-token is provided.
  -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.
  -m, --matrix                      Output environment names only for CI/CD matrix jobs
  -r, --repository=<value>          Repository identifier (e.g., owner/repo)
  -t, --application-token=<value>   [env: SFP_SERVER_TOKEN] Application token for CI/CD authentication. Takes precedence
                                    over --email.
  -t, --tags=<value>                Filter environments by tags (comma-separated)
      --all                         Show all environments including inactive ones
      --loglevel=<option>           [default: info] logging level for this command invocation
                                    <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --metadata=<value>            Filter environments by metadata attributes (e.g., "test=true,env=staging")
      --sfp-server-url=<value>      [env: SFP_SERVER_URL] URL of the SFP server. Can be set via environment variable
                                    `SFP_SERVER_URL` or config: sfp config:set server-url

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  List environments from the SFP server with optional filtering for CI/CD matrix jobs

EXAMPLES
  $ sfp server environment list --repository myorg/myrepo

  $ sfp server environment list --repository myorg/myrepo --branch main --category release

  $ sfp server environment list --repository myorg/myrepo --branch main --category release --matrix  # For CI/CD

  $ sfp server environment list --repository myorg/myrepo --all  # Include inactive environments

  $ sfp server environment list --repository myorg/myrepo --tags critical,monitored

  $ sfp server environment list --repository myorg/myrepo --metadata "test=true"  # Filter by metadata attributes
```

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

## `sfp server environment lock`

Lock an environment for exclusive access with optional wait functionality

```
USAGE
  $ sfp server environment lock -r <value> -n <value> -d <value> [--json] [-e <value>] [-t <value>] [--sfp-server-url
    <value>] [-g <value>...] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] [-w]
    [--wait-timeout <value>] [--reason <value>] [--auth-type accessToken|sfdxAuthUrl]

FLAGS
  -d, --duration=<value>            (required) [default: 30] Lock duration in minutes
  -e, --email=<value>               [env: SFP_SERVER_USER] Email address for authenticated user. Ignored if
                                    --application-token is provided.
  -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.
  -n, --name=<value>                (required) Name of the environment to lock
  -r, --repository=<value>          (required) Repository identifier (e.g., owner/repo)
  -t, --application-token=<value>   [env: SFP_SERVER_TOKEN] Application token for CI/CD authentication. Takes precedence
                                    over --email.
  -w, --wait                        Wait indefinitely for lock to be acquired (blocks until lock is available)
      --auth-type=<option>          [default: accessToken] Type of authentication to return when lock is acquired:
                                    "accessToken" (recommended, short-lived) or "sfdxAuthUrl" (long-lived refresh token
                                    for extended operations)
                                    <options: accessToken|sfdxAuthUrl>
      --loglevel=<option>           [default: info] logging level for this command invocation
                                    <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --reason=<value>              Reason for locking the environment
      --sfp-server-url=<value>      [env: SFP_SERVER_URL] URL of the SFP server. Can be set via environment variable
                                    `SFP_SERVER_URL` or config: sfp config:set server-url
      --wait-timeout=<value>        [default: 5] Wait for lock with timeout in minutes (if provided without --wait flag)

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Lock an environment for exclusive access with optional wait functionality

EXAMPLES
  $ sfp server environment lock --name production --repository myorg/myrepo --duration 60

  $ sfp server environment lock --name uat --repository myorg/myrepo --duration 30 --wait

  $ sfp server environment lock --name dev --repository myorg/myrepo --duration 120 --wait --reason "Deployment in progress"

  $ sfp server environment lock --name dev --repository myorg/myrepo --duration 120 --wait --auth-type sfdxAuthUrl
```

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

## `sfp server environment unlock`

Unlock an environment using the ticket ID obtained from the lock command

```
USAGE
  $ sfp server environment unlock -r <value> -n <value> --ticket-id <value> [--json] [-e <value>] [-t <value>]
    [--sfp-server-url <value>] [-g <value>...] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -e, --email=<value>               [env: SFP_SERVER_USER] Email address for authenticated user. Ignored if
                                    --application-token is provided.
  -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.
  -n, --name=<value>                (required) Name of the environment to unlock
  -r, --repository=<value>          (required) Repository identifier (e.g., owner/repo)
  -t, --application-token=<value>   [env: SFP_SERVER_TOKEN] Application token for CI/CD authentication. Takes precedence
                                    over --email.
      --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>      [env: SFP_SERVER_URL] URL of the SFP server. Can be set via environment variable
                                    `SFP_SERVER_URL` or config: sfp config:set server-url
      --ticket-id=<value>           (required) Lock ticket ID obtained from the lock command

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Unlock an environment using the ticket ID obtained from the lock command

EXAMPLES
  $ sfp server environment unlock --name production --repository myorg/myrepo --ticket-id ticket_123abc

  $ sfp server environment unlock --name uat --repository myorg/myrepo --ticket-id ticket_456def
```

*See code:* [*src/commands/server/environment/unlock.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/cli-reference-v50-and-below/server/environment.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.
