In GitHub Packages, one version of your public npm package is compromised; what can you delete, what can block you, and how long can you restore it?
answer
- per-version, not only per-package
- a download threshold on public versions
- who holds the delete right
- a thirty-day undo with a namespace condition
basics
~20 sA package admin can delete that single version unless it is public with more than 5,000 downloads, which needs GitHub Support. A deleted version or package can be restored within 30 days if its namespace and version have not been reused.
solid answer
~50 sGitHub Packages lets you delete a **single version** or the **whole package**. For a granular registry such as npm, you need the **Admin** role on the package (for a repository-scoped package, admin on the repository). The block is the **download threshold**: a public version with **more than 5,000 downloads** cannot be deleted by its owner, and a whole public package cannot be deleted if any version passed it — you contact GitHub Support instead. You delete from *View and manage all versions* in the UI or through the REST API with a personal access token (classic) carrying `read:packages` and `delete:packages`. A deleted package or version is **restorable for 30 days**, provided the same namespace and version have not been reused by a new package. Deleting also breaks anyone pinned to that version, so it is one step of the response, not the whole of it.
go deeper
Know that versions can be deleted individually and restored within 30 days.
Explain the 5,000-download limit on public versions, the Admin role needed on a granular package, and the scopes a classic token needs to delete and to restore.
Run it as an incident: fixed version first, delete fast before the threshold, notify consumers, rotate leaked secrets, and never reuse the version number.
Set a policy for public packages so that deletion is rarely the only lever: review before publishing, fast incident ownership, and clear rules on version numbering.
## What GitHub Packages lets you delete GitHub Packages distinguishes deleting a **version** from deleting the **entire package**, and private from public packages. | Target | Private package | Public package | |---|---|---| | One version | Allowed with the required access | Allowed only if that version has not more than 5,000 downloads | | Whole package | Allowed with the required access | Allowed only if no version has more than 5,000 downloads | When a public version is over the threshold, the owner cannot delete it and the documented route is to contact **GitHub Support**. The documentation also warns that deleting public packages may break projects that depend on them. For a compromised version, deleting just that version is usually the right scope: it removes the bad artifact while leaving good versions installable. ## Who may delete, and with what credential The required permission depends on the registry's permission model: - **Granular registries** (Container, npm, NuGet, RubyGems) — you need the **Admin** role on the package itself. If the package inherits access from a linked repository, repository admins hold it. - **Repository-scoped registries** (Apache Maven, Gradle) — you need admin permissions on the repository the package was published to. The credential follows the same pattern as the rest of GitHub Packages: 1. In the web UI, open the package, choose **View and manage all versions**, and delete the version; the confirmation asks you to type the package name. 2. Through the REST API, a personal access token (classic) needs `read:packages` and `delete:packages`. For repository-scoped packages the token also needs `repo`. 3. From a GitHub Actions workflow, `GITHUB_TOKEN` can delete or restore versions in granular registries through the REST API if the workflow's repository has **Admin** on the package; that capability is documented as being in public preview as of October 2026. The REST reference adds one more condition for the organization endpoint: the authenticated user must have admin permissions in the organization and, for a registry with granular permissions, admin on the package as well. A version deleted that way returns the same 5,000-download refusal for popular public versions. The GraphQL `deletePackageVersion` mutation does **not** work with registries that support granular permissions, so it is no route for an npm package. ## Restoring: the 30-day window Deletion is not immediately final. You can restore an entire package or a single version when both conditions hold: 1. the restore happens **within 30 days** of deletion; and 2. the **same package namespace and version** are still available — not reused by a new package. If a new package now occupies the namespace, you must delete that package before the old one can be restored. Deleted versions are listed by switching the versions view to **Deleted**; deleted whole packages appear under *Deleted Packages* in the organization's or account's package settings. Through the REST API, restoring needs a token with `read:packages` and `write:packages`. Who can restore mirrors who can delete: admin on the repository for repository-scoped packages, ownership for packages scoped to a personal account, and admin on the deleted package for organization-scoped ones. ## Handling a compromised version end to end Deleting the version is one step of an incident, and the order matters: 1. **Publish a fixed version** with a new version number, so consumers have something to move to. Reusing the compromised version number would also block any later restore, since restore requires the namespace and version to be unused. 2. **Delete the compromised version** if its downloads allow; otherwise open a Support request immediately. 3. **Tell consumers** through the repository's security advisory process, which the material on supply-chain security covers. 4. **Rotate anything the compromised version could have exposed**, because anyone who already downloaded it keeps their copy; deletion only stops new downloads from GitHub Packages. ## Pitfalls - Assuming deletion recalls copies already installed or cached elsewhere. - Waiting days to act on a popular public version, by which time it is past 5,000 downloads. - Using a token with only `delete:packages`: the API also needs `read:packages`. - Republishing the same version number, then discovering the original cannot be restored.
- In GitHub Packages, why can't you restore a deleted version after republishing the same version number?Restoring requires that the same package namespace and version are still available and not reused by a new package. Republishing that version number occupies it, so the old version cannot come back unless you delete the new one first.
- In GitHub Packages, how can a GitHub Actions workflow delete versions of a granular package without a personal token?Use `GITHUB_TOKEN` with the REST API, provided the workflow's repository has the Admin role on the package. A repository whose workflow published the package gets Admin by default; otherwise a package admin grants it. This workflow path is documented as public preview as of October 2026.
- In GitHub Packages, does deleting the compromised version protect consumers who already installed it?No. Deletion stops further downloads from GitHub Packages, but installed copies and caches keep the bad artifact. Consumers must move to a fixed version, and anything the compromised version exposed, such as credentials, must be rotated.
- A package owner can always delete any public version, however popular.
- Deleting a version is permanent the moment you confirm it.
- Deleting the version removes it from every machine that already installed it.
- A token with only delete:packages is enough for the REST delete call.
- The GraphQL deletePackageVersion mutation works for npm and container packages.
- Republishing the same version number is the clean way to replace a bad build.