# package version delete

Delete a package version.

## Description for package version delete

Specify the ID or alias of the package version you want to delete. In second-generation managed packaging, only beta package versions can be deleted. Before deleting a package version, review the considerations outlined in <https://developer.salesforce.com/docs/atlas.en-us.pkg2_dev.meta/pkg2_dev/sfdx_dev_dev2gp_package_deletion.htm>.

## Aliases for package version delete

`force:package:version:delete`

## Flags

| Flag Name (Long)   | Flag Name (Short) | Description                                                                                                                                              |
| ------------------ | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--api-version`    | N/A               | **Type:** Value<br><br>Override the api version used for api requests made by this command                                                               |
| `--flags-dir`      | N/A               | **Type:** Value<br><br>Import flag values from a directory.                                                                                              |
| `--json`           | N/A               | **Type:** Boolean<br><br>Format output as json.                                                                                                          |
| `--no-prompt`      | `-n`              | **Type:** Boolean<br><br>Don’t prompt before deleting the package version.                                                                               |
| `--package`        | `-p`              | **Type:** Value<br>**Required**<br><br>ID (starts with 04t) or alias of the package version to delete.                                                   |
| `--target-dev-hub` | `-v`              | **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. |

## Examples for package version delete

Delete a package version with the specified alias using your default Dev Hub org:

```shell
sf package version delete --package "Your Package Alias"
```

Delete a package version with the specified ID using the Dev Hub org with username "<devhub@example.com>":

```shell
sf package version delete --package 04t... --target-org devhub@example.com
```
