Delete a single package version
Delete one version of a package, leaving the rest of the package and its other versions intact.
Warning: destructive, single-version blast radius
Section titled “Warning: destructive, single-version blast radius”This is restorable only within GitHub’s roughly 30-day retention window, and only if nothing has since been republished under the same version — a republish in that window permanently forecloses the restore option for what you deleted. Past 30 days, or past a republish, there is no recovery path at all.
If you mean to remove the entire package (all versions), use delete-package instead.
Verify before acting
Section titled “Verify before acting”- Confirm you have the right version: run
get-package-version first and check the
nameandcreatedAtmatch the version you intend to remove. - If you’re not fully sure which numeric
versionIdcorresponds to which published version, run list-package-versions and cross-reference before proceeding —versionIdis an opaque internal id, not the semver/tag string.
-
Call the tool, passing the version id twice — once as
versionId, once asconfirmVersionId. Both must match exactly, or the tool refuses the call with aconfirmation_mismatcherror before making any API request:delete_package_version {org: "your-org",packageType: "npm",packageName: "your-package",versionId: 123456,confirmVersionId: 123456} -
On success you get back
{ org, packageType, packageName, versionId }. There is no dry-run mode — a successful call has already deleted the version.
If you need it back
Section titled “If you need it back”Within the ~30-day window, and only if nothing has republished under the
same version in the meantime, call
restore-package-version with the same
org, packageType, packageName, and versionId.