---
schema_version: "1"
id: 1577e6a91dd0f5dea9de7385ed31b9eed5fe97b01a2673ad67d6659896a3ecc4
title: package convert
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforcedx/sfclireference/guides/package/cli_reference_package_convert.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_package_convert.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 1fc56bf15d325d389e339b43697d8fdea5a33f96d903f1a4ead996e6c321337e
products:
  - Salesforce CLI Command Reference
  - salesforcedx
---
<!-- prettier-ignore-start -->

# package convert

Convert a managed-released first-generation managed package into a second-generation managed package.

## Description for package convert

The package conversion command automatically selects the latest released major.minor first-generation managed package version, and converts it into a second-generation managed package version.

Use --patch-version to specify a released patch version.

To retrieve details about a package version create request, including status and package version ID (04t), run "sf package version create report -i 08c...".

To protect the contents of your package and to prevent unauthorized installation of your package, specify the --installation-key flag.

To promote a package version to released, you must use the --code-coverage parameter. The package must also meet the code coverage requirements.

To list package version creation requests in the org, run "sf package version create list".

## Aliases for package convert

`force:package:convert`

## Flags

| Flag Name (Long) | Flag Name (Short) | Description |
|------------------|-------------------|-------------|
| <code>&#8209;&#8209;api&#8209;version</code> | N/A | **Type:** Value<br><br>Override the api version used for api requests made by this command |
| <code>&#8209;&#8209;code&#8209;coverage</code> | <code>&#8209;c</code> | **Type:** Boolean<br><br>Calculate and store the code coverage percentage by running the packaged Apex tests included in this package version.<br><br>Before you can promote and release a managed package version, the Apex code must meet a minimum 75% code coverage requirement. |
| <code>&#8209;&#8209;definition&#8209;file</code> | <code>&#8209;f</code> | **Type:** Value<br><br>Path to a definition file that contains features and org preferences that the metadata of the package version depends on.<br><br>This definition file is similar to the scratch org definition file. |
| <code>&#8209;&#8209;flags&#8209;dir</code> | N/A | **Type:** Value<br><br>Import flag values from a directory. |
| <code>&#8209;&#8209;installation&#8209;key</code> | <code>&#8209;k</code> | **Type:** Value<br><br>Installation key for key-protected package.<br><br>Either an --installation-key value or the --installation-key-bypass flag is required. |
| <code>&#8209;&#8209;installation&#8209;key&#8209;bypass</code> | <code>&#8209;x</code> | **Type:** Boolean<br><br>Bypass the installation key requirement.<br><br>If you bypass this requirement, anyone can install your package. Either an --installation-key value or the --installation-key-bypass flag is required. |
| <code>&#8209;&#8209;json</code> | N/A | **Type:** Boolean<br><br>Format output as json. |
| <code>&#8209;&#8209;package</code> | <code>&#8209;p</code> | **Type:** Value<br>**Required**<br><br>ID (starts with 033) of the first-generation managed package to convert. |
| <code>&#8209;&#8209;patch&#8209;version</code> | <code>&#8209;a</code> | **Type:** Value<br><br>Specific released patch version to be converted.<br><br>Specify a released patch version as major.minor.patch to convert to a second-generation managed package version. |
| <code>&#8209;&#8209;seed&#8209;metadata</code> | <code>&#8209;m</code> | **Type:** Value<br><br>Directory containing metadata to be deployed prior to conversion.<br><br>The directory containing metadata that will be deployed on the build org prior to attempting package conversion. |
| <code>&#8209;&#8209;target&#8209;dev&#8209;hub</code> | <code>&#8209;v</code> | **Type:** Value<br>**Required**<br><br>Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set. |
| <code>&#8209;&#8209;verbose</code> | N/A | **Type:** Boolean<br><br>Display verbose command output. |
| <code>&#8209;&#8209;wait</code> | <code>&#8209;w</code> | **Type:** Value<br>**Default value:** `0 minutes`<br><br>Minutes to wait for the package version to be created. |

## Examples for package convert

Create a second-generation managed package version from the first-generation managed package with the specified ID and give it the installation key "password123"; uses your default Dev Hub org:

```shell
sf package convert --package 033... --installation-key password123
```

Similar to previous example, but uses the specified Dev Hub org:

```shell
sf package convert --package 033... --installation-key password123 --target-dev-hub devhuborg@example.com
```
<!-- prettier-ignore-end -->
