REST API 现已经过版本控制。 有关详细信息,请参阅“关于 API 版本控制”。
撤销
使用 REST API 撤销在 GitHub 或其他位置公开的凭据。
Revoke a list of credentials
Submit a list of credentials to be revoked. This endpoint is intended to revoke credentials the caller does not own and may have found exposed on GitHub.com or elsewhere. Credential owners will be notified of the revocation.
This endpoint currently accepts the following credential types:
- classic personal access tokens
- fine-grained personal access tokens
To prevent abuse, this API is limited to 60 authenticated requests per hour and a max of 1000 tokens per API request.
“Revoke a list of credentials”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌不需要任何权限。
“Revoke a list of credentials”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
credentials array of strings 必须A list of credentials to be revoked, up to 1000 per request. |
“Revoke a list of credentials”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
202 | Accepted |
422 | Validation failed, or the endpoint has been spammed. |
500 | Internal Error |
“Revoke a list of credentials”的示例代码
请求示例
post/credentials/revoke
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/credentials/revoke \
-d '{"credentials":["ghp_1234567890abcdef1234567890abcdef12345678","ghp_abcdef1234567890abcdef1234567890abcdef12"]}'
Accepted
Status: 202