Manage packages for authenticated users and organizations.

Get list of conflicting packages during Docker migration for organization

get /orgs/{org}/docker/conflicts

Lists all packages that are in a specific organization, are readable by the requesting user, and that encountered a conflict during a Docker migration. To use this endpoint, you must authenticate using an access token with the read:packages scope.

org

string

required

The organization name. The name is not case sensitive.

Response

ExamplesSchema

Response

[
  {
    "id": 197,
    "name": "hello_docker",
    "package_type": "container",
    "owner": {
      "login": "github",
      "id": 9919,
      "node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=",
      "avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/github",
      "html_url": "https://github.com/github",
      "followers_url": "https://api.github.com/users/github/followers",
      "following_url": "https://api.github.com/users/github/following{/other_user}",
      "gists_url": "https://api.github.com/users/github/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/github/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/github/subscriptions",
      "organizations_url": "https://api.github.com/users/github/orgs",
      "repos_url": "https://api.github.com/users/github/repos",
      "events_url": "https://api.github.com/users/github/events{/privacy}",
      "received_events_url": "https://api.github.com/users/github/received_events",
      "type": "Organization",
      "site_admin": false
    },
    "version_count": 1,
    "visibility": "private",
    "url": "https://api.github.com/orgs/github/packages/container/hello_docker",
    "created_at": "2020-05-19T22:19:11Z",
    "updated_at": "2020-05-19T22:19:11Z",
    "html_url": "https://github.com/orgs/github/packages/container/package/hello_docker"
  },
  {
    "id": 198,
    "name": "goodbye_docker",
    "package_type": "container",
    "owner": {
      "login": "github",
      "id": 9919,
      "node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=",
      "avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/github",
      "html_url": "https://github.com/github",
      "followers_url": "https://api.github.com/users/github/followers",
      "following_url": "https://api.github.com/users/github/following{/other_user}",
      "gists_url": "https://api.github.com/users/github/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/github/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/github/subscriptions",
      "organizations_url": "https://api.github.com/users/github/orgs",
      "repos_url": "https://api.github.com/users/github/repos",
      "events_url": "https://api.github.com/users/github/events{/privacy}",
      "received_events_url": "https://api.github.com/users/github/received_events",
      "type": "Organization",
      "site_admin": false
    },
    "version_count": 2,
    "visibility": "private",
    "url": "https://api.github.com/orgs/github/packages/container/goodbye_docker",
    "created_at": "2020-05-20T22:19:11Z",
    "updated_at": "2020-05-20T22:19:11Z",
    "html_url": "https://github.com/orgs/github/packages/container/package/goodbye_docker"
  }
]

List packages for an organization

get /orgs/{org}/packages

Lists packages in an organization readable by the user.

To use this endpoint, you must authenticate using an access token with the read:packages scope. If the package_type belongs to a registry that only supports repository-scoped permissions, your token must also include the repo scope. For the list of GitHub Packages registries that only support repository-scoped permissions, see "About permissions for GitHub Packages."

package_type

string

required

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.

Enum
  • npm
  • maven
  • rubygems
  • docker
  • nuget
  • container

visibility

string

The selected visibility of the packages. This parameter is optional and only filters an existing result set.

The internal visibility is only supported for GitHub Packages registries that allow for granular permissions. For other ecosystems internal is synonymous with private. For the list of GitHub Packages registries that support granular permissions, see "About permissions for GitHub Packages."

Enum
  • public
  • private
  • internal

page

int

Page number of the results to fetch.

Default
1

per_page

int

The number of results per page (max 100).

Default
30

Response

ExamplesSchema

Response

[
  {
    "id": 197,
    "name": "hello_docker",
    "package_type": "container",
    "owner": {
      "login": "github",
      "id": 9919,
      "node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=",
      "avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/github",
      "html_url": "https://github.com/github",
      "followers_url": "https://api.github.com/users/github/followers",
      "following_url": "https://api.github.com/users/github/following{/other_user}",
      "gists_url": "https://api.github.com/users/github/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/github/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/github/subscriptions",
      "organizations_url": "https://api.github.com/users/github/orgs",
      "repos_url": "https://api.github.com/users/github/repos",
      "events_url": "https://api.github.com/users/github/events{/privacy}",
      "received_events_url": "https://api.github.com/users/github/received_events",
      "type": "Organization",
      "site_admin": false
    },
    "version_count": 1,
    "visibility": "private",
    "url": "https://api.github.com/orgs/github/packages/container/hello_docker",
    "created_at": "2020-05-19T22:19:11Z",
    "updated_at": "2020-05-19T22:19:11Z",
    "html_url": "https://github.com/orgs/github/packages/container/package/hello_docker"
  },
  {
    "id": 198,
    "name": "goodbye_docker",
    "package_type": "container",
    "owner": {
      "login": "github",
      "id": 9919,
      "node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=",
      "avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/github",
      "html_url": "https://github.com/github",
      "followers_url": "https://api.github.com/users/github/followers",
      "following_url": "https://api.github.com/users/github/following{/other_user}",
      "gists_url": "https://api.github.com/users/github/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/github/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/github/subscriptions",
      "organizations_url": "https://api.github.com/users/github/orgs",
      "repos_url": "https://api.github.com/users/github/repos",
      "events_url": "https://api.github.com/users/github/events{/privacy}",
      "received_events_url": "https://api.github.com/users/github/received_events",
      "type": "Organization",
      "site_admin": false
    },
    "version_count": 2,
    "visibility": "private",
    "url": "https://api.github.com/orgs/github/packages/container/goodbye_docker",
    "created_at": "2020-05-20T22:19:11Z",
    "updated_at": "2020-05-20T22:19:11Z",
    "html_url": "https://github.com/orgs/github/packages/container/package/goodbye_docker"
  }
]

Get a package for an organization

get /orgs/{org}/packages/{package_type}/{package_name}

Gets a specific package in an organization.

To use this endpoint, you must authenticate using an access token with the read:packages scope. If the package_type belongs to a GitHub Packages registry that only supports repository-scoped permissions, your token must also include the repo scope. For the list of GitHub Packages registries that only support repository-scoped permissions, see "About permissions for GitHub Packages."

package_type

string

required

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.

Enum
  • npm
  • maven
  • rubygems
  • docker
  • nuget
  • container

package_name

string

required

The name of the package.

org

string

required

The organization name. The name is not case sensitive.

Response

ExamplesSchema

Response

{
  "id": 197,
  "name": "hello_docker",
  "package_type": "container",
  "owner": {
    "login": "github",
    "id": 9919,
    "node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=",
    "avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/github",
    "html_url": "https://github.com/github",
    "followers_url": "https://api.github.com/users/github/followers",
    "following_url": "https://api.github.com/users/github/following{/other_user}",
    "gists_url": "https://api.github.com/users/github/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/github/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/github/subscriptions",
    "organizations_url": "https://api.github.com/users/github/orgs",
    "repos_url": "https://api.github.com/users/github/repos",
    "events_url": "https://api.github.com/users/github/events{/privacy}",
    "received_events_url": "https://api.github.com/users/github/received_events",
    "type": "Organization",
    "site_admin": false
  },
  "version_count": 1,
  "visibility": "private",
  "url": "https://api.github.com/orgs/github/packages/container/hello_docker",
  "created_at": "2020-05-19T22:19:11Z",
  "updated_at": "2020-05-19T22:19:11Z",
  "html_url": "https://github.com/orgs/github/packages/container/package/hello_docker"
}

Delete a package for an organization

delete /orgs/{org}/packages/{package_type}/{package_name}

Deletes an entire package in an organization. You cannot delete a public package if any version of the package has more than 5,000 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 read:packages and delete:packages scopes. In addition:

  • If the package_type belongs to a GitHub Packages registry that only supports repository-scoped permissions, your token must also include the repo scope. For the list of these registries, see "About permissions for GitHub Packages."
  • If the package_type belongs to a GitHub Packages registry that supports granular permissions, you must have admin permissions to the package you want to delete. For the list of these registries, see "About permissions for GitHub Packages."

package_type

string

required

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.

Enum
  • npm
  • maven
  • rubygems
  • docker
  • nuget
  • container

package_name

string

required

The name of the package.

org

string

required

The organization name. The name is not case sensitive.

Response

ExamplesSchema

Response

Empty response

Restore a package for an organization

post /orgs/{org}/packages/{package_type}/{package_name}/restore

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 read:packages and write:packages scopes. In addition:

  • If the package_type belongs to a GitHub Packages registry that only supports repository-scoped permissions, your token must also include the repo scope. For the list of these registries, see "About permissions for GitHub Packages."
  • If the package_type belongs to a GitHub Packages registry that supports granular permissions, you must have admin permissions to the package you want to restore. For the list of these registries, see "About permissions for GitHub Packages."

token

string

package token

Response

ExamplesSchema

Response

Empty response

List package versions for a package owned by an organization

get /orgs/{org}/packages/{package_type}/{package_name}/versions

Lists package versions for a package owned by an organization.

If the package_type belongs to a GitHub Packages registry that only supports repository-scoped permissions, your token must also include the repo scope. For the list of GitHub Packages registries that only support repository-scoped permissions, see "About permissions for GitHub Packages."

page

int

Page number of the results to fetch.

Default
1

per_page

int

The number of results per page (max 100).

Default
30

state

string

The state of the package, either active or deleted.

Default
"active"
Enum
  • active
  • deleted

Response

ExamplesSchema

Response

[
  {
    "id": 245301,
    "name": "1.0.4",
    "url": "https://api.github.com/orgs/octo-org/packages/npm/hello-world-npm/versions/245301",
    "package_html_url": "https://github.com/octo-org/hello-world-npm/packages/43752",
    "created_at": "2019-11-05T22:49:04Z",
    "updated_at": "2019-11-05T22:49:04Z",
    "html_url": "https://github.com/octo-org/hello-world-npm/packages/43752?version=1.0.4",
    "metadata": {
      "package_type": "npm"
    }
  },
  {
    "id": 209672,
    "name": "1.0.3",
    "url": "https://api.github.com/orgs/octo-org/packages/npm/hello-world-npm/versions/209672",
    "package_html_url": "https://github.com/octo-org/hello-world-npm/packages/43752",
    "created_at": "2019-10-29T15:42:11Z",
    "updated_at": "2019-10-29T15:42:12Z",
    "html_url": "https://github.com/octo-org/hello-world-npm/packages/43752?version=1.0.3",
    "metadata": {
      "package_type": "npm"
    }
  }
]

Get a package version for an organization

get /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}

Gets a specific package version in an organization.

You must authenticate using an access token with the read:packages scope. If the package_type belongs to a GitHub Packages registry that only supports repository-scoped permissions, your token must also include the repo scope. For the list of GitHub Packages registries that only support repository-scoped permissions, see "About permissions for GitHub Packages."

package_type

string

required

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.

Enum
  • npm
  • maven
  • rubygems
  • docker
  • nuget
  • container

package_name

string

required

The name of the package.

org

string

required

The organization name. The name is not case sensitive.

package_version_id

int

required

Unique identifier of the package version.

Response

ExamplesSchema

Response

{
  "id": 836,
  "name": "sha256:b3d3e366b55f9a54599220198b3db5da8f53592acbbb7dc7e4e9878762fc5344",
  "url": "https://api.github.com/orgs/github/packages/container/hello_docker/versions/836",
  "package_html_url": "https://github.com/orgs/github/packages/container/package/hello_docker",
  "created_at": "2020-05-19T22:19:11Z",
  "updated_at": "2020-05-19T22:19:11Z",
  "html_url": "https://github.com/orgs/github/packages/container/hello_docker/836",
  "metadata": {
    "package_type": "container",
    "container": {
      "tags": [
        "latest"
      ]
    }
  }
}

Delete package version for an organization

delete /orgs/{org}/packages/{package_type}/{package_name}/versions/{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.

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

  • If the package_type belongs to a GitHub Packages registry that only supports repository-scoped permissions, your token must also include the repo scope. For the list of these registries, see "About permissions for GitHub Packages."
  • If the package_type belongs to a GitHub Packages registry that supports granular permissions, you must have admin permissions to the package whose version you want to delete. For the list of these registries, see "About permissions for GitHub Packages."

package_type

string

required

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.

Enum
  • npm
  • maven
  • rubygems
  • docker
  • nuget
  • container

package_name

string

required

The name of the package.

org

string

required

The organization name. The name is not case sensitive.

package_version_id

int

required

Unique identifier of the package version.

Response

ExamplesSchema

Response

Empty response