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 (成功) |
针对 “获取已认证的应用” 的代码示例
请求示例
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 应用的 id、pem(私钥)和 webhook_secret。
针对 “从清单创建 GitHub 应用” 的细粒度访问令牌
此端点不适用于 GitHub App 用户访问令牌、GitHub App 安装访问令牌或细粒度个人访问令牌。
“从清单创建 GitHub 应用” 的参数
| 名称, 类型, 描述 |
|---|
accept string建议设置为 |
| 名称, 类型, 描述 |
|---|
code string 必填 |
针对 “从清单创建 GitHub 应用” 的 HTTP 响应状态码
| 状态码 | 描述 |
|---|---|
201 | 已创建 |
404 | 未找到资源 |
422 | 验证失败,或端点已被滥用。 |
针对 “从清单创建 GitHub 应用” 的代码示例
请求示例
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 安装访问令牌或细粒度个人访问令牌。
“列出已认证应用的安装请求” 的参数
| 名称, 类型, 描述 |
|---|
accept string建议设置为 |
| 名称, 类型, 描述 |
|---|
per_page integer每页的结果数(最大 100)。有关详细信息,请参阅“在 REST API 中使用分页”。 默认值: |
page integer要获取的结果页码。有关详细信息,请参阅“在 REST API 中使用分页”。 默认值: |
针对 “列出已认证应用的安装请求” 的 HTTP 响应状态码
| 状态码 | 描述 |
|---|---|
200 | 集成安装请求列表 |
304 | 未修改 |
401 | 需要身份验证 |
针对 “列出已认证应用的安装请求” 的代码示例
请求示例
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 安装访问令牌或细粒度个人访问令牌。
“列出已认证应用的安装” 的参数
| 名称, 类型, 描述 |
|---|
accept string建议设置为 |
| 名称, 类型, 描述 |
|---|
per_page integer每页的结果数(最大 100)。有关详细信息,请参阅“在 REST API 中使用分页”。 默认值: |
page integer要获取的结果页码。有关详细信息,请参阅“在 REST API 中使用分页”。 默认值: |
since 字符串仅显示在给定时间之后更新的结果。这是 ISO 8601 格式的时间戳: |
outdated string |
针对 “列出已认证应用的安装” 的 HTTP 响应状态码
| 状态码 | 描述 |
|---|---|
200 | 该安装的权限包含在 |
针对 “列出已认证应用的安装” 的代码示例
请求示例
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 安装访问令牌或细粒度个人访问令牌。
“获取已认证应用的安装” 的参数
| 名称, 类型, 描述 |
|---|
accept string建议设置为 |
| 名称, 类型, 描述 |
|---|
installation_id 整数 必填安装的唯一标识符。 |
针对 “获取已认证应用的安装” 的 HTTP 响应状态码
| 状态码 | 描述 |
|---|---|
200 | OK (成功) |
404 | 未找到资源 |
针对 “获取已认证应用的安装” 的代码示例
请求示例
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 App 用户访问令牌、GitHub App 安装访问令牌或细粒度个人访问令牌。
“删除已认证应用的安装” 的参数
| 名称, 类型, 描述 |
|---|
accept string建议设置为 |
| 名称, 类型, 描述 |
|---|
installation_id 整数 必填安装的唯一标识符。 |
针对 “删除已认证应用的安装” 的 HTTP 响应状态码
| 状态码 | 描述 |
|---|---|
202 | 已接受 |
404 | 未找到资源 |
针对 “删除已认证应用的安装” 的代码示例
请求示例
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 状态码,需要创建新的安装令牌。默认情况下,安装令牌可访问该安装拥有权限的所有仓库。
您可以选择使用 repositories 或 repository_ids 请求体参数来指定令牌可以访问的单个仓库。如果不使用 repositories 或 repository_ids 来授予特定仓库的访问权限,安装访问令牌将拥有该安装被授予的所有仓库的访问权限。安装访问令牌无法被授予访问未被安装授权的仓库。最多可以列出 500 个仓库。
可选地,使用 permissions 请求体参数来指定安装访问令牌应拥有的权限。如果未指定 permissions,则安装访问令牌将拥有授予给应用的全部权限。安装访问令牌不能拥有应用未获得的权限。
您必须使用 JWT 来访问此端点。
针对 “为应用创建安装访问令牌” 的细粒度访问令牌
此端点不适用于 GitHub App 用户访问令牌、GitHub App 安装访问令牌或细粒度个人访问令牌。
“为应用创建安装访问令牌” 的参数
| 名称, 类型, 描述 |
|---|
accept string建议设置为 |
| 名称, 类型, 描述 |
|---|
installation_id 整数 必填安装的唯一标识符。 |
| 名称, 类型, 描述 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
repositories array of strings令牌应拥有访问权限的仓库名称列表 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
repository_ids array of integers令牌应拥有访问权限的仓库 ID 列表 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
permissions object授予用户访问令牌的权限。 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
permissions 的属性
|
针对 “为应用创建安装访问令牌” 的 HTTP 响应状态码
| 状态码 | 描述 |
|---|---|
201 | 已创建 |
401 | 需要身份验证 |
403 | 禁止 (Forbidden) |
404 | 未找到资源 |
422 | 验证失败,或端点已被滥用。 |
针对 “为应用创建安装访问令牌” 的代码示例
请求示例
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 安装访问令牌或细粒度个人访问令牌。
“暂停应用安装”的参数
| 名称, 类型, 描述 |
|---|
accept string建议设置为 |
| 名称, 类型, 描述 |
|---|
installation_id 整数 必填安装的唯一标识符。 |
“暂停应用安装”的 HTTP 响应状态码
| 状态码 | 描述 |
|---|---|
204 | 无内容 (No Content) |
404 | 未找到资源 |
“暂停应用安装”的代码示例
请求示例
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 安装访问令牌或细粒度个人访问令牌。
“解除暂停应用安装”的参数
| 名称, 类型, 描述 |
|---|
accept string建议设置为 |
| 名称, 类型, 描述 |
|---|
installation_id 整数 必填安装的唯一标识符。 |
“解除暂停应用安装”的 HTTP 响应状态码
| 状态码 | 描述 |
|---|---|
204 | 无内容 (No Content) |
404 | 未找到资源 |
“解除暂停应用安装”的代码示例
请求示例
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 作为密码。
“创建受限范围访问令牌”的参数
| 名称, 类型, 描述 |
|---|
accept string建议设置为 |
| 名称, 类型, 描述 |
|---|
client_id string 必填GitHub 应用的客户端 ID。 |
| 名称, 类型, 描述 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
access_token string 必填用于认证 GitHub API 的访问令牌。 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
target string要将用户访问令牌作用域限定到的用户或组织名称。必填,除非已指定 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
target_id integer要将用户访问令牌作用域限定到的用户或组织的 ID。必填,除非已指定 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
repositories array of strings要将用户访问令牌作用域限定到的仓库名称列表。如果已指定 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
repository_ids array of integers要将用户访问令牌作用域限定到的仓库 ID 列表。如果已指定 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
permissions object授予用户访问令牌的权限。 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
permissions 的属性
|
“创建受限范围访问令牌”的 HTTP 响应状态码
| 状态码 | 描述 |
|---|---|
200 | OK (成功) |
401 | 需要身份验证 |
403 | 禁止 (Forbidden) |
404 | 未找到资源 |
422 | 验证失败,或端点已被滥用。 |
“创建受限范围访问令牌”的代码示例
请求示例
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)。
针对“获取应用”的细粒度访问令牌
此端点支持以下细粒度令牌类型:
细粒度令牌不需要任何权限。
如果仅请求公共资源,可以在不进行身份验证的情况下使用此端点。
“获取应用”的参数
| 名称, 类型, 描述 |
|---|
accept string建议设置为 |
| 名称, 类型, 描述 |
|---|
app_slug string 必填 |
“获取应用”的 HTTP 响应状态码
| 状态码 | 描述 |
|---|---|
200 | OK (成功) |
403 | 禁止 (Forbidden) |
404 | 未找到资源 |
“获取应用”的代码示例
请求示例
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 安装访问令牌或细粒度个人访问令牌。
“获取已认证应用的组织安装信息”的参数
| 名称, 类型, 描述 |
|---|
accept string建议设置为 |
| 名称, 类型, 描述 |
|---|
org string 必需组织名称。该名称不区分大小写。 |
“获取已认证应用的组织安装信息”的 HTTP 响应状态码
| 状态码 | 描述 |
|---|---|
200 | OK (成功) |
“获取已认证应用的组织安装信息”的代码示例
请求示例
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 安装访问令牌或细粒度个人访问令牌。
“获取已认证应用的仓库安装信息”的参数
| 名称, 类型, 描述 |
|---|
accept string建议设置为 |
| 名称, 类型, 描述 |
|---|
owner string 必填仓库的账户所有者。名称不区分大小写。 |
repo string 必填不带 |
“获取已认证应用的仓库安装信息”的 HTTP 响应状态码
| 状态码 | 描述 |
|---|---|
200 | OK (成功) |
301 | 永久移动 |
404 | 未找到资源 |
“获取已认证应用的仓库安装信息”的代码示例
请求示例
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 安装访问令牌或细粒度个人访问令牌。
“获取已认证应用的用户安装信息”的参数
| 名称, 类型, 描述 |
|---|
accept string建议设置为 |
| 名称, 类型, 描述 |
|---|
username 字符串 必需GitHub 用户账户的句柄。 |
“获取已认证应用的用户安装信息”的 HTTP 响应状态码
| 状态码 | 描述 |
|---|---|
200 | OK (成功) |
“获取已认证应用的用户安装信息”的代码示例
请求示例
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 }