Skip to main content
L’API REST est maintenant versionnée. Pour plus d’informations, consultez « À propos des versions de l’API ».

Points de terminaison d’API REST pour les autorisations d’informations d’identification d’entreprise

Utilisez l’API REST pour gérer les autorisations d’informations d’identification d’entreprise.

Revoke all credential authorizations for an enterprise

Revokes all credential authorizations for all organizations within the enterprise. This includes any guest, outside, or repository collaborators.

For Enterprise Managed User (EMU) enterprises, you can optionally also destroy all credentials (PATs v1, PATs v2, and SSH keys) owned by enterprise members by setting the revoke_credentials parameter to true.

This operation is performed asynchronously. A background job will be queued to process the revocations.

Warning

If you use a personal access token to call this endpoint, that token may also be revoked or destroyed as part of this operation.

The authenticated user must be an enterprise owner or have the write_enterprise_credentials permission to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:enterprise scope to use this endpoint.

Jetons d'accès granulaires pour «Revoke all credential authorizations for an enterprise»

Ce point de terminaison fonctionne avec les types de tokens à granularité fine suivants:

Le token à granularité fine doit disposer de l’ensemble d’autorisations suivant:

  • "Enterprise credentials" enterprise permissions (write)

Paramètres pour «Revoke all credential authorizations for an enterprise »

En-têtes
Nom, Type, Description
accept string

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

Paramètres de chemin d’accès
Nom, Type, Description
enterprise string Requis

The slug version of the enterprise name.

Paramètres du corps
Nom, Type, Description
revoke_credentials boolean

Whether to also destroy the actual credentials (PATs and SSH keys) owned by enterprise members. This option is only available for Enterprise Managed User (EMU) enterprises. When set to true, all PATs (v1 and v2) and SSH keys owned by enterprise members will be destroyed in addition to the credential authorizations.

Par défaut: false

Codes d’état de réponse HTTP pour «Revoke all credential authorizations for an enterprise »

Code de statutDescription
202

Accepted - The revocation request has been queued

403

Forbidden

404

Resource not found

422

Validation error - The revoke_credentials option is only available for EMU enterprises

Exemples de code pour «Revoke all credential authorizations for an enterprise »

Si vous accédez à GitHub à GHE.com, remplacez api.github.com par le sous-domaine dédié de votre entreprise à api.SUBDOMAIN.ghe.com.

Exemple de requête

post/enterprises/{enterprise}/credential-authorizations/revoke-all
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/enterprises/ENTERPRISE/credential-authorizations/revoke-all \ -d '{"revoke_credentials":false}'

Accepted - The revocation request has been queued

Status: 202
{ "message": "Credential authorization revocation has been queued" }

Revoke credential authorizations for a user in an enterprise

Revokes all credential authorizations for a single user within the enterprise. This includes any credential authorizations the user has across all organizations in the enterprise.

For Enterprise Managed User (EMU) enterprises, you can optionally also destroy all credentials (PATs v1, PATs v2, and SSH keys) owned by the user by setting the revoke_credentials parameter to true.

This operation is performed asynchronously. A background job will be queued to process the revocations.

Warning

If you use a personal access token to call this endpoint and target yourself, that token may also be revoked or destroyed as part of this operation.

The authenticated user must be an enterprise owner or have the write_enterprise_credentials permission to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:enterprise scope to use this endpoint.

Jetons d'accès granulaires pour «Revoke credential authorizations for a user in an enterprise»

Ce point de terminaison fonctionne avec les types de tokens à granularité fine suivants:

Le token à granularité fine doit disposer de l’ensemble d’autorisations suivant:

  • "Enterprise credentials" enterprise permissions (write)

Paramètres pour «Revoke credential authorizations for a user in an enterprise »

En-têtes
Nom, Type, Description
accept string

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

Paramètres de chemin d’accès
Nom, Type, Description
enterprise string Requis

The slug version of the enterprise name.

username string Requis

The handle for the GitHub user account.

Paramètres du corps
Nom, Type, Description
revoke_credentials boolean

Whether to also destroy the actual credentials (PATs and SSH keys) owned by the user. This option is only available for Enterprise Managed User (EMU) enterprises. When set to true, all PATs (v1 and v2) and SSH keys owned by the user will be destroyed in addition to the credential authorizations.

Par défaut: false

Codes d’état de réponse HTTP pour «Revoke credential authorizations for a user in an enterprise »

Code de statutDescription
202

Accepted - The revocation request has been queued

403

Forbidden

404

Resource not found

422

Validation error - The target user cannot be revoked, or revoke_credentials is not available for this enterprise

Exemples de code pour «Revoke credential authorizations for a user in an enterprise »

Si vous accédez à GitHub à GHE.com, remplacez api.github.com par le sous-domaine dédié de votre entreprise à api.SUBDOMAIN.ghe.com.

Exemple de requête

post/enterprises/{enterprise}/credential-authorizations/{username}/revoke
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/enterprises/ENTERPRISE/credential-authorizations/USERNAME/revoke \ -d '{"revoke_credentials":false}'

Accepted - The revocation request has been queued

Status: 202
{ "message": "Credential authorization revocation for user 'octocat' has been queued" }