Skip to main content
We publish frequent updates to our documentation, and translation of this page may still be in progress. For the most current information, please visit the English documentation.
The REST API is now versioned. For more information, see "About API versioning."

Packages

Use the REST API to interact with GitHub Packages.

Sobre o GitHub Packages

Você pode usar a API REST para gerenciar pacotes em seus repositórios e organizações do GitHub. Para obter mais informações, confira "Como restaurar e excluir pacotes".

Para usar a API REST para gerenciar o GitHub Packages, você deve autenticar usando um personal access token (classic).

  • Para acessar metadados do pacote, o token precisa incluir o escopo read:packages.
  • Para excluir pacotes e versões de pacote, o token precisa incluir os escopos read:packages e delete:packages.
  • Para restaurar pacotes e versões de pacote, o token precisa incluir os escopos read:packages e write:packages.

Se o pacote estiver em um registro que dê suporte a permissões granulares, o token não precisará do escopon do repo para acessar ou gerenciar esse pacote. Se seu pacote estiver em um registro que suporta apenas permissões com escopo de repositório, seu token também deverá incluir o escopo repo, pois seu pacote herda permissões de um repositório GitHub. Para obter uma lista de registros que suportam apenas permissões com escopo de repositório, consulte "Sobre permissões para o GitHub Packages".

Para acessar recursos em uma organização com SSO habilitado, você deve habilitar o SSO para seu personal access token (classic). Para obter mais informações, confira "Como autorizar um personal access token para uso com logon único SAML " na documentação do GitHub Enterprise Cloud.

List packages for an organization

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."

Parameters for "List packages for an organization"

Headers
Name, Type, Description
acceptstring

Setting to application/vnd.github+json is recommended.

Path parameters
Name, Type, Description
orgstringRequired

The organization name. The name is not case sensitive.

Query parameters
Name, Type, Description
package_typestringRequired

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.

Can be one of: npm, maven, rubygems, docker, nuget, container

visibilitystring

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."

Can be one of: public, private, internal

pageinteger

Page number of the results to fetch.

Default: 1

per_pageinteger

The number of results per page (max 100).

Default: 30

HTTP response status codes for "List packages for an organization"

Status codeDescription
200

OK

401

Requires authentication

403

Forbidden

Code samples for "List packages for an organization"

get/orgs/{org}/packages
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>"\ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/orgs/ORG/packages?package_type=container

Response

Status: 200
[ { "id": 197, "name": "hello_docker