Delete a package for the authenticated user

Deletes a package owned by the authenticated user. You cannot delete a public package if any version of the package has more than 25 downloads. In this scenario, contact GitHub support for further assistance.

To use this endpoint, you must authenticate using an access token with the packages:read and packages:delete scope. If package_type is not container, your token must also include the repo scope.

octokit.packages.deletePackageForAuthenticatedUser({
package_type,
package_name,
});

Parameters

namerequireddescription
package_typeyes

The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. For Docker images that use the package namespace https://ghcr.io/owner/package-name, use container.

package_nameyes

The name of the package.

See also: GitHub Developer Guide documentation.

Delete a package for an organization

Deletes an entire package in an organization. You cannot delete a public package if any version of the package has more than 25 downloads. In this scenario, contact GitHub support for further assistance.

To use this endpoint, you must have admin permissions in the organization and authenticate using an access token with the packages:read scope. In addition:

  • If package_type is not container, your token must also include the repo scope.
  • If package_type is container, you must also have admin permissions to the container you want to delete.
octokit.packages.deletePackageForOrg({
package_type,
package_name,
org,
});

Parameters

namerequireddescription
package_typeyes

The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. For Docker images that use the package namespace https://ghcr.io/owner/package-name, use container.

package_nameyes

The name of the package.

orgyes

See also: GitHub Developer Guide documentation.

Delete a package version for the authenticated user

Deletes a specific package version for a package owned by the authenticated user. If the package is public and the package version has more than 25 downloads, you cannot delete the package version. In this scenario, contact GitHub support for further assistance.

To use this endpoint, you must have admin permissions in the organization and authenticate using an access token with the packages:read scope. If package_type is not container, your token must also include the repo scope.

octokit.packages.deletePackageVersionForAuthenticatedUser({
package_type,
package_name,
package_version_id,
});

Parameters

namerequireddescription
package_typeyes

The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. For Docker images that use the package namespace https://ghcr.io/owner/package-name, use container.

package_nameyes

The name of the package.

package_version_idyes

Unique identifier of the package version.

See also: GitHub Developer Guide documentation.

Delete package version for an organization

Deletes a specific package version in an organization. If the package is public and the package version has more than 25 downloads, you cannot delete the package version. In this scenario, contact GitHub support for further assistance.

To use this endpoint, you must have admin permissions in the organization and authenticate using an access token with the packages:read scope. In addition:

  • If package_type is not container, your token must also include the repo scope.
  • If package_type is container, you must also have admin permissions to the container you want to delete.
octokit.packages.deletePackageVersionForOrg({
package_type,
package_name,
org,
package_version_id,
});

Parameters

namerequireddescription
package_typeyes

The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. For Docker images that use the package namespace https://ghcr.io/owner/package-name, use container.

package_nameyes

The name of the package.

orgyes
package_version_idyes

Unique identifier of the package version.

See also: GitHub Developer Guide documentation.

Get all package versions for a package owned by an organization

Returns all package versions for a package owned by an organization.

To use this endpoint, you must authenticate using an access token with the packages:read scope. If package_type is not container, your token must also include the repo scope.

octokit.packages.getAllPackageVersionsForAPackageOwnedByAnOrg({
package_type,
package_name,
org,
});

Parameters

namerequireddescription
package_typeyes

The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. For Docker images that use the package namespace https://ghcr.io/owner/package-name, use container.

package_nameyes

The name of the package.

orgyes

See also: GitHub Developer Guide documentation.

Get all package versions for a package owned by the authenticated user

Returns all package versions for a package owned by the authenticated user.

To use this endpoint, you must authenticate using an access token with the packages:read scope. If package_type is not container, your token must also include the repo scope.

octokit.packages.getAllPackageVersionsForAPackageOwnedByTheAuthenticatedUser({
package_type,
package_name,
});

Parameters

namerequireddescription
package_typeyes

The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. For Docker images that use the package namespace https://ghcr.io/owner/package-name, use container.

package_nameyes

The name of the package.

See also: GitHub Developer Guide documentation.

Get all package versions for a package owned by a user

Returns all package versions for a public package owned by a specified user.

To use this endpoint, you must authenticate using an access token with the packages:read scope. If package_type is not container, your token must also include the repo scope.

octokit.packages.getAllPackageVersionsForPackageOwnedByUser({
package_type,
package_name,
username,
});

Parameters

namerequireddescription
package_typeyes

The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. For Docker images that use the package namespace https://ghcr.io/owner/package-name, use container.

package_nameyes

The name of the package.

usernameyes

See also: GitHub Developer Guide documentation.

Get a package for the authenticated user

Gets a specific package for a package owned by the authenticated user.

To use this endpoint, you must authenticate using an access token with the packages:read scope. If package_type is not container, your token must also include the repo scope.

octokit.packages.getPackageForAuthenticatedUser({
package_type,
package_name,
});

Parameters

namerequireddescription
package_typeyes

The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. For Docker images that use the package namespace https://ghcr.io/owner/package-name, use container.

package_nameyes

The name of the package.

See also: GitHub Developer Guide documentation.

Get a package for an organization

Gets a specific package in an organization.

To use this endpoint, you must authenticate using an access token with the packages:read scope. If package_type is not container, your token must also include the repo scope.

octokit.packages.getPackageForOrganization({
package_type,
package_name,
org,
});

Parameters

namerequireddescription
package_typeyes

The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. For Docker images that use the package namespace https://ghcr.io/owner/package-name, use container.

package_nameyes

The name of the package.

orgyes

See also: GitHub Developer Guide documentation.

Get a package for a user

Gets a specific package metadata for a public package owned by a user.

To use this endpoint, you must authenticate using an access token with the packages:read scope. If package_type is not container, your token must also include the repo scope.

octokit.packages.getPackageForUser({
package_type,
package_name,
username,
});

Parameters

namerequireddescription
package_typeyes

The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. For Docker images that use the package namespace https://ghcr.io/owner/package-name, use container.

package_nameyes

The name of the package.

usernameyes

See also: GitHub Developer Guide documentation.

Get a package version for the authenticated user

Gets a specific package version for a package owned by the authenticated user.

To use this endpoint, you must authenticate using an access token with the packages:read scope. If package_type is not container, your token must also include the repo scope.

octokit.packages.getPackageVersionForAuthenticatedUser({
package_type,
package_name,
package_version_id,
});

Parameters

namerequireddescription
package_typeyes

The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. For Docker images that use the package namespace https://ghcr.io/owner/package-name, use container.

package_nameyes

The name of the package.

package_version_idyes

Unique identifier of the package version.

See also: GitHub Developer Guide documentation.

Get a package version for an organization

Gets a specific package version in an organization.

You must authenticate using an access token with the packages:read scope. If package_type is not container, your token must also include the repo scope.

octokit.packages.getPackageVersionForOrganization({
package_type,
package_name,
org,
package_version_id,
});

Parameters

namerequireddescription
package_typeyes

The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. For Docker images that use the package namespace https://ghcr.io/owner/package-name, use container.

package_nameyes

The name of the package.

orgyes
package_version_idyes

Unique identifier of the package version.

See also: GitHub Developer Guide documentation.

Get a package version for a user

Gets a specific package version for a public package owned by a specified user.

At this time, to use this endpoint, you must authenticate using an access token with the packages:read scope. If package_type is not container, your token must also include the repo scope.

octokit.packages.getPackageVersionForUser({
package_type,
package_name,
package_version_id,
username,
});

Parameters

namerequireddescription
package_typeyes

The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. For Docker images that use the package namespace https://ghcr.io/owner/package-name, use container.

package_nameyes

The name of the package.

package_version_idyes

Unique identifier of the package version.

usernameyes

See also: GitHub Developer Guide documentation.

Restore a package for the authenticated user

Restores a package owned by the authenticated user.

You can restore a deleted package under the following conditions:

  • The package was deleted within the last 30 days.
  • The same package namespace and version is still available and not reused for a new package. If the same package namespace is not available, you will not be able to restore your package. In this scenario, to restore the deleted package, you must delete the new package that uses the deleted package's namespace first.

To use this endpoint, you must authenticate using an access token with the packages:read and packages:write scope. If package_type is not container, your token must also include the repo scope.

octokit.packages.restorePackageForAuthenticatedUser({
package_type,
package_name,
});

Parameters

namerequireddescription
package_typeyes

The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. For Docker images that use the package namespace https://ghcr.io/owner/package-name, use container.

package_nameyes

The name of the package.

See also: GitHub Developer Guide documentation.

Restore a package for an organization

Restores an entire package in an organization.

You can restore a deleted package under the following conditions:

  • The package was deleted within the last 30 days.
  • The same package namespace and version is still available and not reused for a new package. If the same package namespace is not available, you will not be able to restore your package. In this scenario, to restore the deleted package, you must delete the new package that uses the deleted package's namespace first.

To use this endpoint, you must have admin permissions in the organization and authenticate using an access token with the packages:read and packages:write scope. In addition:

  • If package_type is not container, your token must also include the repo scope.
  • If package_type is container, you must also have admin permissions to the container that you want to restore.
octokit.packages.restorePackageForOrg({
package_type,
package_name,
org,
});

Parameters

namerequireddescription
package_typeyes

The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. For Docker images that use the package namespace https://ghcr.io/owner/package-name, use container.

package_nameyes

The name of the package.

orgyes

See also: GitHub Developer Guide documentation.

Restore a package version for the authenticated user

Restores a package version owned by the authenticated user.

You can restore a deleted package version under the following conditions:

  • The package was deleted within the last 30 days.
  • The same package namespace and version is still available and not reused for a new package. If the same package namespace is not available, you will not be able to restore your package. In this scenario, to restore the deleted package, you must delete the new package that uses the deleted package's namespace first.

To use this endpoint, you must authenticate using an access token with the packages:read and packages:write scope. If package_type is not container, your token must also include the repo scope.

octokit.packages.restorePackageVersionForAuthenticatedUser({
package_type,
package_name,
package_version_id,
});

Parameters

namerequireddescription
package_typeyes

The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. For Docker images that use the package namespace https://ghcr.io/owner/package-name, use container.

package_nameyes

The name of the package.

package_version_idyes

Unique identifier of the package version.

See also: GitHub Developer Guide documentation.

Restore package version for an organization

Restores a specific package version in an organization.

You can restore a deleted package under the following conditions:

  • The package was deleted within the last 30 days.
  • The same package namespace and version is still available and not reused for a new package. If the same package namespace is not available, you will not be able to restore your package. In this scenario, to restore the deleted package, you must delete the new package that uses the deleted package's namespace first.

To use this endpoint, you must have admin permissions in the organization and authenticate using an access token with the packages:read and packages:write scope. In addition:

  • If package_type is not container, your token must also include the repo scope.
  • If package_type is container, you must also have admin permissions to the container that you want to restore.
octokit.packages.restorePackageVersionForOrg({
package_type,
package_name,
org,
package_version_id,
});

Parameters

namerequireddescription
package_typeyes

The type of supported package. Can be one of npm, maven, rubygems, nuget, docker, or container. For Docker images that use the package namespace https://ghcr.io/owner/package-name, use container.

package_nameyes

The name of the package.

orgyes
package_version_idyes

Unique identifier of the package version.

See also: GitHub Developer Guide documentation.