package_versions
Creates, updates, deletes, gets or lists a package_versions resource.
Overview
| Name | package_versions |
| Type | Resource |
| Id | github.packages.package_versions |
Fields
The following fields are returned by SELECT queries:
- get_package_version_for_organization
- get_package_version_for_user
- get_all_package_versions_for_package_owned_by_org
- get_package_version_for_authenticated_user
- get_all_package_versions_for_package_owned_by_user
- get_all_package_versions_for_package_owned_by_authenticated_user
Response
| Name | Datatype | Description |
|---|---|---|
id | integer | Unique identifier of the package version. |
name | string | The name of the package version. (example: latest) |
created_at | string (date-time) | (example: 2011-04-10T20:09:31Z) |
deleted_at | string (date-time) | (example: 2014-03-03T18:58:10Z) |
description | string | |
html_url | string | (example: https://github.com/orgs/github/packages/container/super-linter/786068) |
license | string | (example: MIT) |
metadata | object | (title: Package Version Metadata) |
package_html_url | string | (example: https://github.com/orgs/github/packages/container/package/super-linter) |
updated_at | string (date-time) | (example: 2014-03-03T18:58:10Z) |
url | string | (example: https://api.github.com/orgs/github/packages/container/super-linter/versions/786068) |
Response
| Name | Datatype | Description |
|---|---|---|
id | integer | Unique identifier of the package version. |
name | string | The name of the package version. (example: latest) |
created_at | string (date-time) | (example: 2011-04-10T20:09:31Z) |
deleted_at | string (date-time) | (example: 2014-03-03T18:58:10Z) |
description | string | |
html_url | string | (example: https://github.com/orgs/github/packages/container/super-linter/786068) |
license | string | (example: MIT) |
metadata | object | (title: Package Version Metadata) |
package_html_url | string | (example: https://github.com/orgs/github/packages/container/package/super-linter) |
updated_at | string (date-time) | (example: 2014-03-03T18:58:10Z) |
url | string | (example: https://api.github.com/orgs/github/packages/container/super-linter/versions/786068) |
Response
| Name | Datatype | Description |
|---|---|---|
id | integer | Unique identifier of the package version. |
name | string | The name of the package version. (example: latest) |
created_at | string (date-time) | (example: 2011-04-10T20:09:31Z) |
deleted_at | string (date-time) | (example: 2014-03-03T18:58:10Z) |
description | string | |
html_url | string | (example: https://github.com/orgs/github/packages/container/super-linter/786068) |
license | string | (example: MIT) |
metadata | object | (title: Package Version Metadata) |
package_html_url | string | (example: https://github.com/orgs/github/packages/container/package/super-linter) |
updated_at | string (date-time) | (example: 2014-03-03T18:58:10Z) |
url | string | (example: https://api.github.com/orgs/github/packages/container/super-linter/versions/786068) |
Response
| Name | Datatype | Description |
|---|---|---|
id | integer | Unique identifier of the package version. |
name | string | The name of the package version. (example: latest) |
created_at | string (date-time) | (example: 2011-04-10T20:09:31Z) |
deleted_at | string (date-time) | (example: 2014-03-03T18:58:10Z) |
description | string | |
html_url | string | (example: https://github.com/orgs/github/packages/container/super-linter/786068) |
license | string | (example: MIT) |
metadata | object | (title: Package Version Metadata) |
package_html_url | string | (example: https://github.com/orgs/github/packages/container/package/super-linter) |
updated_at | string (date-time) | (example: 2014-03-03T18:58:10Z) |
url | string | (example: https://api.github.com/orgs/github/packages/container/super-linter/versions/786068) |
Response
| Name | Datatype | Description |
|---|---|---|
id | integer | Unique identifier of the package version. |
name | string | The name of the package version. (example: latest) |
created_at | string (date-time) | (example: 2011-04-10T20:09:31Z) |
deleted_at | string (date-time) | (example: 2014-03-03T18:58:10Z) |
description | string | |
html_url | string | (example: https://github.com/orgs/github/packages/container/super-linter/786068) |
license | string | (example: MIT) |
metadata | object | (title: Package Version Metadata) |
package_html_url | string | (example: https://github.com/orgs/github/packages/container/package/super-linter) |
updated_at | string (date-time) | (example: 2014-03-03T18:58:10Z) |
url | string | (example: https://api.github.com/orgs/github/packages/container/super-linter/versions/786068) |
Response
| Name | Datatype | Description |
|---|---|---|
id | integer | Unique identifier of the package version. |
name | string | The name of the package version. (example: latest) |
created_at | string (date-time) | (example: 2011-04-10T20:09:31Z) |
deleted_at | string (date-time) | (example: 2014-03-03T18:58:10Z) |
description | string | |
html_url | string | (example: https://github.com/orgs/github/packages/container/super-linter/786068) |
license | string | (example: MIT) |
metadata | object | (title: Package Version Metadata) |
package_html_url | string | (example: https://github.com/orgs/github/packages/container/package/super-linter) |
updated_at | string (date-time) | (example: 2014-03-03T18:58:10Z) |
url | string | (example: https://api.github.com/orgs/github/packages/container/super-linter/versions/786068) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_package_version_for_organization | select | package_type, package_name, org, package_version_id | Gets a specific package version in an organization. OAuth app tokens and personal access tokens (classic) need the read:packages scope to use this endpoint. For more information, see "About permissions for GitHub Packages." | |
get_package_version_for_user | select | package_type, package_name, package_version_id, username | Gets a specific package version for a public package owned by a specified user. OAuth app tokens and personal access tokens (classic) need the read:packages scope to use this endpoint. For more information, see "About permissions for GitHub Packages." | |
get_all_package_versions_for_package_owned_by_org | select | package_type, package_name, org | page, per_page, state | Lists package versions for a package owned by an organization. OAuth app tokens and personal access tokens (classic) need the read:packages scope to use this endpoint. For more information, see "About permissions for GitHub Packages." |
get_package_version_for_authenticated_user | select | package_type, package_name, package_version_id | Gets a specific package version for a package owned by the authenticated user. OAuth app tokens and personal access tokens (classic) need the read:packages scope to use this endpoint. For more information, see "About permissions for GitHub Packages." | |
get_all_package_versions_for_package_owned_by_user | select | package_type, package_name, username | Lists package versions for a public package owned by a specified user. OAuth app tokens and personal access tokens (classic) need the read:packages scope to use this endpoint. For more information, see "About permissions for GitHub Packages." | |
get_all_package_versions_for_package_owned_by_authenticated_user | select | package_type, package_name | page, per_page, state | Lists package versions for a package owned by the authenticated user. OAuth app tokens and personal access tokens (classic) need the read:packages scope to use this endpoint. For more information, see "About permissions for GitHub Packages." |
delete_package_version_for_org | delete | package_type, package_name, org, package_version_id | Deletes a specific package version in an organization. If the package is public and the package version has more than 5,000 downloads, you cannot delete the package version. In this scenario, contact GitHub support for further assistance. The authenticated user must have admin permissions in the organization to use this endpoint. If the package_type belongs to a GitHub Packages registry that supports granular permissions, the authenticated user must also have admin permissions to the package. For the list of these registries, see "About permissions for GitHub Packages."OAuth app tokens and personal access tokens (classic) need the read:packages and delete:packages scopes to use this endpoint. For more information, see "About permissions for GitHub Packages." | |
delete_package_version_for_user | delete | package_type, package_name, username, package_version_id | Deletes a specific package version for a user. If the package is public and the package version has more than 5,000 downloads, you cannot delete the package version. In this scenario, contact GitHub support for further assistance. If the package_type belongs to a GitHub Packages registry that supports granular permissions, the authenticated user must have admin permissions to the package. For the list of these registries, see "About permissions for GitHub Packages."OAuth app tokens and personal access tokens (classic) need the read:packages and delete:packages scopes to use this endpoint. For more information, see "About permissions for GitHub Packages." | |
delete_package_version_for_authenticated_user | delete | package_type, package_name, package_version_id | 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 5,000 downloads, you cannot delete the package version. In this scenario, contact GitHub support for further assistance. The authenticated user must have admin permissions in the organization to use this endpoint. OAuth app tokens and personal access tokens (classic) need the read:packages and delete:packages scopes to use this endpoint. For more information, see "About permissions for GitHub Packages." | |
restore_package_version_for_org | exec | package_type, package_name, org, package_version_id | 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. The authenticated user must have admin permissions in the organization to use this endpoint. If the package_type belongs to a GitHub Packages registry that supports granular permissions, the authenticated user must also have admin permissions to the package. For the list of these registries, see "About permissions for GitHub Packages."OAuth app tokens and personal access tokens (classic) need the read:packages and write:packages scopes to use this endpoint. For more information, see "About permissions for GitHub Packages." | |
restore_package_version_for_authenticated_user | exec | package_type, package_name, package_version_id | 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. OAuth app tokens and personal access tokens (classic) need the read:packages and write:packages scopes to use this endpoint. For more information, see "About permissions for GitHub Packages." | |
restore_package_version_for_user | exec | package_type, package_name, username, package_version_id | Restores a specific package version for a 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. If the package_type belongs to a GitHub Packages registry that supports granular permissions, the authenticated user must have admin permissions to the package. For the list of these registries, see "About permissions for GitHub Packages."OAuth app tokens and personal access tokens (classic) need the read:packages and write:packages scopes to use this endpoint. For more information, see "About permissions for GitHub Packages." |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
org | string | The organization name. The name is not case sensitive. |
package_name | string | The name of the package. |
package_type | string | The type of supported package. Packages in GitHub's Gradle registry have the type maven. Docker images pushed to GitHub's Container registry (ghcr.io) have the type container. You can use the type docker to find images that were pushed to GitHub's Docker registry (docker.pkg.github.com), even if these have now been migrated to the Container registry. |
package_version_id | integer | Unique identifier of the package version. |
username | string | The handle for the GitHub user account. |
page | integer | The page number of the results to fetch. For more information, see "Using pagination in the REST API." |
per_page | integer | The number of results per page (max 100). For more information, see "Using pagination in the REST API." |
state | string | The state of the package, either active or deleted. |
SELECT examples
- get_package_version_for_organization
- get_package_version_for_user
- get_all_package_versions_for_package_owned_by_org
- get_package_version_for_authenticated_user
- get_all_package_versions_for_package_owned_by_user
- get_all_package_versions_for_package_owned_by_authenticated_user
Gets a specific package version in an organization.
OAuth app tokens and personal access tokens (classic) need the read:packages scope to use this endpoint. For more information, see "About permissions for GitHub Packages."
SELECT
id,
name,
created_at,
deleted_at,
description,
html_url,
license,
metadata,
package_html_url,
updated_at,
url
FROM github.packages.package_versions
WHERE package_type = '{{ package_type }}' -- required
AND package_name = '{{ package_name }}' -- required
AND org = '{{ org }}' -- required
AND package_version_id = '{{ package_version_id }}' -- required
;
Gets a specific package version for a public package owned by a specified user.
OAuth app tokens and personal access tokens (classic) need the read:packages scope to use this endpoint. For more information, see "About permissions for GitHub Packages."
SELECT
id,
name,
created_at,
deleted_at,
description,
html_url,
license,
metadata,
package_html_url,
updated_at,
url
FROM github.packages.package_versions
WHERE package_type = '{{ package_type }}' -- required
AND package_name = '{{ package_name }}' -- required
AND package_version_id = '{{ package_version_id }}' -- required
AND username = '{{ username }}' -- required
;
Lists package versions for a package owned by an organization.
OAuth app tokens and personal access tokens (classic) need the read:packages scope to use this endpoint. For more information, see "About permissions for GitHub Packages."
SELECT
id,
name,
created_at,
deleted_at,
description,
html_url,
license,
metadata,
package_html_url,
updated_at,
url
FROM github.packages.package_versions
WHERE package_type = '{{ package_type }}' -- required
AND package_name = '{{ package_name }}' -- required
AND org = '{{ org }}' -- required
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
AND state = '{{ state }}'
;
Gets a specific package version for a package owned by the authenticated user.
OAuth app tokens and personal access tokens (classic) need the read:packages scope to use this endpoint. For more information, see "About permissions for GitHub Packages."
SELECT
id,
name,
created_at,
deleted_at,
description,
html_url,
license,
metadata,
package_html_url,
updated_at,
url
FROM github.packages.package_versions
WHERE package_type = '{{ package_type }}' -- required
AND package_name = '{{ package_name }}' -- required
AND package_version_id = '{{ package_version_id }}' -- required
;
Lists package versions for a public package owned by a specified user.
OAuth app tokens and personal access tokens (classic) need the read:packages scope to use this endpoint. For more information, see "About permissions for GitHub Packages."
SELECT
id,
name,
created_at,
deleted_at,
description,
html_url,
license,
metadata,
package_html_url,
updated_at,
url
FROM github.packages.package_versions
WHERE package_type = '{{ package_type }}' -- required
AND package_name = '{{ package_name }}' -- required
AND username = '{{ username }}' -- required
;
Lists package versions for a package owned by the authenticated user.
OAuth app tokens and personal access tokens (classic) need the read:packages scope to use this endpoint. For more information, see "About permissions for GitHub Packages."
SELECT
id,
name,
created_at,
deleted_at,
description,
html_url,
license,
metadata,
package_html_url,
updated_at,
url
FROM github.packages.package_versions
WHERE package_type = '{{ package_type }}' -- required
AND package_name = '{{ package_name }}' -- required
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
AND state = '{{ state }}'
;
DELETE examples
- delete_package_version_for_org
- delete_package_version_for_user
- delete_package_version_for_authenticated_user
Deletes a specific package version in an organization. If the package is public and the package version has more than 5,000 downloads, you cannot delete the package version. In this scenario, contact GitHub support for further assistance.
The authenticated user must have admin permissions in the organization to use this endpoint. If the package_type belongs to a GitHub Packages registry that supports granular permissions, the authenticated user must also have admin permissions to the package. For the list of these registries, see "About permissions for GitHub Packages."
OAuth app tokens and personal access tokens (classic) need the read:packages and delete:packages scopes to use this endpoint. For more information, see "About permissions for GitHub Packages."
DELETE FROM github.packages.package_versions
WHERE package_type = '{{ package_type }}' --required
AND package_name = '{{ package_name }}' --required
AND org = '{{ org }}' --required
AND package_version_id = '{{ package_version_id }}' --required
;
Deletes a specific package version for a user. If the package is public and the package version has more than 5,000 downloads, you cannot delete the package version. In this scenario, contact GitHub support for further assistance.
If the package_type belongs to a GitHub Packages registry that supports granular permissions, the authenticated user must have admin permissions to the package. For the list of these registries, see "About permissions for GitHub Packages."
OAuth app tokens and personal access tokens (classic) need the read:packages and delete:packages scopes to use this endpoint. For more information, see "About permissions for GitHub Packages."
DELETE FROM github.packages.package_versions
WHERE package_type = '{{ package_type }}' --required
AND package_name = '{{ package_name }}' --required
AND username = '{{ username }}' --required
AND package_version_id = '{{ package_version_id }}' --required
;
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 5,000 downloads, you cannot delete the package version. In this scenario, contact GitHub support for further assistance.
The authenticated user must have admin permissions in the organization to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the read:packages and delete:packages scopes to use this endpoint. For more information, see "About permissions for GitHub Packages."
DELETE FROM github.packages.package_versions
WHERE package_type = '{{ package_type }}' --required
AND package_name = '{{ package_name }}' --required
AND package_version_id = '{{ package_version_id }}' --required
;
Lifecycle Methods
- restore_package_version_for_org
- restore_package_version_for_authenticated_user
- restore_package_version_for_user
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.
The authenticated user must have admin permissions in the organization to use this endpoint. If the package_type belongs to a GitHub Packages registry that supports granular permissions, the authenticated user must also have admin permissions to the package. For the list of these registries, see "About permissions for GitHub Packages."
OAuth app tokens and personal access tokens (classic) need the read:packages and write:packages scopes to use this endpoint. For more information, see "About permissions for GitHub Packages."
EXEC github.packages.package_versions.restore_package_version_for_org
@package_type='{{ package_type }}' --required,
@package_name='{{ package_name }}' --required,
@org='{{ org }}' --required,
@package_version_id='{{ package_version_id }}' --required
;
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.
OAuth app tokens and personal access tokens (classic) need the read:packages and write:packages scopes to use this endpoint. For more information, see "About permissions for GitHub Packages."
EXEC github.packages.package_versions.restore_package_version_for_authenticated_user
@package_type='{{ package_type }}' --required,
@package_name='{{ package_name }}' --required,
@package_version_id='{{ package_version_id }}' --required
;
Restores a specific package version for a 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.
If the package_type belongs to a GitHub Packages registry that supports granular permissions, the authenticated user must have admin permissions to the package. For the list of these registries, see "About permissions for GitHub Packages."
OAuth app tokens and personal access tokens (classic) need the read:packages and write:packages scopes to use this endpoint. For more information, see "About permissions for GitHub Packages."
EXEC github.packages.package_versions.restore_package_version_for_user
@package_type='{{ package_type }}' --required,
@package_name='{{ package_name }}' --required,
@username='{{ username }}' --required,
@package_version_id='{{ package_version_id }}' --required
;