跳至主要内容
REST API 现在已启用版本控制。 更多信息请参见“关于 API 版本控制”。

GitHub Apps 的 REST API 端点

使用 REST API 与 GitHub 应用交互

关于 GitHub Apps

如果您在 GitHub Actions 中使用您的应用并希望修改工作流文件,则必须使用包含 workflow 范围的 OAuth 令牌代表用户进行身份验证。用户必须对包含工作流文件的仓库拥有 admin 或 write 权限。更多信息,请参阅 OAuth 应用的作用域

此页面列出了以 GitHub 应用身份进行身份验证后可访问的端点。更多信息,请参阅 以 GitHub 应用身份进行身份验证

请参阅 GitHub 应用安装的 REST API 端点,了解需要以 GitHub 应用安装身份进行身份验证的端点列表。

获取已认证的应用

返回与使用的身份验证凭据关联的 GitHub 应用。要查看此 GitHub 应用关联了多少次安装,请查看响应中的 installations_count。有关您的应用安装的更多详细信息,请参阅 “列出已认证应用的安装” 端点。

您必须使用 JWT 来访问此端点。

针对 “获取已认证的应用” 的细粒度访问令牌

此端点不适用于 GitHub App 用户访问令牌、GitHub App 安装访问令牌或细粒度个人访问令牌。

针对 “获取已认证的应用” 的 HTTP 响应状态码

状态码描述
200

OK (成功)

针对 “获取已认证的应用” 的代码示例

请求示例

获取/app
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/app

响应

状态: 200
{ "id": 1, "slug": "octoapp", "client_id": "Iv1.ab1112223334445c", "node_id": "MDExOkludGVncmF0aW9uMQ==", "owner": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "name": "Octocat App", "description": "", "external_url": "https://example.com", "html_url": "https://github.com/apps/octoapp", "created_at": "2017-07-08T16:18:44-04:00", "updated_at": "2017-07-08T16:18:44-04:00", "permissions": { "metadata": "read", "contents": "read", "issues": "write", "single_file": "write" }, "events": [ "push", "pull_request" ] }

从清单创建 GitHub 应用

使用此端点完成实现 GitHub 应用清单流程 所需的握手。当您使用清单流程创建 GitHub 应用时,您会收到一个临时的 code,用于检索该 GitHub 应用的 idpem(私钥)和 webhook_secret

针对 “从清单创建 GitHub 应用” 的细粒度访问令牌

此端点不适用于 GitHub App 用户访问令牌、GitHub App 安装访问令牌或细粒度个人访问令牌。

“从清单创建 GitHub 应用” 的参数

标头 (Headers)
名称, 类型, 描述
accept string

建议设置为 application/vnd.github+json

路径参数
名称, 类型, 描述
code string 必填

针对 “从清单创建 GitHub 应用” 的 HTTP 响应状态码

状态码描述
201

已创建

404

未找到资源

422

验证失败,或端点已被滥用。

针对 “从清单创建 GitHub 应用” 的代码示例

请求示例

POST/app-manifests/{code}/conversions
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/app-manifests/CODE/conversions

响应

状态:201
{ "id": 1, "slug": "octoapp", "node_id": "MDxOkludGVncmF0aW9uMQ==", "owner": { "login": "github", "id": 1, "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=", "url": "https://api.github.com/orgs/github", "repos_url": "https://api.github.com/orgs/github/repos", "events_url": "https://api.github.com/orgs/github/events", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": true }, "name": "Octocat App", "description": "", "external_url": "https://example.com", "html_url": "https://github.com/apps/octoapp", "created_at": "2017-07-08T16:18:44-04:00", "updated_at": "2017-07-08T16:18:44-04:00", "permissions": { "metadata": "read", "contents": "read", "issues": "write", "single_file": "write" }, "events": [ "push", "pull_request" ], "client_id": "Iv1.8a61f9b3a7aba766", "client_secret": "1726be1638095a19edd134c77bde3aa2ece1e5d8", "webhook_secret": "e340154128314309424b7c8e90325147d99fdafa", "pem": "-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAuEPzOUE+kiEH1WLiMeBytTEF856j0hOVcSUSUkZxKvqczkWM\n9vo1gDyC7ZXhdH9fKh32aapba3RSsp4ke+giSmYTk2mGR538ShSDxh0OgpJmjiKP\nX0Bj4j5sFqfXuCtl9SkH4iueivv4R53ktqM+n6hk98l6hRwC39GVIblAh2lEM4L/\n6WvYwuQXPMM5OG2Ryh2tDZ1WS5RKfgq+9ksNJ5Q9UtqtqHkO+E63N5OK9sbzpUUm\noNaOl3udTlZD3A8iqwMPVxH4SxgATBPAc+bmjk6BMJ0qIzDcVGTrqrzUiywCTLma\nszdk8GjzXtPDmuBgNn+o6s02qVGpyydgEuqmTQIDAQABAoIBACL6AvkjQVVLn8kJ\ndBYznJJ4M8ECo+YEgaFwgAHODT0zRQCCgzd+Vxl4YwHmKV2Lr+y2s0drZt8GvYva\nKOK8NYYZyi15IlwFyRXmvvykF9UBpSXluYFDH7KaVroWMgRreHcIys5LqVSIb6Bo\ngDmK0yBLPp8qR29s2b7ScZRtLaqGJiX+j55rNzrZwxHkxFHyG9OG+u9IsBElcKCP\nkYCVE8ZdYexfnKOZbgn2kZB9qu0T/Mdvki8yk3I2bI6xYO24oQmhnT36qnqWoCBX\nNuCNsBQgpYZeZET8mEAUmo9d+ABmIHIvSs005agK8xRaP4+6jYgy6WwoejJRF5yd\nNBuF7aECgYEA50nZ4FiZYV0vcJDxFYeY3kYOvVuKn8OyW+2rg7JIQTremIjv8FkE\nZnwuF9ZRxgqLxUIfKKfzp/5l5LrycNoj2YKfHKnRejxRWXqG+ZETfxxlmlRns0QG\nJ4+BYL0CoanDSeA4fuyn4Bv7cy/03TDhfg/Uq0Aeg+hhcPE/vx3ebPsCgYEAy/Pv\neDLssOSdeyIxf0Brtocg6aPXIVaLdus+bXmLg77rJIFytAZmTTW8SkkSczWtucI3\nFI1I6sei/8FdPzAl62/JDdlf7Wd9K7JIotY4TzT7Tm7QU7xpfLLYIP1bOFjN81rk\n77oOD4LsXcosB/U6s1blPJMZ6AlO2EKs10UuR1cCgYBipzuJ2ADEaOz9RLWwi0AH\nPza2Sj+c2epQD9ZivD7Zo/Sid3ZwvGeGF13JyR7kLEdmAkgsHUdu1rI7mAolXMaB\n1pdrsHureeLxGbRM6za3tzMXWv1Il7FQWoPC8ZwXvMOR1VQDv4nzq7vbbA8z8c+c\n57+8tALQHOTDOgQIzwK61QKBgERGVc0EJy4Uag+VY8J4m1ZQKBluqo7TfP6DQ7O8\nM5MX73maB/7yAX8pVO39RjrhJlYACRZNMbK+v/ckEQYdJSSKmGCVe0JrGYDuPtic\nI9+IGfSorf7KHPoMmMN6bPYQ7Gjh7a++tgRFTMEc8956Hnt4xGahy9NcglNtBVVN\n6G8jAoGBAMCh028pdzJa/xeBHLLaVB2sc0Fe7993WlsPmnVE779dAz7qMscOtXJK\nfgtriltLSSD6rTA9hUAsL/X62rY0wdXuNdijjBb/qvrx7CAV6i37NK1CjABNjsfG\nZM372Ac6zc1EqSrid2IjET1YqyIW2KGLI1R2xbQc98UGlt48OdWu\n-----END RSA PRIVATE KEY-----\n" }

列出已认证应用的安装请求

列出已认证的 GitHub 应用所有待处理的安装请求。

针对 “列出已认证应用的安装请求” 的细粒度访问令牌

此端点不适用于 GitHub App 用户访问令牌、GitHub App 安装访问令牌或细粒度个人访问令牌。

“列出已认证应用的安装请求” 的参数

标头 (Headers)
名称, 类型, 描述
accept string

建议设置为 application/vnd.github+json

查询参数
名称, 类型, 描述
per_page integer

每页的结果数(最大 100)。有关详细信息,请参阅“在 REST API 中使用分页”。

默认值:30

page integer

要获取的结果页码。有关详细信息,请参阅“在 REST API 中使用分页”。

默认值:1

针对 “列出已认证应用的安装请求” 的 HTTP 响应状态码

状态码描述
200

集成安装请求列表

304

未修改

401

需要身份验证

针对 “列出已认证应用的安装请求” 的代码示例

请求示例

GET/app/installation-requests
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/app/installation-requests

集成安装请求列表

状态: 200
[ { "id": 25381, "node_id": "MDEyOkludGVncmF0aW9uMTIzNDU2Nzg5MA==", "account": { "login": "octo-org", "id": 6811672, "node_id": "MDEyOk9yZ2FuaXphdGlvbjY4MTE2NzI=", "avatar_url": "https://avatars3.githubusercontent.com/u/6811672?v=4", "gravatar_id": "", "url": "https://api.github.com/users/octo-org", "html_url": "https://github.com/octo-org", "followers_url": "https://api.github.com/users/octo-org/followers", "following_url": "https://api.github.com/users/octo-org/following{/other_user}", "gists_url": "https://api.github.com/users/octo-org/gists{/gist_id}", "starred_url": "https://api.github.com/users/octo-org/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octo-org/subscriptions", "organizations_url": "https://api.github.com/users/octo-org/orgs", "repos_url": "https://api.github.com/users/octo-org/repos", "events_url": "https://api.github.com/users/octo-org/events{/privacy}", "received_events_url": "https://api.github.com/users/octo-org/received_events", "type": "Organization", "site_admin": false }, "requester": { "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "created_at": "2022-07-08T16:18:44-04:00" } ]

列出已认证应用的安装

该安装的权限包含在 permissions 键下。

您必须使用 JWT 来访问此端点。

针对 “列出已认证应用的安装” 的细粒度访问令牌

此端点不适用于 GitHub App 用户访问令牌、GitHub App 安装访问令牌或细粒度个人访问令牌。

“列出已认证应用的安装” 的参数

标头 (Headers)
名称, 类型, 描述
accept string

建议设置为 application/vnd.github+json

查询参数
名称, 类型, 描述
per_page integer

每页的结果数(最大 100)。有关详细信息,请参阅“在 REST API 中使用分页”。

默认值:30

page integer

要获取的结果页码。有关详细信息,请参阅“在 REST API 中使用分页”。

默认值:1

since 字符串

仅显示在给定时间之后更新的结果。这是 ISO 8601 格式的时间戳:YYYY-MM-DDTHH:MM:SSZ

outdated string

针对 “列出已认证应用的安装” 的 HTTP 响应状态码

状态码描述
200

该安装的权限包含在 permissions 键下。

针对 “列出已认证应用的安装” 的代码示例

请求示例

GET/app/installations
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/app/installations

该安装的权限包含在 permissions 键下。

状态: 200
[ { "id": 1, "account": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "access_tokens_url": "https://api.github.com/app/installations/1/access_tokens", "repositories_url": "https://api.github.com/installation/repositories", "html_url": "https://github.com/organizations/github/settings/installations/1", "app_id": 1, "target_id": 1, "target_type": "Organization", "permissions": { "checks": "write", "metadata": "read", "contents": "read" }, "events": [ "push", "pull_request" ], "single_file_name": "config.yaml", "has_multiple_single_files": true, "single_file_paths": [ "config.yml", ".github/issue_TEMPLATE.md" ], "repository_selection": "selected", "created_at": "2017-07-08T16:18:44-04:00", "updated_at": "2017-07-08T16:18:44-04:00", "app_slug": "github-actions", "suspended_at": null, "suspended_by": null } ]

获取已认证应用的安装

使已认证的 GitHub 应用能够使用安装 ID 获取安装信息。

您必须使用 JWT 来访问此端点。

针对 “获取已认证应用的安装” 的细粒度访问令牌

此端点不适用于 GitHub App 用户访问令牌、GitHub App 安装访问令牌或细粒度个人访问令牌。

“获取已认证应用的安装” 的参数

标头 (Headers)
名称, 类型, 描述
accept string

建议设置为 application/vnd.github+json

路径参数
名称, 类型, 描述
installation_id 整数 必填

安装的唯一标识符。

针对 “获取已认证应用的安装” 的 HTTP 响应状态码

状态码描述
200

OK (成功)

404

未找到资源

针对 “获取已认证应用的安装” 的代码示例

请求示例

GET/app/installations/{installation_id}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/app/installations/1

响应

状态: 200
{ "id": 1, "account": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "access_tokens_url": "https://api.github.com/app/installations/1/access_tokens", "repositories_url": "https://api.github.com/installation/repositories", "html_url": "https://github.com/organizations/github/settings/installations/1", "app_id": 1, "target_id": 1, "target_type": "Organization", "permissions": { "checks": "write", "metadata": "read", "contents": "read" }, "events": [ "push", "pull_request" ], "single_file_name": "config.yaml", "has_multiple_single_files": true, "single_file_paths": [ "config.yml", ".github/issue_TEMPLATE.md" ], "repository_selection": "selected", "created_at": "2017-07-08T16:18:44-04:00", "updated_at": "2017-07-08T16:18:44-04:00", "app_slug": "github-actions", "suspended_at": null, "suspended_by": null }

删除已认证应用的安装

在用户、组织或企业账户上卸载 GitHub 应用。如果您更倾向于暂时暂停应用对您账户资源的访问,我们建议使用 “暂停应用安装” 端点。

您必须使用 JWT 来访问此端点。

针对 “删除已认证应用的安装” 的细粒度访问令牌

此端点不适用于 GitHub App 用户访问令牌、GitHub App 安装访问令牌或细粒度个人访问令牌。

“删除已认证应用的安装” 的参数

标头 (Headers)
名称, 类型, 描述
accept string

建议设置为 application/vnd.github+json

路径参数
名称, 类型, 描述
installation_id 整数 必填

安装的唯一标识符。

针对 “删除已认证应用的安装” 的 HTTP 响应状态码

状态码描述
202

已接受

404

未找到资源

针对 “删除已认证应用的安装” 的代码示例

请求示例

DELETE/app/installations/{installation_id}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/app/installations/1

响应

状态:202

为应用创建安装访问令牌

创建一个安装访问令牌,使 GitHub 应用能够对其在组织或个人账户上的安装进行经过身份验证的 API 请求。安装令牌的有效期为创建后的一小时。使用过期的令牌会返回 401 - Unauthorized 状态码,需要创建新的安装令牌。默认情况下,安装令牌可访问该安装拥有权限的所有仓库。

您可以选择使用 repositoriesrepository_ids 请求体参数来指定令牌可以访问的单个仓库。如果不使用 repositoriesrepository_ids 来授予特定仓库的访问权限,安装访问令牌将拥有该安装被授予的所有仓库的访问权限。安装访问令牌无法被授予访问未被安装授权的仓库。最多可以列出 500 个仓库。

可选地,使用 permissions 请求体参数来指定安装访问令牌应拥有的权限。如果未指定 permissions,则安装访问令牌将拥有授予给应用的全部权限。安装访问令牌不能拥有应用未获得的权限。

您必须使用 JWT 来访问此端点。

针对 “为应用创建安装访问令牌” 的细粒度访问令牌

此端点不适用于 GitHub App 用户访问令牌、GitHub App 安装访问令牌或细粒度个人访问令牌。

“为应用创建安装访问令牌” 的参数

标头 (Headers)
名称, 类型, 描述
accept string

建议设置为 application/vnd.github+json

路径参数
名称, 类型, 描述
installation_id 整数 必填

安装的唯一标识符。

正文参数 (Body parameters)
名称, 类型, 描述
repositories array of strings

令牌应拥有访问权限的仓库名称列表

repository_ids array of integers

令牌应拥有访问权限的仓库 ID 列表

permissions object

授予用户访问令牌的权限。

名称, 类型, 描述
actions string

为 GitHub Actions 工作流、工作流运行和制品授予访问令牌的权限级别。

可为以下之一:readwrite

administration string

为仓库的创建、删除、设置、团队和协作者创建授予访问令牌的权限级别。

可为以下之一:readwrite

artifact_metadata string

为创建和检索构建制品元数据记录授予访问令牌的权限级别。

可为以下之一:readwrite

attestations string

为创建和检索仓库鉴定授予访问令牌的权限级别。

可为以下之一:readwrite

checks string

为代码检查授予访问令牌的权限级别。

可为以下之一:readwrite

codespaces string

为创建、编辑、删除和列出 Codespaces 授予访问令牌的权限级别。

可为以下之一:readwrite

contents string

为仓库内容、提交、分支、下载、发布和合并授予访问令牌的权限级别。

可为以下之一:readwrite

dependabot_secrets string

为管理 Dependabot 机密授予访问令牌的权限级别。

可为以下之一:readwrite

deployments string

为部署和部署状态授予访问令牌的权限级别。

可为以下之一:readwrite

discussions string

为讨论及相关评论和标签授予访问令牌的权限级别。

可为以下之一:readwrite

environments string

为管理仓库环境授予访问令牌的权限级别。

可为以下之一:readwrite

issues string

为议题及相关评论、指派者、标签和里程碑授予访问令牌的权限级别。

可为以下之一:readwrite

merge_queues string

为管理仓库的合并队列授予访问令牌的权限级别。

可为以下之一:readwrite

metadata string

为搜索仓库、列出协作者以及访问仓库元数据授予访问令牌的权限级别。

可为以下之一:readwrite

packages string

为发布到 GitHub Packages 的软件包授予访问令牌的权限级别。

可为以下之一:readwrite

pages string

为检索 Pages 状态、配置和构建以及创建新构建授予访问令牌的权限级别。

可为以下之一:readwrite

pull_requests string

为拉取请求及相关评论、指派者、标签、里程碑和合并授予访问令牌的权限级别。

可为以下之一:readwrite

repository_custom_properties string

在属性允许的情况下,为查看和编辑仓库的自定义属性授予访问令牌的权限级别。

可为以下之一:readwrite

repository_hooks string

为管理仓库的 post-receive 钩子授予访问令牌的权限级别。

可为以下之一:readwrite

repository_projects string

为管理仓库项目、列和卡片授予访问令牌的权限级别。

可为以下之一:readwriteadmin

secret_scanning_alerts string

为查看和管理机密扫描警报授予访问令牌的权限级别。

可为以下之一:readwrite

secrets string

为管理仓库机密授予访问令牌的权限级别。

可为以下之一:readwrite

security_events string

为查看和管理安全事件(如代码扫描警报)授予访问令牌的权限级别。

可为以下之一:readwrite

single_file string

为管理单个文件授予访问令牌的权限级别。

可为以下之一:readwrite

statuses string

为提交状态授予访问令牌的权限级别。

可为以下之一:readwrite

vulnerability_alerts string

为管理 Dependabot 警报授予访问令牌的权限级别。

可为以下之一:readwrite

workflows string

为更新 GitHub Actions 工作流文件授予访问令牌的权限级别。

值:write

custom_properties_for_organizations string

在属性允许的情况下,为查看和编辑组织的自定义属性授予访问令牌的权限级别。

可为以下之一:readwrite

members string

为组织团队和成员授予访问令牌的权限级别。

可为以下之一:readwrite

organization_administration string

为管理组织的访问权限授予访问令牌的权限级别。

可为以下之一:readwrite

organization_custom_roles string

为自定义仓库角色管理授予访问令牌的权限级别。

可为以下之一:readwrite

organization_custom_org_roles string

为自定义组织角色管理授予访问令牌的权限级别。

可为以下之一:readwrite

organization_custom_properties string

为在组织层面管理仓库自定义属性授予访问令牌的权限级别。

可为以下之一:readwriteadmin

organization_copilot_seat_management string

为管理拥有 Copilot Business 订阅的组织成员对 GitHub Copilot 的访问授权授予访问令牌的权限级别。此属性处于公开预览阶段,可能会更改。

值:write

organization_copilot_agent_settings string

为查看和管理组织的 Copilot 编码代理设置授予访问令牌的权限级别。

可为以下之一:readwrite

organization_announcement_banners string

为查看和管理组织的公告横幅授予访问令牌的权限级别。

可为以下之一:readwrite

organization_events string

为查看组织中活动触发的事件授予访问令牌的权限级别。

值:read

organization_hooks string

为管理组织的 post-receive 钩子授予访问令牌的权限级别。

可为以下之一:readwrite

organization_personal_access_tokens string

为查看和管理组织对细粒度个人访问令牌请求的权限授予访问令牌的权限级别。

可为以下之一:readwrite

organization_personal_access_token_requests string

为查看和管理组织已批准的细粒度个人访问令牌的权限授予访问令牌的权限级别。

可为以下之一:readwrite

organization_plan string

为查看组织的计划授予访问令牌的权限级别。

值:read

organization_projects string

为管理组织项目及项目公开预览(如适用)授予访问令牌的权限级别。

可为以下之一:readwriteadmin

organization_packages string

为组织在 GitHub Packages 上发布的软件包授予访问令牌的权限级别。

可为以下之一:readwrite

organization_secrets string

为管理组织机密授予访问令牌的权限级别。

可为以下之一:readwrite

organization_self_hosted_runners string

为查看和管理组织可用的 GitHub Actions 自托管运行器授予访问令牌的权限级别。

可为以下之一:readwrite

organization_user_blocking string

为查看和管理组织阻止的用户授予访问令牌的权限级别。

可为以下之一:readwrite

email_addresses string

为管理用户的电子邮件地址授予访问令牌的权限级别。

可为以下之一:readwrite

followers string

为管理用户的关注者授予访问令牌的权限级别。

可为以下之一:readwrite

git_ssh_keys string

为管理 git SSH 密钥授予访问令牌的权限级别。

可为以下之一:readwrite

gpg_keys string

为查看和管理用户的 GPG 密钥授予访问令牌的权限级别。

可为以下之一:readwrite

interaction_limits string

为查看和管理仓库的互动限制授予访问令牌的权限级别。

可为以下之一:readwrite

profile string

为管理用户的个人资料设置授予访问令牌的权限级别。

值:write

starring string

为列出和管理用户加星的仓库授予访问令牌的权限级别。

可为以下之一:readwrite

enterprise_custom_properties_for_organizations string

为在企业层面管理组织的自定义属性授予访问令牌的权限级别。

可为以下之一:readwriteadmin

针对 “为应用创建安装访问令牌” 的 HTTP 响应状态码

状态码描述
201

已创建

401

需要身份验证

403

禁止 (Forbidden)

404

未找到资源

422

验证失败,或端点已被滥用。

针对 “为应用创建安装访问令牌” 的代码示例

请求示例

POST/app/installations/{installation_id}/access_tokens
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/app/installations/1/access_tokens \ -d '{"repositories":["Hello-World"],"permissions":{"issues":"write","contents":"read"}}'

响应

状态:201
{ "token": "ghs_16C7e42F292c6912E7710c838347Ae178B4a", "expires_at": "2016-07-11T22:14:10Z", "permissions": { "issues": "write", "contents": "read" }, "repository_selection": "selected", "repositories": [ { "id": 1296269, "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", "name": "Hello-World", "full_name": "octocat/Hello-World", "owner": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "private": false, "html_url": "https://github.com/octocat/Hello-World", "description": "This your first repo!", "fork": false, "url": "https://api.github.com/repos/octocat/Hello-World", "archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", "assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}", "blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", "branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}", "collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", "comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}", "commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}", "compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", "contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}", "contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors", "deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments", "downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads", "events_url": "https://api.github.com/repos/octocat/Hello-World/events", "forks_url": "https://api.github.com/repos/octocat/Hello-World/forks", "git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", "git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", "git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", "git_url": "git:github.com/octocat/Hello-World.git", "issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", "issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}", "issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}", "keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}", "labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}", "languages_url": "https://api.github.com/repos/octocat/Hello-World/languages", "merges_url": "https://api.github.com/repos/octocat/Hello-World/merges", "milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}", "notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}", "pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}", "releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}", "ssh_url": "git@github.com:octocat/Hello-World.git", "stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers", "statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}", "subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers", "subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription", "tags_url": "https://api.github.com/repos/octocat/Hello-World/tags", "teams_url": "https://api.github.com/repos/octocat/Hello-World/teams", "trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", "clone_url": "https://github.com/octocat/Hello-World.git", "mirror_url": "git:git.example.com/octocat/Hello-World", "hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks", "svn_url": "https://svn.github.com/octocat/Hello-World", "homepage": "https://github.com", "language": null, "forks_count": 9, "stargazers_count": 80, "watchers_count": 80, "size": 108, "default_branch": "master", "open_issues_count": 0, "is_template": true, "topics": [ "octocat", "atom", "electron", "api" ], "has_issues": true, "has_projects": true, "has_wiki": true, "has_pages": false, "has_downloads": true, "archived": false, "disabled": false, "visibility": "public", "pushed_at": "2011-01-26T19:06:43Z", "created_at": "2011-01-26T19:01:12Z", "updated_at": "2011-01-26T19:14:43Z", "permissions": { "admin": false, "push": false, "pull": true }, "allow_rebase_merge": true, "template_repository": null, "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O", "allow_squash_merge": true, "allow_auto_merge": false, "delete_branch_on_merge": true, "allow_merge_commit": true, "subscribers_count": 42, "network_count": 0, "license": { "key": "mit", "name": "MIT License", "url": "https://api.github.com/licenses/mit", "spdx_id": "MIT", "node_id": "MDc6TGljZW5zZW1pdA==", "html_url": "https://github.com/licenses/mit" }, "forks": 1, "open_issues": 1, "watchers": 1 } ] }

暂停应用安装

在用户、组织或企业账户上暂停 GitHub 应用,这会阻止该应用访问该账户的资源。当 GitHub 应用被暂停时,应用对该账户的 GitHub API 或 webhook 事件的访问将被阻止。

您必须使用 JWT 来访问此端点。

针对“暂停应用安装”的细粒度访问令牌

此端点不适用于 GitHub App 用户访问令牌、GitHub App 安装访问令牌或细粒度个人访问令牌。

“暂停应用安装”的参数

标头 (Headers)
名称, 类型, 描述
accept string

建议设置为 application/vnd.github+json

路径参数
名称, 类型, 描述
installation_id 整数 必填

安装的唯一标识符。

“暂停应用安装”的 HTTP 响应状态码

状态码描述
204

无内容 (No Content)

404

未找到资源

“暂停应用安装”的代码示例

请求示例

put/app/installations/{installation_id}/suspended
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/app/installations/1/suspended

响应

状态: 204

解除暂停应用安装

移除对 GitHub 应用安装的暂停状态。

您必须使用 JWT 来访问此端点。

针对“解除暂停应用安装”的细粒度访问令牌

此端点不适用于 GitHub App 用户访问令牌、GitHub App 安装访问令牌或细粒度个人访问令牌。

“解除暂停应用安装”的参数

标头 (Headers)
名称, 类型, 描述
accept string

建议设置为 application/vnd.github+json

路径参数
名称, 类型, 描述
installation_id 整数 必填

安装的唯一标识符。

“解除暂停应用安装”的 HTTP 响应状态码

状态码描述
204

无内容 (No Content)

404

未找到资源

“解除暂停应用安装”的代码示例

请求示例

delete/app/installations/{installation_id}/suspended
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/app/installations/1/suspended

响应

状态: 204

创建受限范围访问令牌

使用非受限范围的用户访问令牌来创建仓库受限范围和/或权限受限范围的用户访问令牌。您可以指定令牌能够访问的仓库以及授予令牌的权限。

无效的令牌将返回 404 NOT FOUND

“创建受限范围访问令牌”的基本身份验证

您必须使用 基本身份验证 来调用此端点。使用应用的 client_id 作为用户名,client_secret 作为密码。

“创建受限范围访问令牌”的参数

标头 (Headers)
名称, 类型, 描述
accept string

建议设置为 application/vnd.github+json

路径参数
名称, 类型, 描述
client_id string 必填

GitHub 应用的客户端 ID。

正文参数 (Body parameters)
名称, 类型, 描述
access_token string 必填

用于认证 GitHub API 的访问令牌。

target string

要将用户访问令牌作用域限定到的用户或组织名称。必填,除非已指定 target_id

target_id integer

要将用户访问令牌作用域限定到的用户或组织的 ID。必填,除非已指定 target

repositories array of strings

要将用户访问令牌作用域限定到的仓库名称列表。如果已指定 repository_ids,则不得再指定 repositories

repository_ids array of integers

要将用户访问令牌作用域限定到的仓库 ID 列表。如果已指定 repositories,则不得再指定 repository_ids

permissions object

授予用户访问令牌的权限。

名称, 类型, 描述
actions string

为 GitHub Actions 工作流、工作流运行和制品授予访问令牌的权限级别。

可为以下之一:readwrite

administration string

为仓库的创建、删除、设置、团队和协作者创建授予访问令牌的权限级别。

可为以下之一:readwrite

artifact_metadata string

为创建和检索构建制品元数据记录授予访问令牌的权限级别。

可为以下之一:readwrite

attestations string

为创建和检索仓库鉴定授予访问令牌的权限级别。

可为以下之一:readwrite

checks string

为代码检查授予访问令牌的权限级别。

可为以下之一:readwrite

codespaces string

为创建、编辑、删除和列出 Codespaces 授予访问令牌的权限级别。

可为以下之一:readwrite

contents string

为仓库内容、提交、分支、下载、发布和合并授予访问令牌的权限级别。

可为以下之一:readwrite

dependabot_secrets string

为管理 Dependabot 机密授予访问令牌的权限级别。

可为以下之一:readwrite

deployments string

为部署和部署状态授予访问令牌的权限级别。

可为以下之一:readwrite

discussions string

为讨论及相关评论和标签授予访问令牌的权限级别。

可为以下之一:readwrite

environments string

为管理仓库环境授予访问令牌的权限级别。

可为以下之一:readwrite

issues string

为议题及相关评论、指派者、标签和里程碑授予访问令牌的权限级别。

可为以下之一:readwrite

merge_queues string

为管理仓库的合并队列授予访问令牌的权限级别。

可为以下之一:readwrite

metadata string

为搜索仓库、列出协作者以及访问仓库元数据授予访问令牌的权限级别。

可为以下之一:readwrite

packages string

为发布到 GitHub Packages 的软件包授予访问令牌的权限级别。

可为以下之一:readwrite

pages string

为检索 Pages 状态、配置和构建以及创建新构建授予访问令牌的权限级别。

可为以下之一:readwrite

pull_requests string

为拉取请求及相关评论、指派者、标签、里程碑和合并授予访问令牌的权限级别。

可为以下之一:readwrite

repository_custom_properties string

在属性允许的情况下,为查看和编辑仓库的自定义属性授予访问令牌的权限级别。

可为以下之一:readwrite

repository_hooks string

为管理仓库的 post-receive 钩子授予访问令牌的权限级别。

可为以下之一:readwrite

repository_projects string

为管理仓库项目、列和卡片授予访问令牌的权限级别。

可为以下之一:readwriteadmin

secret_scanning_alerts string

为查看和管理机密扫描警报授予访问令牌的权限级别。

可为以下之一:readwrite

secrets string

为管理仓库机密授予访问令牌的权限级别。

可为以下之一:readwrite

security_events string

为查看和管理安全事件(如代码扫描警报)授予访问令牌的权限级别。

可为以下之一:readwrite

single_file string

为管理单个文件授予访问令牌的权限级别。

可为以下之一:readwrite

statuses string

为提交状态授予访问令牌的权限级别。

可为以下之一:readwrite

vulnerability_alerts string

为管理 Dependabot 警报授予访问令牌的权限级别。

可为以下之一:readwrite

workflows string

为更新 GitHub Actions 工作流文件授予访问令牌的权限级别。

值:write

custom_properties_for_organizations string

在属性允许的情况下,为查看和编辑组织的自定义属性授予访问令牌的权限级别。

可为以下之一:readwrite

members string

为组织团队和成员授予访问令牌的权限级别。

可为以下之一:readwrite

organization_administration string

为管理组织的访问权限授予访问令牌的权限级别。

可为以下之一:readwrite

organization_custom_roles string

为自定义仓库角色管理授予访问令牌的权限级别。

可为以下之一:readwrite

organization_custom_org_roles string

为自定义组织角色管理授予访问令牌的权限级别。

可为以下之一:readwrite

organization_custom_properties string

为在组织层面管理仓库自定义属性授予访问令牌的权限级别。

可为以下之一:readwriteadmin

organization_copilot_seat_management string

为管理拥有 Copilot Business 订阅的组织成员对 GitHub Copilot 的访问授权授予访问令牌的权限级别。此属性处于公开预览阶段,可能会更改。

值:write

organization_copilot_agent_settings string

为查看和管理组织的 Copilot 编码代理设置授予访问令牌的权限级别。

可为以下之一:readwrite

organization_announcement_banners string

为查看和管理组织的公告横幅授予访问令牌的权限级别。

可为以下之一:readwrite

organization_events string

为查看组织中活动触发的事件授予访问令牌的权限级别。

值:read

organization_hooks string

为管理组织的 post-receive 钩子授予访问令牌的权限级别。

可为以下之一:readwrite

organization_personal_access_tokens string

为查看和管理组织对细粒度个人访问令牌请求的权限授予访问令牌的权限级别。

可为以下之一:readwrite

organization_personal_access_token_requests string

为查看和管理组织已批准的细粒度个人访问令牌的权限授予访问令牌的权限级别。

可为以下之一:readwrite

organization_plan string

为查看组织的计划授予访问令牌的权限级别。

值:read

organization_projects string

为管理组织项目及项目公开预览(如适用)授予访问令牌的权限级别。

可为以下之一:readwriteadmin

organization_packages string

为组织在 GitHub Packages 上发布的软件包授予访问令牌的权限级别。

可为以下之一:readwrite

organization_secrets string

为管理组织机密授予访问令牌的权限级别。

可为以下之一:readwrite

organization_self_hosted_runners string

为查看和管理组织可用的 GitHub Actions 自托管运行器授予访问令牌的权限级别。

可为以下之一:readwrite

organization_user_blocking string

为查看和管理组织阻止的用户授予访问令牌的权限级别。

可为以下之一:readwrite

email_addresses string

为管理用户的电子邮件地址授予访问令牌的权限级别。

可为以下之一:readwrite

followers string

为管理用户的关注者授予访问令牌的权限级别。

可为以下之一:readwrite

git_ssh_keys string

为管理 git SSH 密钥授予访问令牌的权限级别。

可为以下之一:readwrite

gpg_keys string

为查看和管理用户的 GPG 密钥授予访问令牌的权限级别。

可为以下之一:readwrite

interaction_limits string

为查看和管理仓库的互动限制授予访问令牌的权限级别。

可为以下之一:readwrite

profile string

为管理用户的个人资料设置授予访问令牌的权限级别。

值:write

starring string

为列出和管理用户加星的仓库授予访问令牌的权限级别。

可为以下之一:readwrite

enterprise_custom_properties_for_organizations string

为在企业层面管理组织的自定义属性授予访问令牌的权限级别。

可为以下之一:readwriteadmin

“创建受限范围访问令牌”的 HTTP 响应状态码

状态码描述
200

OK (成功)

401

需要身份验证

403

禁止 (Forbidden)

404

未找到资源

422

验证失败,或端点已被滥用。

“创建受限范围访问令牌”的代码示例

请求示例

post/applications/{client_id}/token/scoped
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -u "<YOUR_CLIENT_ID>:<YOUR_CLIENT_SECRET>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/applications/Iv1.8a61f9b3a7aba766/token/scoped \ -d '{"access_token":"e72e16c7e42f292c6912e7710c838347ae178b4a","target":"octocat","permissions":{"metadata":"read","issues":"write","contents":"read"}}'

响应

状态: 200
{ "id": 1, "url": "https://api.github.com/authorizations/1", "scopes": [], "token": "ghu_16C7e42F292c6912E7710c838347Ae178B4a", "token_last_eight": "Ae178B4a", "hashed_token": "25f94a2a5c7fbaf499c665bc73d67c1c87e496da8985131633ee0a95819db2e8", "app": { "url": "http://my-github-app.com", "name": "my github app", "client_id": "Iv1.8a61f9b3a7aba766" }, "note": "optional note", "note_url": "http://optional/note/url", "updated_at": "2011-09-06T20:39:23Z", "created_at": "2011-09-06T17:26:27Z", "fingerprint": "jklmnop12345678", "expires_at": "2011-09-08T17:26:27Z", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "installation": { "permissions": { "metadata": "read", "issues": "write", "contents": "read" }, "repository_selection": "selected", "single_file_name": ".github/workflow.yml", "repositories_url": "https://api.github.com/user/repos", "account": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "has_multiple_single_files": false, "single_file_paths": [] } }

获取应用

注意

:app_slug 是您 GitHub 应用的 URL 友好名称。您可以在应用的设置页面找到它(例如 https://github.com/settings/apps/:app_slug)。

针对“获取应用”的细粒度访问令牌

此端点支持以下细粒度令牌类型:

细粒度令牌不需要任何权限。

如果仅请求公共资源,可以在不进行身份验证的情况下使用此端点。

“获取应用”的参数

标头 (Headers)
名称, 类型, 描述
accept string

建议设置为 application/vnd.github+json

路径参数
名称, 类型, 描述
app_slug string 必填

“获取应用”的 HTTP 响应状态码

状态码描述
200

OK (成功)

403

禁止 (Forbidden)

404

未找到资源

“获取应用”的代码示例

请求示例

get/apps/{app_slug}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/apps/APP_SLUG

响应

状态: 200
{ "id": 1, "slug": "octoapp", "client_id": "Iv1.ab1112223334445c", "node_id": "MDExOkludGVncmF0aW9uMQ==", "owner": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "name": "Octocat App", "description": "", "external_url": "https://example.com", "html_url": "https://github.com/apps/octoapp", "created_at": "2017-07-08T16:18:44-04:00", "updated_at": "2017-07-08T16:18:44-04:00", "permissions": { "metadata": "read", "contents": "read", "issues": "write", "single_file": "write" }, "events": [ "push", "pull_request" ] }

获取已认证应用的组织安装信息

允许已认证的 GitHub 应用获取组织的安装信息。

您必须使用 JWT 来访问此端点。

针对“获取已认证应用的组织安装信息”的细粒度访问令牌

此端点不适用于 GitHub App 用户访问令牌、GitHub App 安装访问令牌或细粒度个人访问令牌。

“获取已认证应用的组织安装信息”的参数

标头 (Headers)
名称, 类型, 描述
accept string

建议设置为 application/vnd.github+json

路径参数
名称, 类型, 描述
org string 必需

组织名称。该名称不区分大小写。

“获取已认证应用的组织安装信息”的 HTTP 响应状态码

状态码描述
200

OK (成功)

“获取已认证应用的组织安装信息”的代码示例

请求示例

get/orgs/{org}/installation
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/orgs/ORG/installation

响应

状态: 200
{ "id": 1, "account": { "login": "github", "id": 1, "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=", "avatar_url": "https://github.com/images/error/hubot_happy.gif", "gravatar_id": "", "url": "https://api.github.com/orgs/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/orgs/github/repos", "events_url": "https://api.github.com/orgs/github/events", "received_events_url": "https://api.github.com/users/github/received_events", "type": "Organization", "site_admin": false }, "repository_selection": "all", "access_tokens_url": "https://api.github.com/app/installations/1/access_tokens", "repositories_url": "https://api.github.com/installation/repositories", "html_url": "https://github.com/organizations/github/settings/installations/1", "app_id": 1, "client_id": "Iv1.ab1112223334445c", "target_id": 1, "target_type": "Organization", "permissions": { "checks": "write", "metadata": "read", "contents": "read" }, "events": [ "push", "pull_request" ], "created_at": "2018-02-09T20:51:14Z", "updated_at": "2018-02-09T20:51:14Z", "single_file_name": "config.yml", "has_multiple_single_files": true, "single_file_paths": [ "config.yml", ".github/issue_TEMPLATE.md" ], "app_slug": "github-actions", "suspended_at": null, "suspended_by": null }

获取已认证应用的仓库安装信息

允许已认证的 GitHub 应用获取仓库的安装信息。安装的账户类型可能是组织,也可能是用户,取决于仓库所属的账户。

您必须使用 JWT 来访问此端点。

针对“获取已认证应用的仓库安装信息”的细粒度访问令牌

此端点不适用于 GitHub App 用户访问令牌、GitHub App 安装访问令牌或细粒度个人访问令牌。

“获取已认证应用的仓库安装信息”的参数

标头 (Headers)
名称, 类型, 描述
accept string

建议设置为 application/vnd.github+json

路径参数
名称, 类型, 描述
owner string 必填

仓库的账户所有者。名称不区分大小写。

repo string 必填

不带 .git 扩展名的仓库名称。名称不区分大小写。

“获取已认证应用的仓库安装信息”的 HTTP 响应状态码

状态码描述
200

OK (成功)

301

永久移动

404

未找到资源

“获取已认证应用的仓库安装信息”的代码示例

请求示例

get/repos/{owner}/{repo}/installation
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/repos/OWNER/REPO/installation

响应

状态: 200
{ "id": 1, "account": { "login": "github", "id": 1, "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=", "avatar_url": "https://github.com/images/error/hubot_happy.gif", "gravatar_id": "", "url": "https://api.github.com/orgs/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/orgs/github/repos", "events_url": "https://api.github.com/orgs/github/events", "received_events_url": "https://api.github.com/users/github/received_events", "type": "Organization", "site_admin": false }, "repository_selection": "all", "access_tokens_url": "https://api.github.com/app/installations/1/access_tokens", "repositories_url": "https://api.github.com/installation/repositories", "html_url": "https://github.com/organizations/github/settings/installations/1", "app_id": 1, "client_id": "Iv1.ab1112223334445c", "target_id": 1, "target_type": "Organization", "permissions": { "checks": "write", "metadata": "read", "contents": "read" }, "events": [ "push", "pull_request" ], "created_at": "2018-02-09T20:51:14Z", "updated_at": "2018-02-09T20:51:14Z", "single_file_name": "config.yml", "has_multiple_single_files": true, "single_file_paths": [ "config.yml", ".github/issue_TEMPLATE.md" ], "app_slug": "github-actions", "suspended_at": null, "suspended_by": null }

获取已认证应用的用户安装信息

允许已认证的 GitHub 应用获取用户的安装信息。

您必须使用 JWT 来访问此端点。

针对“获取已认证应用的用户安装信息”的细粒度访问令牌

此端点不适用于 GitHub App 用户访问令牌、GitHub App 安装访问令牌或细粒度个人访问令牌。

“获取已认证应用的用户安装信息”的参数

标头 (Headers)
名称, 类型, 描述
accept string

建议设置为 application/vnd.github+json

路径参数
名称, 类型, 描述
username 字符串 必需

GitHub 用户账户的句柄。

“获取已认证应用的用户安装信息”的 HTTP 响应状态码

状态码描述
200

OK (成功)

“获取已认证应用的用户安装信息”的代码示例

请求示例

get/users/{username}/installation
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/users/USERNAME/installation

响应

状态: 200
{ "id": 1, "account": { "login": "github", "id": 1, "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=", "avatar_url": "https://github.com/images/error/hubot_happy.gif", "gravatar_id": "", "url": "https://api.github.com/orgs/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/orgs/github/repos", "events_url": "https://api.github.com/orgs/github/events", "received_events_url": "https://api.github.com/users/github/received_events", "type": "Organization", "site_admin": false }, "repository_selection": "all", "access_tokens_url": "https://api.github.com/app/installations/1/access_tokens", "repositories_url": "https://api.github.com/installation/repositories", "html_url": "https://github.com/organizations/github/settings/installations/1", "app_id": 1, "client_id": "Iv1.ab1112223334445c", "target_id": 1, "target_type": "Organization", "permissions": { "checks": "write", "metadata": "read", "contents": "read" }, "events": [ "push", "pull_request" ], "created_at": "2018-02-09T20:51:14Z", "updated_at": "2018-02-09T20:51:14Z", "single_file_name": "config.yml", "has_multiple_single_files": true, "single_file_paths": [ "config.yml", ".github/issue_TEMPLATE.md" ], "app_slug": "github-actions", "suspended_at": null, "suspended_by": null }
© . This site is unofficial and not affiliated with GitHub, Inc.