HomeGuidesAPI Reference
Submit Documentation FeedbackJoin Developer CommunityOptimizely GitHubOptimizely NuGetLog In

OCP CLI commands

This is a reference for all the commands in the OCP CLI.

The table below lists all available OCP CLI commands with their parameters and descriptions.

CommandParametersDescription
opti -hThe help context for the OCP CLI is -h. It provides information about your environment when you run opti -h and provides contextual help when you add -h after any command.
opti accounts whoamiReturns your account information.
opti accounts whois<user>Returns basic account information for a specific user. Requires a user input, for example, opti accounts whois "user".
opti app init<appId>Creates a new app project and initializes the app. Requires the app ID, for example, opti app init <appId>.
opti app logs<appId> or <buildId>Returns app logs. Requires the app ID or build ID, for example, opti app logs <buildId>. See additional flags/options.
opti app package<path>Prepares a package for manual upload. Requires the path for the root directory of the app, for example, opti app package <path>.
opti app prepare<path>Validates, packages, uploads, and builds an app to prepare for publishing. Requires the path for the root directory of the app, for example, opti app prepare <path>. See additional flags/options.
opti app register<id> <name>Registers an app version. Requires the app ID and name, for example, opti app register <id> <name>. You can append --availability or --a to define the availability region to which the app is registered (default is US).
opti app validate<path>Validates an app locally. Requires the path for the root directory of the app, for example, opti app validate <path>. See additional flags/options.
opti availability listLists all availability regions (US, EU, AU).
opti directory unpublish<[email protected]>Unpublishes an app version (uninstalls everywhere and undeploys). Requires the app ID and version in the following format: <[email protected]>. For example, opti directory unpublish <[email protected]>. See additional flags/options.
opti directory publish<[email protected]>Publishes (makes available) a specific app version that has been reviewed and approved. Requires the app ID and version in the following format: <[email protected]>. For example, opti directory publish <[email protected]>. You can append --noProgress or --no-progress. COMPLETE THIS LATER
opti directory info<appId>Gets information about an app. Requires the app ID, for example, opti directory info <appId>. You can append --availability or --a to define the availability region of the app (default is US).
opti directory install<[email protected]> <trackerId>Installs a specific app version into an account. Requires the app ID and version (in the following format: <[email protected]>), and the tracker ID of the account to which you want to install the app. For example, opti directory install <[email protected]> <trackerId>. You can append --availability or --a to define the availability region of the app (default is US).
opti directory list<appId>Lists registered app versions. Lists all apps by default if you do not define the app ID, for example, opti directory list <appId>. See additional flags/options.
opti directory listFunctions or opti directory list-functions<appId> <trackerId>Lists the functions exposed by an app installation. Requires the app ID and tracker ID, for example, opti directory listFunctions <appId> <trackerId>. You can append --availability or --a to define the availability region of the app (default is US).
opti directory listGlobalFunctions or opti directory list-global-functions<appId>Lists the global functions exposed by an app. Requires the app ID, for example, opti directory listGlobalFunctions <appId>. You can append --availability or --a to define the availability region of the app (default is US).
opti directory listInstalls or opti directory list-installs<[email protected]>Lists installations of a specific app version. Requires the app ID and version (in the following format: <[email protected]>). For example, opti directory listInstalls <[email protected]>. You can append --availability or --a to define the availability region of the app (default is US).
opti directory status<[email protected]>Gets the status of a particular app ID and version. Requires the app ID and version (in the following format: <[email protected]>). For example, opti directory status <[email protected]>. You can append --availability or --a to define the availability region of the app (default is US).
opti directory uninstall<appId> <trackerId>Uninstalls an app from an account. Requires the app ID and tracker ID, for example, opti directory uninstall <appId> <trackerId>. You can append --availability or --a to define the availability region of the app (default is US).
opti directory upgrade<appId <trackerId>Upgrades the install to a specific app version. Requires the app ID and tracker ID, for example, opti directory upgrade <appId> <trackerId>. See additional flags/options.
opti env getGets the current environment of the OCP CLI.
opti env set<env>Sets the current environment for the OCP CLI. Requires the environment name.
opti jobs list<appId>Lists jobs. Requires the app ID for which you want to view jobs, for example, opti jobs list <appId>. See additional flags/options.
opti 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).
opti jobs trigger<[email protected]> <jobName> <trackerId>Triggers a job. Requires the app ID and version (in the following format: <[email protected]>), job name, and tracker ID of the account for which you want to trigger the job. For example, opti jobs trigger <appVersion> <jobName> <trackerId>. See additional flags/options.
opti 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, opti review list <appId>. Lists all apps by default.
opti review open<[email protected]>Opens a review in your browser. Requires the app ID and version (in the following format: <[email protected]>). For example, opti review open <[email protected]>.

Additional flags/options for OCP CLI commands

You can append various flags/options for some of the OCP CLI commands, listed below.

opti app logs

  • --tail – Tails the logs.
  • --appId
  • --buildId
  • --appVersion
  • --trackerId
  • --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 will be targeted (default is US).

opti app prepare

  • --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 file will be ignored.
  • --bumpDevVersion or --bump-dev-version – Bump dev version before building. Allows you to quickly test dev versions.

opti app validate

  • --noProgress or --no-progress – Do not display any progress indicators.
  • --upgradeDeps or --upgrade-deps – Automatically update dependencies.

opti directory unpublish

  • --force or -f
  • --noProgress or --no-progress
  • --availability or -a – The availability region that will be targeted (default is US).

opti directory list

  • --allStatuses – Includes all statuses. The stopped status is not included by default.
  • --availability or -a – The availability region that will be targeted (default is US).

opti directory upgrade

  • --toVersion or -v – The desired version (for example, 1.0.0).
  • --availability or -a – The availability region that will be targeted (default is US).

opti jobs list

  • --version – Specific versions to filter by.
  • --trackerId – Specific Tracker IDs to filter by.
  • --function – Specific job function to filter by.
  • --status – Specific job status to filter by. Possible values: PENDING, SCHEDULED, RUNNING, COMPLETE, ERROR, TERMINATED.
  • --minDuration – Show jobs that have been running longer than the given duration (for example, 5m = 5 minutes).
  • --sortBy – Column to sort the jobs by. Possible values: 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: 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: 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 will be targeted (default is US).

opti jobs trigger

  • --parameters – Parameters to pass to the job.
  • --availability or -a – The availability region that will be targeted (default is US).