OCP CLI command reference
This page lists every available Optimizely Connect Platform (OCP) command-line interface (CLI) command, with parameters, flags, and options. To install and configure the OCP CLI, see Configure your OCP development environment.
OCP CLI help command
Commands are grouped into namespaces.
$ ocp -h
Usage: ocp <command>
Namespaces: (`<namespace>` -h, --help for additional help)
accounts
app
availability
dev-server
directory
env
jobs
review
Commands:
autocomplete Display autocomplete installation instructions
dev Start the local development server for OCP apps
update Update the OCP CLIRun the help command, -h or --help, to list commands in a namespace. See the following example:
$ ocp app -h
Usage: ocp app <command>
Commands:
deploy Deploy the app to OCP
init Create a new app project
logs Fetch app logs
package Prepare a package for manual upload
prepare Validate, package, upload and build an app to prepare for publishing (deprecated: use ocp app deploy)
promote Promote a built preview version onto another track (reusing its image), or release it as a semver
register Register an app version
rollback Return a preview track to an earlier version
validate Validate an app locally
ocp <command> -h, --help for help on specific commandsAdding the help context on a command displays documentation for the command with all available options. See the following example:
$ ocp app deploy -h
Deploy the app to OCP
USAGE
$ ocp app deploy [--previewTrack <value>] [-f] [--noProgress]
[--rcDependencies] [--upgradeDeps] [--noPrompt] [--version <value>]
[--watch] [-p <value>]
FLAGS
-f, --force Force a brand-new version even if
identical source was already
deployed
-p, --path=<value> [default: ./] The root directory
of the app
--noProgress, --no-progress Don't display any progress
indicators
--noPrompt, --no-prompt Use default answer to any prompt
question (default is yes, except
for destructive operations)
--previewTrack=<value>, --preview-track Beta track to deploy to, e.g.
beta/qa (omit for your own
dev/<username>)
--rcDependencies, --rc-dependencies Build with the unstable (RC) OCP
dependency set
--upgradeDeps, --upgrade-deps Automatically update out-of-date
OCP dependencies
--version=<value> Release this semver instead of
deploying to a preview track,
e.g. 1.2.0
--watch With --version, keep waiting for
review approval and publish as
soon as it lands
DESCRIPTION
Deploy the app to OCPOCP CLI commands
The following table lists all available OCP CLI commands with their parameters and descriptions:
Command | Parameters | Description |
|---|---|---|
ocp -h | N/A | The help context for the OCP CLI is -h. It provides information about your environment when you run ocp -h and provides contextual help when you add -h after any command. |
ocp -v or ocp --version | N/A | Displays the installed OCP CLI version. |
ocp autocomplete | N/A | Displays shell autocompletion installation instructions. Supports Bash, Zsh, and PowerShell, with PowerShell 7+ for Windows. Run the command and follow the instructions provided in the terminal. |
ocp update | N/A | Updates the OCP CLI to the latest version. You can append --available to display the list of available versions. |
ocp accounts whoami | N/A | Returns your developer profile, the OCP and ODP accounts you can reach, and any CMS (SaaS) instances, grouped by organization. It also returns your personal and vendor apps. See additional flags and options. |
ocp accounts whois | <term> | Searches the accounts you can access in one availability zone. Returns the ID, tracker ID, name, and target product of each match. Requires a search term, for example, ocp accounts whois acme. See additional flags and options. |
ocp app init | <appId> | Creates a new app project and initializes the app. Requires the app ID, for example, ocp app init <appId>. Apps created with this command have no version in app.yml. The --version flag is deprecated and ignored, because ocp app deploy versions each deploy. |
ocp app logs | <appId> or <buildId> | Returns app logs. Requires the app ID or build ID, for example, ocp app logs <buildId>. See additional flags and options. |
ocp app getLogLevel or ocp app get-log-level | <appId@appVersion> | Returns the log level for the app version that you specify. Requires the app ID and version in the following format: <appId@appVersion>. See additional flags and options. |
ocp app setLogLevel or ocp app set-log-level | <appId@appVersion> <logLevel> | Sets the log level for the app version that you specify. Options are debug, info, warn, error, never. Requires the app ID and version in the following format: <appId@appVersion>. See additional flags and options. |
ocp app package | <path> | Prepares a package for manual upload. Requires the path for the root directory of the app, for example, ocp app package <path>. Requires a version in app.yml. |
ocp app prepare | <path> | Deprecated. Use ocp app deploy to deploy and ocp app promote --to <version> to release. Validates, packages, uploads, and builds the version that app.yml declares to prepare for publishing. Fails when app.yml has no version. Requires the path for the root directory of the app, for example, ocp app prepare <path>. See additional flags and options. |
ocp app register | <id> <name> | Registers an app version. Requires the app ID and name, for example, ocp app register <id> <name>. You can append --availability or --a to define the availability region to which the app is registered (default is US). |
ocp app validate | <path> | Validates an app locally. Works with or without a version in app.yml, and suggests ocp app deploy afterward. Requires the path for the root directory of the app, for example, ocp app validate <path>. See additional flags and options. |
ocp app abandon | <appId@appVersion> | Ceases the processing of the specified app version that you have not published yet. You can append --noPrompt or --no-prompt to use the default answer (yes) to any prompt question, except for destructive operations. For example, ocp app abandon <appId@appVersion>. |
ocp app deploy | N/A | Builds and publishes an app version to a preview track in one step. Defaults to your own dev/USERNAME track and derives the version from the content of the app. Run it from the app directory, for example, ocp app deploy or ocp app deploy --preview-track beta/feature-x. To release a semantic version (semver) instead, which builds the release version, starts a review, and publishes when approved, append --version, for example, ocp app deploy --version 1.2.0. Requires runtime: node22 or later in app.yml, and ignores any version in app.yml. See additional flags and options. |
ocp app deploy list | N/A | Lists an app's versions grouped by preview track, with semver releases in their own group. Append --appId or --app-id to name the app instead of reading app.yml, and --previewTrack or --preview-track to show one track. |
ocp app promote | N/A | Promotes a preview version onto another preview track without building it again. Also releases a preview version as a semver version, which rebuilds it with the release dependencies, starts a review, and publishes when approved. To release your working directory instead, use ocp app deploy --version. Requires --from and --to, for example, ocp app promote --from dev/jdoe --to beta/release-1.2. See additional flags and options. |
ocp app rollback | N/A | Returns a preview track to an earlier version and moves the installations that follow the track onto it. Defaults to your own dev/USERNAME track and to the version the track ran before its current one, for example, ocp app rollback. To roll back a shared track, append --preview-track with a beta/ track, for example, ocp app rollback --preview-track beta/qa. See additional flags and options. |
ocp app rollback list | N/A | Lists a preview track's versions newest-first, marks the current one, and shows which versions are still rollback targets. Defaults to your own dev/USERNAME track. Append --previewTrack or --preview-track to list another track, including another developer's dev/ track, and --appId or --app-id to name the app. |
ocp availability list | N/A | Lists all availability regions (US, EU, AU). |
ocp dev | N/A | Starts the local development server for OCP apps. This is a quick-start command. For more configuration options, use ocp dev-server start. |
ocp dev-server start | N/A | Starts the local development server with configuration options. Optionally specify the path to the OCP app root directory. See additional flags and options. |
ocp directory unpublish | <appId@appVersion> | Unpublishes an app version. The CLI refuses to unpublish a version while any installation is still on it. Requires the app ID and version in the following format: <appId@appVersion>. For example, ocp directory unpublish <appId@appVersion>. See additional flags and options. |
ocp directory publish | <appId@appVersion> | Publishes (makes available) a specific app version that has been reviewed and approved. Requires the app ID and version in the following format: <appId@appVersion>. For example, ocp directory publish <appId@appVersion>. Also republishes a release that you unpublished within the last seven days, after a confirmation. See Roll back a release. You can append --noProgress or --no-progress. |
ocp directory info | <appId> | Gets information about an app. Requires the app ID, for example, ocp directory info <appId>. You can append --availability or --a to define the availability region of the app (default is US). |
ocp directory install | <appId@appVersion> [<trackerId>] | Installs a specific app version into an account. Requires the app ID and version (in the following format: <appId@appVersion>), and the tracker ID of the account to which you want to install the app. For example, ocp directory install <appId@appVersion> <trackerId>. For CMS UI extension apps, use --scope INSTANCE_ID instead of the tracker ID to specify the CMS instance. If you are not provided with a scope, select it interactively. You can append --availability or --a to define the availability region of the app (default is US). To follow a preview track instead of pinning a version, pass the app ID without a version, for example, ocp directory install my_app TRACKER_ID. Without --previewTrack or --preview-track, the installation follows your own dev/USERNAME track. To follow a shared track, append the flag, for example, ocp directory install my_app --preview-track beta/qa TRACKER_ID. |
ocp directory list | <appId> | Lists registered app versions. Lists all apps by default if you do not define the app ID, for example, ocp directory list <appId>. See additional flags and options. |
ocp directory listFunctions or ocp directory list-functions | <appId> [<trackerId>] | Lists the functions exposed by an app installation. Requires the app ID and tracker ID, for example, ocp directory listFunctions <appId> <trackerId>. For CMS UI extension apps, use --scope INSTANCE_ID instead of the tracker ID to specify the CMS instance. If you are not provided with a scope, select it interactively. You can append --availability or --a to define the availability region of the app (default is US). |
ocp directory listGlobalFunctions or ocp directory list-global-functions | <appId> | Lists the global functions exposed by an app. Requires the app ID, for example, ocp directory listGlobalFunctions <appId>. You can append --availability or --a to define the availability region of the app (default is US). |
ocp directory listInstalls or ocp directory list-installs | <appId@appVersion> | Lists installations of a specific app version. Requires the app ID and version (in the following format: <appId@appVersion>). For example, ocp directory listInstalls <appId@appVersion>. You can append --availability or --a to define the availability region of the app (default is US). |
ocp directory status | <appId@appVersion> | Gets the status of a particular app ID and version. Requires the app ID and version (in the following format: <appId@appVersion>). For example, ocp directory status <appId@appVersion>. You can append --availability or --a to define the availability region of the app (default is US). |
ocp directory uninstall | <appId> [<trackerId>] | Uninstalls an app from an account. Requires the app ID and tracker ID, for example, ocp directory uninstall <appId> <trackerId>. For CMS UI extension apps, use --scope INSTANCE_ID instead of the tracker ID to specify the CMS instance. If you are not provided with a scope, select it interactively. You can append --availability or --a to define the availability region of the app (default is US). |
ocp directory upgrade | <appId> [<trackerId>] | Upgrades the install to a specific app version. Requires the app ID and tracker ID, for example, ocp directory upgrade <appId> <trackerId>. Use --allFromVersion instead of a tracker ID to move every installation on a version that you can access, for example, ocp directory upgrade <appId> --allFromVersion 1.3.0 -v 1.2.0. For CMS UI extension apps, use --scope INSTANCE_ID instead of the tracker ID to specify the CMS instance. If you are not provided with a scope, select it interactively. See additional flags and options. |
ocp env get | N/A | Gets the current environment of the OCP CLI. |
ocp env set | <env> | Sets the current environment for the OCP CLI. Requires the environment name. |
ocp jobs list | <appId> | Lists jobs. Requires the app ID for which you want to view jobs, for example, ocp jobs list <appId>. See additional flags and options. |
ocp jobs terminate | <jobId> | Terminates a job. Requires the ID of the job to terminate. You can append --availability or --a to define the availability region (default is US). |
ocp jobs trigger | <appId@appVersion> <jobName> [<trackerId>] | Triggers a job. Requires the app ID and version (in the following format: <appId@appVersion>), job name, and tracker ID of the account for which you want to trigger the job. For example, ocp jobs trigger <appVersion> <jobName> <trackerId>. For CMS UI extension apps, use --scope INSTANCE_ID instead of the tracker ID to specify the CMS instance. If you are not provided with a scope, select it interactively. See additional flags and options. |
ocp review list | <appId> | Lists app versions currently under review. You can optionally define the app ID of the app for which you want to view versions under review (for example, ocp review list <appId>. Lists all apps by default. |
ocp review open | <appId@appVersion> | Opens a review in your browser. Requires the app ID and version (in the following format: <appId@appVersion>). For example, ocp review open <appId@appVersion> |
Additional flags and options for OCP CLI commands
You can append various flags and options for some of the OCP CLI commands.
For commands that accept --scope, the CLI prompts you to select a CMS instance if you omit the flag. To trigger the prompt explicitly, pass --scope= with an empty value. The --scope flag applies to CMS UI extension apps only.
ocp accounts whoami
- --json – Outputs your raw profile and account access as JSON, and writes warnings to stderr so that stdout contains only JSON.
- --noProgress or --no-progress – Do not display any progress indicators.
ocp accounts whois
- --availability or -a – The availability region that is targeted (default is US).
ocp app logs
- --tail – Tails the logs.
- --appId
- --buildId
- --appVersion
- --trackerId
- --scope or -s – Specific CMS instance ID to filter by.
- --jobId
- --installId
- --from – A start time as an ISO string, an epoch timestamp, or relative string (for example, 5m for 5 minutes). Default is 24h.
- --to – An end time as an ISO string, an epoch timestamp, or relative string (for example, 5m for 5 minutes).
- --search – String to search for in log messages. Can be specified multiple times.
- --availability or -a – The availability region that is targeted (default is US).
ocp app getLogLevelorocp app get-log-level
- --trackerId – Specific Tracker ID to filter by.
- --scope or -s – CMS instance ID of the installation to target.
- --availability – The availability region that is targeted (default is US).
ocp app setLogLevelorocp app set-log-level
- --trackerId – Specific Tracker ID to filter by.
- --scope or -s – CMS instance ID of the installation to target.
- --timeToLive – Expiration period for the log level as a relative string (for example, 5m for 5 minutes). Default is 2 hours (2h).
- --availability – The availability region that is targeted (default is US).
ocp app prepare (deprecated)
ocp app prepare still works, but prints a deprecation warning. Use ocp app deploy and ocp app promote --to <version> instead. Apps on a runtime earlier than node22 keep using ocp app prepare until they migrate.
- --noProgress or --no-progress – Do not display any progress indicators.
- --upgradeDeps or --upgrade-deps – Automatically update dependencies.
- --publish – Automatically publish if the upload is successful.
- --usePreviousAppEnvValues or --use-previous-app-env-values – Use app env values (.env file) from the previous version of the app. Any values in the local .env is ignored.
- --bumpDevVersion or --bump-dev-version – Bump dev version before building. Lets you test dev versions. Deprecated together with the -dev version scheme. Deploy to a preview track instead.
ocp app deploy
- --previewTrack or --preview-track – Preview track to deploy to. Defaults to dev/USERNAME.
- --version – Release this semver version instead of deploying to a preview track, such as 1.2.0. Builds the release version from your working directory, starts a review, and publishes when approved. Cannot be combined with --previewTrack, --force, or --rcDependencies.
- --watch – With --version, keep waiting for review approval and publish when it arrives.
- --force or -f – Build a version even when identical source is already deployed.
- --rcDependencies or --rc-dependencies – Build with the unstable release candidate (RC) OCP dependency set.
- --upgradeDeps or --upgrade-deps – Automatically update out-of-date OCP dependencies.
- --noPrompt or --no-prompt – Use the default answer for any prompt.
- --noProgress or --no-progress – Do not display any progress indicators.
- --path or -p – The root directory of the app.
ocp app promote
- --from – Source track, whose current version is promoted, or an explicit version such as dev/jdoe/abc1234. Required.
- --to – Target beta/ preview track, such as beta/release-1.2, or semver release, such as 1.2.0. A semver target rebuilds the version with the release dependencies and starts a review. Required.
- --watch – For a semver release, keep waiting for review approval and publish when it arrives.
- --appId or --app-id – App ID to promote. Defaults to the app.yml in the current directory.
- --noProgress or --no-progress – Do not display any progress indicators.
- --path or -p – The root directory of the app.
ocp app rollback
- --previewTrack or --preview-track – beta/ track to roll back, such as beta/qa. Omit the flag to roll back your own dev/USERNAME track. Does not accept dev/ tracks.
- --to – Hash to roll back to, such as abc1234. Defaults to the version the track ran before its current one.
- --appId or --app-id – App ID to roll back. Defaults to the app.yml in the current directory.
- --noProgress or --no-progress – Do not display any progress indicators.
- --path or -p – The root directory of the app.
ocp app validate
- --noProgress or --no-progress – Do not display any progress indicators.
- --upgradeDeps or --upgrade-deps – Automatically update dependencies.
ocp dev-server start
- --port or -p – Port to run the server on (default: 3000).
- --verbose or -v – Enable verbose logging.
- --noOpen or --no-open – Do not automatically open the browser.
- --config or -c – Path to custom configuration file.
- --path – Path to the OCP app root directory.
ocp directory unpublish
- --force or -f
- --noProgress or --no-progress
- --availability or -a – The availability region that is targeted (default is US).
ocp directory publish
- --noProgress or --no-progress
- --noPrompt or --no-prompt – Uses the default answer for prompts, which republishes a release unpublished within the last seven days.
ocp directory list
- --allStatuses – Includes all statuses. The stopped status is not included by default.
- --availability or -a – The availability region that is targeted (default is US).
ocp directory install
- --scope or -s – CMS instance ID of the installation to target.
- --availability or -a – The availability region that is targeted (default is US).
ocp directory listFunctions
- --scope or -s – CMS instance ID of the installation to target.
- --availability or -a – The availability region that is targeted (default is US).
ocp directory uninstall
- --scope or -s – CMS instance ID of the installation to target.
- --availability or -a – The availability region that is targeted (default is US).
ocp directory upgrade
- --scope or -s – CMS instance ID of the installation to target.
- --toVersion or -v – The desired version (for example, 1.0.0).
- --allFromVersion or --all-from-version – Moves every installation on this version that you can access to the --toVersion version, in every availability region the target version is published to. It moves them one at a time and stops at the first failure. Both versions must have the same MAJOR version. Do not pass a tracker ID.
- --noPrompt or --no-prompt – Uses the default answer for prompts (yes), so --allFromVersion runs without confirmation.
- --availability or -a – The availability region that is targeted (default is US; with --allFromVersion, every region the app is available in).
ocp jobs list
- --version – Specific versions to filter by.
- --trackerId – Specific Tracker IDs to filter by.
- --scope or -s – Specific CMS instance ID to filter by.
- --function – Specific job function to filter by.
- --status – Specific job status to filter by. Possible values include the following: PENDING, SCHEDULED, RUNNING, COMPLETE, ERROR, TERMINATED.
- --minDuration – Display jobs that were running longer than the given duration (for example, 5m = 5 minutes).
- --sortBy – Column to sort the jobs by. Possible values include the following: id, function, trackerId, status, error, createdAt, triggeredAt, scheduledAt, terminatedAt, updatedAt, duration. The default column to sort by is updatedAt.
- --sortDirection – Sort resulting jobs in ascending or descending order. Possible values include the following: asc or desc. The default sort direction is asc.
- --limit – Number of jobs to list. The default is 50.
- --columns – Columns to display. Possible values include the following: id, version, function, trackerId, trigger, status, error, createdAt, triggeredAt, scheduledAt, terminatedAt, updatedAt, duration. The default columns are id, version, function, trackerId, status, updatedAt.
- --from – A start time as an ISO string, an epoch timestamp, or relative string (for example, 5m = 5 minutes). The default time value is 24h.
- --to – An end time as an ISO string, an epoch timestamp, or relative string (for example, 5m = 5 minutes).
- --availability or -a – The availability region that is targeted (default is US).
ocp jobs trigger
- --scope or -s – CMS instance ID of the installation to target.
- --parameters – Parameters to pass to the job.
- --availability or -a – The availability region that is targeted (default is US).